summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-03-09 23:33:25 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-03-09 23:33:25 +0100
commitc8ed88f4d66167dda13da279239791327cee9310 (patch)
tree963569217f78f1002094fba64e86c6897b3ca9cc /tests
parent2f6188495651cc78e7161e3af8b8b1f3a38f058a (diff)
parent716ba49a82ab7c0a68f3b4f442ea8ed84c06f317 (diff)
downloadnextcloud-server-c8ed88f4d66167dda13da279239791327cee9310.tar.gz
nextcloud-server-c8ed88f4d66167dda13da279239791327cee9310.zip
Merge pull request #14689 from owncloud/better-missing-resource-handling
Log errors and create 404 in network list when a css or js is missing
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/template/resourcelocator.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/tests/lib/template/resourcelocator.php b/tests/lib/template/resourcelocator.php
index f350fd144e1..b0851621fd2 100644
--- a/tests/lib/template/resourcelocator.php
+++ b/tests/lib/template/resourcelocator.php
@@ -7,13 +7,20 @@
*/
class Test_ResourceLocator extends \Test\TestCase {
+ /** @var PHPUnit_Framework_MockObject_MockObject */
+ protected $logger;
+
+ protected function setUp() {
+ parent::setUp();
+ $this->logger = $this->getMock('OCP\ILogger');
+ }
/**
* @param string $theme
*/
public function getResourceLocator( $theme, $core_map, $party_map, $appsroots ) {
return $this->getMockForAbstractClass('OC\Template\ResourceLocator',
- array( $theme, $core_map, $party_map, $appsroots ),
+ array($this->logger, $theme, $core_map, $party_map, $appsroots ),
'', true, true, true, array());
}
@@ -30,7 +37,7 @@ class Test_ResourceLocator extends \Test\TestCase {
public function testFind() {
$locator = $this->getResourceLocator('theme',
- array('core'=>'map'), array('3rd'=>'party'), array('foo'=>'bar'));
+ array('core' => 'map'), array('3rd' => 'party'), array('foo' => 'bar'));
$locator->expects($this->once())
->method('doFind')
->with('foo');
@@ -38,18 +45,22 @@ class Test_ResourceLocator extends \Test\TestCase {
->method('doFindTheme')
->with('foo');
$locator->find(array('foo'));
+ }
+ public function testFindNotFound() {
$locator = $this->getResourceLocator('theme',
array('core'=>'map'), array('3rd'=>'party'), array('foo'=>'bar'));
$locator->expects($this->once())
->method('doFind')
->with('foo')
- ->will($this->throwException(new Exception('test')));
- try {
- $locator->find(array('foo'));
- } catch (\Exception $e) {
- $this->assertEquals('test serverroot:core', $e->getMessage());
- }
+ ->will($this->throwException(new \OC\Template\ResourceNotFoundException('foo', 'map')));
+ $locator->expects($this->once())
+ ->method('doFindTheme')
+ ->with('foo')
+ ->will($this->throwException(new \OC\Template\ResourceNotFoundException('foo', 'map')));
+ $this->logger->expects($this->exactly(2))
+ ->method('error');
+ $locator->find(array('foo'));
}
public function testAppendIfExist() {