Skip to content

Commit

Permalink
StaticModelProvider update
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Sep 30, 2023
1 parent 71e6905 commit 58de985
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
11 changes: 1 addition & 10 deletions lib/Hooks.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/*
* This file is part of the ICanBoogie package.
*
* (c) Olivier Laviale <[email protected]>
*
* 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;
Expand All @@ -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)
);
}
Expand Down
16 changes: 4 additions & 12 deletions tests/lib/ServicesTest.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
<?php

/*
* This file is part of the ICanBoogie package.
*
* (c) Olivier Laviale <[email protected]>
*
* 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());
}
}

0 comments on commit 58de985

Please sign in to comment.