From 1a88cad4d684ad8b474db324693bfe4a527bcbe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Wed, 14 Aug 2019 17:32:33 +0200 Subject: [PATCH] [1.7.0] Fix Events system (#94) * Add TenantManagerEvents * Apply fixes from StyleCI * Fix typos, add tests * end() events * Travis should be failing * Uncomment ending --- src/Traits/BootstrapsTenancy.php | 8 ++++++++ test | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Traits/BootstrapsTenancy.php b/src/Traits/BootstrapsTenancy.php index cbfd9465..624b2180 100644 --- a/src/Traits/BootstrapsTenancy.php +++ b/src/Traits/BootstrapsTenancy.php @@ -41,6 +41,10 @@ trait BootstrapsTenancy public function end() { + array_map(function ($listener) { + $listener($this); + }, $this->listeners['ending']); + $this->initialized = false; $this->disconnectDatabase(); @@ -49,6 +53,10 @@ trait BootstrapsTenancy } $this->untagCache(); $this->resetFileSystemRootPaths(); + + array_map(function ($listener) { + $listener($this); + }, $this->listeners['ended']); } public function switchDatabaseConnection() diff --git a/test b/test index 5516ec57..ff55e60b 100755 --- a/test +++ b/test @@ -1,4 +1,5 @@ #!/bin/bash +set -e # for development docker-compose up -d @@ -6,4 +7,4 @@ printf "Variant 1\n\n" TENANCY_TEST_REDIS_TENANCY=1 TENANCY_TEST_REDIS_CLIENT=phpredis docker-compose exec test vendor/bin/phpunit --coverage-php coverage/1.cov "$@" printf "Variant 2\n\n" TENANCY_TEST_REDIS_TENANCY=0 TENANCY_TEST_REDIS_CLIENT=predis docker-compose exec test vendor/bin/phpunit --coverage-php coverage/2.cov "$@" -docker-compose exec test vendor/bin/phpcov merge --clover clover.xml coverage/ \ No newline at end of file +docker-compose exec test vendor/bin/phpcov merge --clover clover.xml coverage/