diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-12-07 23:16:06 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-12-07 23:55:32 +0100 |
commit | 4bcaeb6c2cd0e9c5bb87995aac8df849bedd0b70 (patch) | |
tree | cc0d3bac06512581e98940f40ecdb7a802b7cd41 /tests | |
parent | f0a0bfaaeef447157801f116e90435114b271572 (diff) | |
download | nextcloud-server-4bcaeb6c2cd0e9c5bb87995aac8df849bedd0b70.tar.gz nextcloud-server-4bcaeb6c2cd0e9c5bb87995aac8df849bedd0b70.zip |
Drop 3rdparty root since it is unused and adjust tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Template/JSResourceLocatorTest.php | 3 | ||||
-rw-r--r-- | tests/lib/Template/ResourceLocatorTest.php | 32 |
2 files changed, 18 insertions, 17 deletions
diff --git a/tests/lib/Template/JSResourceLocatorTest.php b/tests/lib/Template/JSResourceLocatorTest.php index 7dedd4ad3c7..20fd79a91b5 100644 --- a/tests/lib/Template/JSResourceLocatorTest.php +++ b/tests/lib/Template/JSResourceLocatorTest.php @@ -63,9 +63,6 @@ class JSResourceLocatorTest extends \Test\TestCase { ); return new JSResourceLocator( $this->logger, - 'theme', - ['core' => 'map'], - ['3rd' => 'party'], $jsCombiner ); } diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php index 0cb28843a53..fa329ca6581 100644 --- a/tests/lib/Template/ResourceLocatorTest.php +++ b/tests/lib/Template/ResourceLocatorTest.php @@ -8,6 +8,7 @@ namespace Test\Template; +use OC\SystemConfig; use OC\Template\ResourceNotFoundException; use Psr\Log\LoggerInterface; @@ -22,20 +23,23 @@ class ResourceLocatorTest extends \Test\TestCase { /** * @param string $theme - * @param array $core_map - * @param array $party_map - * @param array $appsRoots * @return \PHPUnit\Framework\MockObject\MockObject */ - public function getResourceLocator($theme, $core_map, $party_map, $appsRoots) { + public function getResourceLocator($theme) { + $systemConfig = $this->createMock(SystemConfig::class); + $systemConfig + ->expects($this->any()) + ->method('getValue') + ->with('theme', '') + ->willReturn($theme); + $this->overwriteService(SystemConfig::class, $systemConfig); return $this->getMockForAbstractClass('OC\Template\ResourceLocator', - [$this->logger, $theme, $core_map, $party_map, $appsRoots ], + [$this->logger], '', true, true, true, []); } public function testFind() { - $locator = $this->getResourceLocator('theme', - ['core' => 'map'], ['3rd' => 'party'], ['foo' => 'bar']); + $locator = $this->getResourceLocator('theme'); $locator->expects($this->once()) ->method('doFind') ->with('foo'); @@ -47,6 +51,11 @@ class ResourceLocatorTest extends \Test\TestCase { } public function testFindNotFound() { + $systemConfig = $this->createMock(SystemConfig::class); + $systemConfig->method('getValue') + ->with('theme', '') + ->willReturn('theme'); + $this->overwriteService(SystemConfig::class, $systemConfig); $locator = $this->getResourceLocator('theme', ['core' => 'map'], ['3rd' => 'party'], ['foo' => 'bar']); $locator->expects($this->once()) @@ -65,8 +74,7 @@ class ResourceLocatorTest extends \Test\TestCase { } public function testAppendIfExist() { - $locator = $this->getResourceLocator('theme', - [__DIR__ => 'map'], ['3rd' => 'party'], ['foo' => 'bar']); + $locator = $this->getResourceLocator('theme'); /** @var \OC\Template\ResourceLocator $locator */ $method = new \ReflectionMethod($locator, 'appendIfExist'); $method->setAccessible(true); @@ -75,11 +83,7 @@ class ResourceLocatorTest extends \Test\TestCase { $resource1 = [__DIR__, 'webroot', basename(__FILE__)]; $this->assertEquals([$resource1], $locator->getResources()); - $method->invoke($locator, __DIR__, basename(__FILE__)); - $resource2 = [__DIR__, 'map', basename(__FILE__)]; - $this->assertEquals([$resource1, $resource2], $locator->getResources()); - $method->invoke($locator, __DIR__, 'does-not-exist'); - $this->assertEquals([$resource1, $resource2], $locator->getResources()); + $this->assertEquals([$resource1], $locator->getResources()); } } |