File tree Expand file tree Collapse file tree 6 files changed +94
-6
lines changed
Expand file tree Collapse file tree 6 files changed +94
-6
lines changed Original file line number Diff line number Diff line change 1+ .phpdoc /
2+ docs /
3+ vendor /
4+ composer.lock
5+ .phpunit.result.cache
Original file line number Diff line number Diff line change 11{
2- "name" : " micro/kernel-boot-loader- dependency" ,
2+ "name" : " micro/kernel-boot-dependency" ,
33 "description" : " Micro Framework: Kernel Boot loader - component to provide dependencies" ,
44 "type" : " library" ,
55 "version" : " 1.0" ,
66 "require" : {
77 "micro/kernel" : " ^1" ,
88 "micro/autowire" : " ^1"
99 },
10+ "require-dev" : {
11+ "phpunit/phpunit" : " ^9"
12+ },
1013 "license" : " MIT" ,
1114 "autoload" : {
1215 "psr-4" : {
13- "Micro\\ Kernel\\ " : " src/"
16+ "Micro\\ Framework \\ Kernel\\ " : " src/"
1417 }
1518 },
1619 "authors" : [
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9.3/phpunit.xsd"
4+ bootstrap =" vendor/autoload.php"
5+ backupGlobals =" false"
6+ backupStaticAttributes =" false"
7+ colors =" true"
8+ convertErrorsToExceptions =" true"
9+ convertNoticesToExceptions =" true"
10+ convertWarningsToExceptions =" true"
11+ processIsolation =" false"
12+ stopOnFailure =" false" >
13+ <coverage >
14+ <include >
15+ <directory suffix =" .php" >src/</directory >
16+ </include >
17+ </coverage >
18+ <testsuites >
19+ <testsuite name =" Micro Framework: [TEST SUITE] Kernel Boot loader - component to provide dependencies" >
20+ <directory >tests/unit</directory >
21+ </testsuite >
22+ </testsuites >
23+ <php >
24+ <env name =" APP_ENV" value =" testing" />
25+ </php >
26+ </phpunit >
Original file line number Diff line number Diff line change @@ -28,13 +28,15 @@ public function __construct(Container $container)
2828 }
2929
3030 /**
31+ *
32+ * @TODO: uncomment at 2.0 version
3133 * {@inheritDoc}
3234 */
3335 public function boot (ApplicationPluginInterface $ applicationPlugin ): void
3436 {
35- if (!($ applicationPlugin instanceof DependencyProviderInterface)) {
36- return ;
37- }
37+ // if(!($applicationPlugin instanceof DependencyProviderInterface)) {
38+ // return;
39+ // }
3840
3941 $ applicationPlugin ->provideDependencies ($ this ->container );
4042 }
Original file line number Diff line number Diff line change 44
55use Micro \Component \DependencyInjection \Container ;
66
7- interface DependencyProviderInterface
7+ interface DependencyProviderInterface extends ApplicationPluginInterface
88{
99 /**
1010 * @param Container $container
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Micro \Framework \Kernel \Plugin \Boot \Test ;
4+
5+ use Micro \Component \DependencyInjection \Container ;
6+ use Micro \Framework \Kernel \Plugin \ApplicationPluginInterface ;
7+ use Micro \Framework \Kernel \Plugin \Boot \DependencyProviderBootLoader ;
8+ use Micro \Framework \Kernel \Plugin \DependencyProviderInterface ;
9+ use PHPUnit \Framework \TestCase ;
10+
11+ class DependencyProviderBootLoaderTest extends TestCase
12+ {
13+ /**
14+ * @test
15+ *
16+ * @return void
17+ */
18+ public function testBoot ()
19+ {
20+ $ dataProviderBootLoader = new DependencyProviderBootLoader (
21+ new Container ()
22+ );
23+
24+ $ pluginMock = $ this ->createMock (DependencyProviderInterface::class);
25+ $ pluginMock
26+ ->expects ($ this ->once ())
27+ ->method ('provideDependencies ' )
28+ ;
29+
30+ $ pluginMock
31+ ->expects ($ this ->any ())
32+ ->method ('name ' )
33+ ->willReturn ('test ' );
34+
35+ $ pluginNotDependencyProvider = new class implements ApplicationPluginInterface
36+ {
37+ public function provideDependencies (Container $ container ): void
38+ {
39+ throw new \Exception ('Not Allowed here ! ' );
40+ }
41+
42+ public function name (): string
43+ {
44+ return 'test-plugin ' ;
45+ }
46+ };
47+
48+ foreach ([ $ pluginMock , $ pluginNotDependencyProvider ] as $ plugin ) {
49+ $ dataProviderBootLoader ->boot ($ plugin );
50+ }
51+ }
52+ }
You can’t perform that action at this time.
0 commit comments