From aec73f28b4a0aab923c27656f00cb5d3d2dc316a Mon Sep 17 00:00:00 2001 From: MinaseTaki Date: Mon, 27 Jul 2020 13:27:15 +0300 Subject: [PATCH] Update ResourceSyncingTest.php --- tests/ResourceSyncingTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/ResourceSyncingTest.php b/tests/ResourceSyncingTest.php index 570448d1..6a6ff246 100644 --- a/tests/ResourceSyncingTest.php +++ b/tests/ResourceSyncingTest.php @@ -573,6 +573,29 @@ class ResourceSyncingTest extends TestCase return $event->tenant === null; }); } + + /** @test */ + public function create_central_user_from_tenant_context() + { + $tenant = ResourceTenant::create(); + $this->migrateTenants(); + + tenancy()->initialize($tenant); + + // Create user in central DB + $user = CentralUser::create([ + 'global_id' => 'test2', + 'name' => 'Test John Doe', + 'email' => 'testjohn@localhost', + 'password' => 'secret', + 'role' => 'superadmin', // unsynced + ]); + + //$this->assertCount(1, $tenant->users()->get()); + $this->assertCount(1, ResourceUser::all()); + + tenancy()->end(); + } } class ResourceTenant extends Tenant