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 6
6
7
7
use PhpSchool \PhpWorkshop \Application ;
8
8
use PHPUnit \Framework \TestCase ;
9
+ use PhpSchool \PhpWorkshop \Exception \InvalidArgumentException ;
9
10
10
11
class ApplicationTest extends TestCase
11
12
{
@@ -58,4 +59,30 @@ public function testEventListenersFromLocalAndWorkshopConfigAreMerged(): void
58
59
$ eventListeners
59
60
);
60
61
}
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
+ }
61
88
}
You can’t perform that action at this time.
0 commit comments