diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 09:30:18 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 16:34:56 +0100 |
commit | b80ebc96748b45fd2e0ba9323308657c4b00b7ec (patch) | |
tree | ec20e0ffa2f86b9b54939a83a785407319f94559 /tests/lib/Template | |
parent | 62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff) | |
download | nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.tar.gz nextcloud-server-b80ebc96748b45fd2e0ba9323308657c4b00b7ec.zip |
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Template')
-rw-r--r-- | tests/lib/Template/CSSResourceLocatorTest.php | 12 | ||||
-rw-r--r-- | tests/lib/Template/IconsCacherTest.php | 4 | ||||
-rw-r--r-- | tests/lib/Template/JSResourceLocatorTest.php | 12 | ||||
-rw-r--r-- | tests/lib/Template/ResourceLocatorTest.php | 30 | ||||
-rw-r--r-- | tests/lib/Template/SCSSCacherTest.php | 2 |
5 files changed, 30 insertions, 30 deletions
diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php index 7c9f3585038..7aa1eb177d7 100644 --- a/tests/lib/Template/CSSResourceLocatorTest.php +++ b/tests/lib/Template/CSSResourceLocatorTest.php @@ -85,14 +85,14 @@ class CSSResourceLocatorTest extends \Test\TestCase { return new CSSResourceLocator( $this->logger, 'theme', - array('core'=>'map'), - array('3rd'=>'party'), + ['core'=>'map'], + ['3rd'=>'party'], $scssCacher ); } private function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { $this->rrmdir($directory . '/' . $file); @@ -111,10 +111,10 @@ class CSSResourceLocatorTest extends \Test\TestCase { $locator = $this->cssResourceLocator(); $this->assertAttributeEquals('theme', 'theme', $locator); $this->assertAttributeEquals('core', 'serverroot', $locator); - $this->assertAttributeEquals(array('core'=>'map','3rd'=>'party'), 'mapping', $locator); + $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator); $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator); $this->assertAttributeEquals('map', 'webroot', $locator); - $this->assertAttributeEquals(array(), 'resources', $locator); + $this->assertAttributeEquals([], 'resources', $locator); } public function testFindWithAppPathSymlink() { @@ -136,7 +136,7 @@ class CSSResourceLocatorTest extends \Test\TestCase { ]; $locator = $this->cssResourceLocator(); - $locator->find(array('test-css-app/test-file')); + $locator->find(['test-css-app/test-file']); $resources = $locator->getResources(); $this->assertCount(1, $resources); diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php index 8e36426393f..f7d7f7b57e5 100644 --- a/tests/lib/Template/IconsCacherTest.php +++ b/tests/lib/Template/IconsCacherTest.php @@ -90,9 +90,9 @@ class IconsCacherTest extends \Test\TestCase { } "; $actual = self::invokePrivate($this->iconsCacher, 'getIconsFromCss', [$css]); - $expected = array( + $expected = [ 'icon-test' => '/svg/core/actions/add/000?v=1' - ); + ]; $this->assertEquals($expected, $actual); } diff --git a/tests/lib/Template/JSResourceLocatorTest.php b/tests/lib/Template/JSResourceLocatorTest.php index 38c5fc0eadd..8c8fc99c961 100644 --- a/tests/lib/Template/JSResourceLocatorTest.php +++ b/tests/lib/Template/JSResourceLocatorTest.php @@ -64,14 +64,14 @@ class JSResourceLocatorTest extends \Test\TestCase { return new JSResourceLocator( $this->logger, 'theme', - array('core'=>'map'), - array('3rd'=>'party'), + ['core'=>'map'], + ['3rd'=>'party'], $jsCombiner ); } private function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { $this->rrmdir($directory . '/' . $file); @@ -91,10 +91,10 @@ class JSResourceLocatorTest extends \Test\TestCase { $locator = $this->jsResourceLocator(); $this->assertAttributeEquals('theme', 'theme', $locator); $this->assertAttributeEquals('core', 'serverroot', $locator); - $this->assertAttributeEquals(array('core'=>'map','3rd'=>'party'), 'mapping', $locator); + $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator); $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator); $this->assertAttributeEquals('map', 'webroot', $locator); - $this->assertAttributeEquals(array(), 'resources', $locator); + $this->assertAttributeEquals([], 'resources', $locator); } public function testFindWithAppPathSymlink() { @@ -116,7 +116,7 @@ class JSResourceLocatorTest extends \Test\TestCase { ]; $locator = $this->jsResourceLocator(); - $locator->find(array('test-js-app/test-file')); + $locator->find(['test-js-app/test-file']); $resources = $locator->getResources(); $this->assertCount(1, $resources); diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php index 90488071b4f..f0fa8186686 100644 --- a/tests/lib/Template/ResourceLocatorTest.php +++ b/tests/lib/Template/ResourceLocatorTest.php @@ -29,24 +29,24 @@ class ResourceLocatorTest extends \Test\TestCase { */ public function getResourceLocator($theme, $core_map, $party_map, $appsRoots) { return $this->getMockForAbstractClass('OC\Template\ResourceLocator', - array($this->logger, $theme, $core_map, $party_map, $appsRoots ), - '', true, true, true, array()); + [$this->logger, $theme, $core_map, $party_map, $appsRoots ], + '', true, true, true, []); } public function testConstructor() { $locator = $this->getResourceLocator('theme', - array('core'=>'map'), array('3rd'=>'party'), array('foo'=>'bar')); + ['core'=>'map'], ['3rd'=>'party'], ['foo'=>'bar']); $this->assertAttributeEquals('theme', 'theme', $locator); $this->assertAttributeEquals('core', 'serverroot', $locator); - $this->assertAttributeEquals(array('core'=>'map','3rd'=>'party'), 'mapping', $locator); + $this->assertAttributeEquals(['core'=>'map','3rd'=>'party'], 'mapping', $locator); $this->assertAttributeEquals('3rd', 'thirdpartyroot', $locator); $this->assertAttributeEquals('map', 'webroot', $locator); - $this->assertAttributeEquals(array(), 'resources', $locator); + $this->assertAttributeEquals([], 'resources', $locator); } public function testFind() { $locator = $this->getResourceLocator('theme', - array('core' => 'map'), array('3rd' => 'party'), array('foo' => 'bar')); + ['core' => 'map'], ['3rd' => 'party'], ['foo' => 'bar']); $locator->expects($this->once()) ->method('doFind') ->with('foo'); @@ -54,12 +54,12 @@ class ResourceLocatorTest extends \Test\TestCase { ->method('doFindTheme') ->with('foo'); /** @var \OC\Template\ResourceLocator $locator */ - $locator->find(array('foo')); + $locator->find(['foo']); } public function testFindNotFound() { $locator = $this->getResourceLocator('theme', - array('core'=>'map'), array('3rd'=>'party'), array('foo'=>'bar')); + ['core'=>'map'], ['3rd'=>'party'], ['foo'=>'bar']); $locator->expects($this->once()) ->method('doFind') ->with('foo') @@ -72,25 +72,25 @@ class ResourceLocatorTest extends \Test\TestCase { ->method('debug') ->with($this->stringContains('map/foo')); /** @var \OC\Template\ResourceLocator $locator */ - $locator->find(array('foo')); + $locator->find(['foo']); } public function testAppendIfExist() { $locator = $this->getResourceLocator('theme', - array(__DIR__=>'map'), array('3rd'=>'party'), array('foo'=>'bar')); + [__DIR__=>'map'], ['3rd'=>'party'], ['foo'=>'bar']); /** @var \OC\Template\ResourceLocator $locator */ $method = new \ReflectionMethod($locator, 'appendIfExist'); $method->setAccessible(true); $method->invoke($locator, __DIR__, basename(__FILE__), 'webroot'); - $resource1 = array(__DIR__, 'webroot', basename(__FILE__)); - $this->assertEquals(array($resource1), $locator->getResources()); + $resource1 = [__DIR__, 'webroot', basename(__FILE__)]; + $this->assertEquals([$resource1], $locator->getResources()); $method->invoke($locator, __DIR__, basename(__FILE__)); - $resource2 = array(__DIR__, 'map', basename(__FILE__)); - $this->assertEquals(array($resource1, $resource2), $locator->getResources()); + $resource2 = [__DIR__, 'map', basename(__FILE__)]; + $this->assertEquals([$resource1, $resource2], $locator->getResources()); $method->invoke($locator, __DIR__, 'does-not-exist'); - $this->assertEquals(array($resource1, $resource2), $locator->getResources()); + $this->assertEquals([$resource1, $resource2], $locator->getResources()); } } diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 9e8c30961fb..446821e62f8 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -471,7 +471,7 @@ class SCSSCacherTest extends \Test\TestCase { } private function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { $this->rrmdir($directory . '/' . $file); |