File tree 2 files changed +62
-0
lines changed 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Tests \Domain ;
6
+
7
+ use NunoMaduro \PhpInsights \Domain \Collector ;
8
+ use NunoMaduro \PhpInsights \Domain \ComposerFinder ;
9
+ use NunoMaduro \PhpInsights \Domain \Exceptions \ComposerNotFound ;
10
+ use PHPUnit \Framework \TestCase ;
11
+
12
+ final class ComposerFinderTest extends TestCase
13
+ {
14
+ public function testGetComposerPath (): void
15
+ {
16
+ $ collector = new Collector (__DIR__ . '/Insights/Composer/Fixtures/Valid ' );
17
+ $ path = ComposerFinder::getPath ($ collector );
18
+
19
+ self ::assertEquals (
20
+ __DIR__ . '/Insights/Composer/Fixtures/Valid/composer.json ' ,
21
+ $ path
22
+ );
23
+ }
24
+
25
+ public function testGetComposerPathThrowExceptionIfNoComposerJsonExist (): void
26
+ {
27
+ self ::expectException (ComposerNotFound::class);
28
+
29
+ $ collector = new Collector (__DIR__ . '/Insights/Composer/Fixtures ' );
30
+ ComposerFinder::getPath ($ collector );
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Tests \Domain ;
6
+
7
+ use Composer \Composer ;
8
+ use NunoMaduro \PhpInsights \Domain \Collector ;
9
+ use NunoMaduro \PhpInsights \Domain \ComposerLoader ;
10
+ use NunoMaduro \PhpInsights \Domain \Exceptions \ComposerNotFound ;
11
+ use PHPUnit \Framework \TestCase ;
12
+
13
+ final class ComposerLoaderTest extends TestCase
14
+ {
15
+ public function testGetInstance (): void
16
+ {
17
+ $ collector = new Collector (__DIR__ . '/Insights/Composer/Fixtures/Valid ' );
18
+ $ composer = ComposerLoader::getInstance ($ collector );
19
+
20
+ self ::assertEquals (Composer::class, get_class ($ composer ));
21
+ }
22
+
23
+ public function testGetExceptionOnFolderWithoutComposerJson (): void
24
+ {
25
+ self ::expectException (ComposerNotFound::class);
26
+
27
+ $ collector = new Collector (__DIR__ . '/Insights/Composer/Fixtures ' );
28
+ ComposerLoader::getInstance ($ collector );
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments