Skip to content

Commit 36ed889

Browse files
Fix bad test for CoreController::getAsset
1 parent e82129f commit 36ed889

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

app/sprinkles/core/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
},
1616
{
1717
"name": "Jordan Mele",
18-
"email": "SiliconSoldier@outlook.com.au"
18+
"email": "SiliconSoldier@outlook.com.au",
19+
"homepage": "https://blog.djmm.me"
1920
},
2021
{
2122
"name": "Mike Jacobs"
@@ -45,7 +46,7 @@
4546
"slim/twig-view": "^1.2",
4647
"symfony/http-foundation": "*",
4748
"twig/twig": "^1.18",
48-
"userfrosting/assets": "^5.0.0",
49+
"userfrosting/assets": "^5.0.4",
4950
"userfrosting/config": "~4.2.0",
5051
"userfrosting/cache": "~4.2.0",
5152
"userfrosting/fortress": "~4.2.0",

app/sprinkles/core/tests/Integration/Controllers/CoreControllerTest.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace UserFrosting\Sprinkle\Core\Tests;
1111

1212
use 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

Comments
 (0)