File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ coverage :
2+ status :
3+ patch :
4+ default :
5+ target : 70%
Original file line number Diff line number Diff line change 66
77use PhpSchool \PhpWorkshop \Application ;
88use PHPUnit \Framework \TestCase ;
9+ use PhpSchool \PhpWorkshop \Exception \InvalidArgumentException ;
910
1011class ApplicationTest extends TestCase
1112{
@@ -58,4 +59,30 @@ public function testEventListenersFromLocalAndWorkshopConfigAreMerged(): void
5859 $ eventListeners
5960 );
6061 }
62+
63+ public function testExceptionIsThrownIfConfigFileDoesNotExist (): void
64+ {
65+ $ this ->expectException (InvalidArgumentException::class);
66+ $ this ->expectExceptionMessage ('File "not-existing-file.php" was expected to exist. ' );
67+
68+ new Application ('My workshop ' , 'not-existing-file.php ' );
69+ }
70+
71+ public function testExceptionIsThrownIfResultClassDoesNotExist (): void
72+ {
73+ $ this ->expectException (InvalidArgumentException::class);
74+ $ this ->expectExceptionMessage ('Class "NotExistingClass" does not exist ' );
75+
76+ $ app = new Application ('My workshop ' , __DIR__ . '/../app/config.php ' );
77+ $ app ->addResult (\NotExistingClass::class, \NotExistingClass::class);
78+ }
79+
80+ public function testExceptionIsThrownIfResultRendererClassDoesNotExist (): void
81+ {
82+ $ this ->expectException (InvalidArgumentException::class);
83+ $ this ->expectExceptionMessage ('Class "NotExistingClass" does not exist ' );
84+
85+ $ app = new Application ('My workshop ' , __DIR__ . '/../app/config.php ' );
86+ $ app ->addResult (\PhpSchool \PhpWorkshop \Result \Success::class, \NotExistingClass::class);
87+ }
6188}
You can’t perform that action at this time.
0 commit comments