mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:34:04 +00:00
update tests
This commit is contained in:
parent
cab6f6c1c5
commit
3bdd624fc9
2 changed files with 4 additions and 3 deletions
|
|
@ -12,7 +12,7 @@ class CrossDomainRedirect implements Feature
|
|||
{
|
||||
public function bootstrap(TenantManager $tenantManager): void
|
||||
{
|
||||
RedirectResponse::macro('tenant', function (string $domain) {
|
||||
RedirectResponse::macro('domain', function (string $domain) {
|
||||
// replace first occurance of hostname fragment with $domain
|
||||
$url = $this->getTargetUrl();
|
||||
$hostname = parse_url($url, PHP_URL_HOST);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Tests;
|
||||
|
||||
use Route;
|
||||
use Stancl\Tenancy\Features\CrossDomainRedirect;
|
||||
use Stancl\Tenancy\Tenant;
|
||||
|
||||
class RedirectTest extends TestCase
|
||||
|
|
@ -16,7 +17,7 @@ class RedirectTest extends TestCase
|
|||
public function tenant_redirect_macro_replaces_only_the_hostname()
|
||||
{
|
||||
config([
|
||||
'tenancy.features' => ['Stancl\Tenancy\Features\TenantRedirect'],
|
||||
'tenancy.features' => [CrossDomainRedirect::class],
|
||||
]);
|
||||
|
||||
Route::get('/foobar', function () {
|
||||
|
|
@ -24,7 +25,7 @@ class RedirectTest extends TestCase
|
|||
})->name('home');
|
||||
|
||||
Route::get('/redirect', function () {
|
||||
return redirect()->route('home')->tenant('abcd');
|
||||
return redirect()->route('home')->domain('abcd');
|
||||
});
|
||||
|
||||
Tenant::create('foo.localhost');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue