Skip to content
Permalink
Browse files

Fix bad test for `CoreController::getAsset`

  • Loading branch information...
Silic0nS0ldier committed Apr 7, 2019
1 parent e82129f commit 36ed889c7ef197cf060f5a2d4f69e523aada94e8
@@ -15,7 +15,8 @@
},
{
"name": "Jordan Mele",
"email": "SiliconSoldier@outlook.com.au"
"email": "SiliconSoldier@outlook.com.au",
"homepage": "https://blog.djmm.me"
},
{
"name": "Mike Jacobs"
@@ -45,7 +46,7 @@
"slim/twig-view": "^1.2",
"symfony/http-foundation": "*",
"twig/twig": "^1.18",
"userfrosting/assets": "^5.0.0",
"userfrosting/assets": "^5.0.4",
"userfrosting/config": "~4.2.0",
"userfrosting/cache": "~4.2.0",
"userfrosting/fortress": "~4.2.0",
@@ -10,6 +10,7 @@
namespace UserFrosting\Sprinkle\Core\Tests;
use UserFrosting\Sprinkle\Core\Controller\CoreController;
use UserFrosting\Support\Exception\NotFoundException;
/**
* Tests CoreController
@@ -51,25 +52,35 @@ public function testJsonAlerts(CoreController $controller)
/**
* @depends testControllerConstructor
* @expectedException \UserFrosting\Support\Exception\NotFoundException
* @param CoreController $controller
*/
public function testGetAsset_ExceptionNoUrl(CoreController $controller)
{
$this->expectException(NotFoundException::class);
$controller->getAsset($this->getRequest(), $this->getResponse(), []);
}
/**
* @depends testControllerConstructor
* @expectedException \UserFrosting\Support\Exception\NotFoundException
* @param CoreController $controller
*/
public function testGetAsset_ExceptionBadUrl(CoreController $controller)
{
$this->expectException(NotFoundException::class);
$url = '/' . rand(0, 99999);
$controller->getAsset($this->getRequest(), $this->getResponse(), ['url' => $url]);
}
/**
* @depends testControllerConstructor
* @param CoreController $controller
*/
public function testGetAsset_ExceptionEmptyUrl(CoreController $controller)
{
$this->expectException(NotFoundException::class);
$controller->getAsset($this->getRequest(), $this->getResponse(), ['url' => '']);
}
/**
* @depends testControllerConstructor
* @depends testGetAsset_ExceptionNoUrl
@@ -78,10 +89,6 @@ public function testGetAsset_ExceptionBadUrl(CoreController $controller)
*/
public function testGetAsset(CoreController $controller)
{
$result = $controller->getAsset($this->getRequest(), $this->getResponse(), ['url' => '']);
$this->assertSame($result->getStatusCode(), 200);
$this->assertSame('', (string) $result->getBody());
$result = $controller->getAsset($this->getRequest(), $this->getResponse(), ['url' => 'userfrosting/js/uf-alerts.js']);
$this->assertSame($result->getStatusCode(), 200);
$this->assertNotEmpty((string) $result->getBody());

0 comments on commit 36ed889

Please sign in to comment.
You can’t perform that action at this time.