From aff52458f9648dde634e5a26bd59ac32eecf62fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 9 May 2020 04:25:30 +0200 Subject: [PATCH] Remove controller tests for path identification --- tests/v3/DomainTest.php | 22 +++++++++++++++++++ tests/v3/PathIdentificationTest.php | 34 ----------------------------- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/tests/v3/DomainTest.php b/tests/v3/DomainTest.php index f03c1000..efb72a1a 100644 --- a/tests/v3/DomainTest.php +++ b/tests/v3/DomainTest.php @@ -59,9 +59,31 @@ class DomainTest extends TestCase app(DomainTenantResolver::class)->resolve('foo.localhost'); } + + /** @test */ + public function tenancy_is_initialized_prior_to_controller_constructors() + { + // todo + $this->assertTrue(app('tenancy_was_initialized_in_constructor')); + $this->assertTrue(tenancy()->initialized); + $this->assertSame('acme', tenant('id')); + } } class Tenant extends Models\Tenant { use HasDomains; } + +class TestController +{ + public function __construct() + { + app()->instance('tenancy_was_initialized_in_constructor', tenancy()->initialized); + } + + public function index() + { + return 'foo'; + } +} \ No newline at end of file diff --git a/tests/v3/PathIdentificationTest.php b/tests/v3/PathIdentificationTest.php index 5747faa0..9856cc26 100644 --- a/tests/v3/PathIdentificationTest.php +++ b/tests/v3/PathIdentificationTest.php @@ -74,38 +74,4 @@ class PathIdentificationTest extends TestCase $this->assertFalse(tenancy()->initialized); } - - /** @test */ - public function tenancy_is_initialized_prior_to_controller_constructors() - { - // todo same test for domain resolver - - Tenant::create([ - 'id' => 'acme', - ]); - - $this->assertFalse(tenancy()->initialized); - - $this - ->get('/acme/bar') - ->assertSee('foo'); - - // todo make this pass - $this->assertTrue(app('tenancy_was_initialized_in_constructor')); - $this->assertTrue(tenancy()->initialized); - $this->assertSame('acme', tenant('id')); - } } - -class TestController -{ - public function __construct() - { - app()->instance('tenancy_was_initialized_in_constructor', tenancy()->initialized); - } - - public function index() - { - return 'foo'; - } -} \ No newline at end of file