mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 20:54:04 +00:00
[2.3.0] tenant_route() helper (#229)
* Add tenant_route helper * Add tests * Remove redundant setUp() * Fix test namespaces * Apply fixes from StyleCI
This commit is contained in:
parent
4e477b472f
commit
fd00be646e
4 changed files with 36 additions and 10 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Tests\Feature;
|
||||
namespace Stancl\Tenancy\Tests\Features;
|
||||
|
||||
use Stancl\Tenancy\Tests\TestCase;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Tests\Feature;
|
||||
namespace Stancl\Tenancy\Tests\Features;
|
||||
|
||||
use Stancl\Tenancy\Features\Timestamps;
|
||||
use Stancl\Tenancy\Tenant;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Tests\Feature;
|
||||
namespace Stancl\Tenancy\Tests;
|
||||
|
||||
use Route;
|
||||
use Stancl\Tenancy\Tenant;
|
||||
use Stancl\Tenancy\Tests\TestCase;
|
||||
|
||||
class TenantRedirectMacroTest extends TestCase
|
||||
class RedirectTest extends TestCase
|
||||
{
|
||||
public $autoCreateTenant = false;
|
||||
public $autoInitTenancy = false;
|
||||
|
|
@ -34,4 +33,17 @@ class TenantRedirectMacroTest extends TestCase
|
|||
$this->get('/redirect')
|
||||
->assertRedirect('http://abcd/foobar');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function tenant_route_helper_generates_correct_url()
|
||||
{
|
||||
Route::get('/abcdef/{a?}/{b?}', function () {
|
||||
return 'Foo';
|
||||
})->name('foo');
|
||||
|
||||
$this->assertSame('http://foo.localhost/abcdef/as/df', tenant_route('foo', ['a' => 'as', 'b' => 'df'], 'foo.localhost'));
|
||||
$this->assertSame('http://foo.localhost/abcdef', tenant_route('foo', [], 'foo.localhost'));
|
||||
|
||||
$this->assertSame('http://' . request()->getHost() . '/abcdef/x/y', tenant_route('foo', ['a' => 'x', 'b' => 'y']));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue