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 1
1
{
2
- "name" : " micro/kernel-boot-loader- dependency" ,
2
+ "name" : " micro/kernel-boot-dependency" ,
3
3
"description" : " Micro Framework: Kernel Boot loader - component to provide dependencies" ,
4
4
"type" : " library" ,
5
5
"version" : " 1.0" ,
6
6
"require" : {
7
7
"micro/kernel" : " ^1" ,
8
8
"micro/autowire" : " ^1"
9
9
},
10
+ "require-dev" : {
11
+ "phpunit/phpunit" : " ^9"
12
+ },
10
13
"license" : " MIT" ,
11
14
"autoload" : {
12
15
"psr-4" : {
13
- "Micro\\ Kernel\\ " : " src/"
16
+ "Micro\\ Framework \\ Kernel\\ " : " src/"
14
17
}
15
18
},
16
19
"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)
28
28
}
29
29
30
30
/**
31
+ *
32
+ * @TODO: uncomment at 2.0 version
31
33
* {@inheritDoc}
32
34
*/
33
35
public function boot (ApplicationPluginInterface $ applicationPlugin ): void
34
36
{
35
- if (!($ applicationPlugin instanceof DependencyProviderInterface)) {
36
- return ;
37
- }
37
+ // if(!($applicationPlugin instanceof DependencyProviderInterface)) {
38
+ // return;
39
+ // }
38
40
39
41
$ applicationPlugin ->provideDependencies ($ this ->container );
40
42
}
Original file line number Diff line number Diff line change 4
4
5
5
use Micro \Component \DependencyInjection \Container ;
6
6
7
- interface DependencyProviderInterface
7
+ interface DependencyProviderInterface extends ApplicationPluginInterface
8
8
{
9
9
/**
10
10
* @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