From 58de985ef72f957cdfb6c0dcb9e1cbaaa26ff124 Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Sat, 30 Sep 2023 13:18:18 +0200 Subject: [PATCH] StaticModelProvider update --- lib/Hooks.php | 11 +---------- tests/lib/ServicesTest.php | 16 ++++------------ 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/lib/Hooks.php b/lib/Hooks.php index 341dc9f..8791d34 100644 --- a/lib/Hooks.php +++ b/lib/Hooks.php @@ -1,14 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace ICanBoogie\Binding\ActiveRecord; use ICanBoogie\ActiveRecord; @@ -30,7 +21,7 @@ final class Hooks */ public static function on_app_boot(Application\BootEvent $event): void { - StaticModelProvider::define( + StaticModelProvider::set( static fn() => $event->app->service_for_class(ModelProvider::class) ); } diff --git a/tests/lib/ServicesTest.php b/tests/lib/ServicesTest.php index 30d85c7..62a7087 100644 --- a/tests/lib/ServicesTest.php +++ b/tests/lib/ServicesTest.php @@ -1,26 +1,18 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Test\ICanBoogie\Binding\ActiveRecord; use ICanBoogie\ActiveRecord\StaticModelProvider; +use ICanBoogie\Application\BootEvent; use PHPUnit\Framework\TestCase; final class ServicesTest extends TestCase { /** - * Troubleshoot: config/event.php + * Asserts {@link BootEvent} was leveraged to configure the static model provider. */ - public function test_get_models(): void + public function test_get_model_provider(): void { - $this->assertNotNull(StaticModelProvider::defined()); + $this->assertNotNull(StaticModelProvider::get()); } }