1010namespace UserFrosting \Sprinkle \Core \Tests ;
1111
1212use UserFrosting \Sprinkle \Core \Controller \CoreController ;
13+ use UserFrosting \Support \Exception \NotFoundException ;
1314
1415/**
1516 * Tests CoreController
@@ -51,25 +52,35 @@ public function testJsonAlerts(CoreController $controller)
5152
5253 /**
5354 * @depends testControllerConstructor
54- * @expectedException \UserFrosting\Support\Exception\NotFoundException
5555 * @param CoreController $controller
5656 */
5757 public function testGetAsset_ExceptionNoUrl (CoreController $ controller )
5858 {
59+ $ this ->expectException (NotFoundException::class);
5960 $ controller ->getAsset ($ this ->getRequest (), $ this ->getResponse (), []);
6061 }
6162
6263 /**
6364 * @depends testControllerConstructor
64- * @expectedException \UserFrosting\Support\Exception\NotFoundException
6565 * @param CoreController $controller
6666 */
6767 public function testGetAsset_ExceptionBadUrl (CoreController $ controller )
6868 {
69+ $ this ->expectException (NotFoundException::class);
6970 $ url = '/ ' . rand (0 , 99999 );
7071 $ controller ->getAsset ($ this ->getRequest (), $ this ->getResponse (), ['url ' => $ url ]);
7172 }
7273
74+ /**
75+ * @depends testControllerConstructor
76+ * @param CoreController $controller
77+ */
78+ public function testGetAsset_ExceptionEmptyUrl (CoreController $ controller )
79+ {
80+ $ this ->expectException (NotFoundException::class);
81+ $ controller ->getAsset ($ this ->getRequest (), $ this ->getResponse (), ['url ' => '' ]);
82+ }
83+
7384 /**
7485 * @depends testControllerConstructor
7586 * @depends testGetAsset_ExceptionNoUrl
@@ -78,10 +89,6 @@ public function testGetAsset_ExceptionBadUrl(CoreController $controller)
7889 */
7990 public function testGetAsset (CoreController $ controller )
8091 {
81- $ result = $ controller ->getAsset ($ this ->getRequest (), $ this ->getResponse (), ['url ' => '' ]);
82- $ this ->assertSame ($ result ->getStatusCode (), 200 );
83- $ this ->assertSame ('' , (string ) $ result ->getBody ());
84-
8592 $ result = $ controller ->getAsset ($ this ->getRequest (), $ this ->getResponse (), ['url ' => 'userfrosting/js/uf-alerts.js ' ]);
8693 $ this ->assertSame ($ result ->getStatusCode (), 200 );
8794 $ this ->assertNotEmpty ((string ) $ result ->getBody ());
0 commit comments