diff options
Diffstat (limited to 'tests/lib')
183 files changed, 3345 insertions, 3366 deletions
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php index bf6902fde65..ebb03425375 100644 --- a/tests/lib/APITest.php +++ b/tests/lib/APITest.php @@ -79,7 +79,7 @@ class APITest extends \Test\TestCase { $request ->expects($this->once()) ->method('getScriptName') - ->will($this->returnValue($scriptName)); + ->willReturn($scriptName); $this->assertEquals($expected, $this->invokePrivate(new \OC_API, 'isV2', [$request])); } diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php index 80ddcbbd354..9e30977e29b 100644 --- a/tests/lib/AllConfigTest.php +++ b/tests/lib/AllConfigTest.php @@ -44,14 +44,14 @@ class AllConfigTest extends \Test\TestCase { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . '`configkey`, `configvalue`) VALUES (?, ?, ?, ?)', - array('userDelete', 'appDelete', 'keyDelete', 'valueDelete') + ['userDelete', 'appDelete', 'keyDelete', 'valueDelete'] ); $config->deleteUserValue('userDelete', 'appDelete', 'keyDelete'); $result = $this->connection->executeQuery( 'SELECT COUNT(*) AS `count` FROM `*PREFIX*preferences` WHERE `userid` = ?', - array('userDelete') + ['userDelete'] )->fetch(); $actualCount = $result['count']; @@ -64,28 +64,28 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userSet', 'appSet', 'keySet', 'valueSet'); - $result = $this->connection->executeQuery($selectAllSQL, array('userSet'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userSet', 'appid' => 'appSet', 'configkey' => 'keySet', 'configvalue' => 'valueSet' - ), $result[0]); + ], $result[0]); // test if the method overwrites existing database entries $config->setUserValue('userSet', 'appSet', 'keySet', 'valueSet2'); - $result = $this->connection->executeQuery($selectAllSQL, array('userSet'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userSet'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userSet', 'appid' => 'appSet', 'configkey' => 'keySet', 'configvalue' => 'valueSet2' - ), $result[0]); + ], $result[0]); // cleanup - it therefore relies on the successful execution of the previous test $config->deleteUserValue('userSet', 'appSet', 'keySet'); @@ -98,28 +98,28 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userPreCond', 'appPreCond', 'keyPreCond', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond' - ), $result[0]); + ], $result[0]); // test if the method overwrites existing database entries with valid precond $config->setUserValue('userPreCond', 'appPreCond', 'keyPreCond', 'valuePreCond2', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond2' - ), $result[0]); + ], $result[0]); // cleanup $config->deleteUserValue('userPreCond', 'appPreCond', 'keyPreCond'); @@ -155,28 +155,28 @@ class AllConfigTest extends \Test\TestCase { $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond1'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond1', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond' - ), $result[0]); + ], $result[0]); // test if the method overwrites existing database entries with valid precond $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond2', 'valuePreCond3'); - $result = $this->connection->executeQuery($selectAllSQL, array('userPreCond1'))->fetchAll(); + $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userPreCond1', 'appid' => 'appPreCond', 'configkey' => 'keyPreCond', 'configvalue' => 'valuePreCond' - ), $result[0]); + ], $result[0]); // cleanup $config->deleteUserValue('userPreCond1', 'appPreCond', 'keyPreCond'); @@ -190,15 +190,15 @@ class AllConfigTest extends \Test\TestCase { ->disableOriginalConstructor()->getMock(); $resultMock->expects($this->once()) ->method('fetchColumn') - ->will($this->returnValue('valueSetUnchanged')); + ->willReturn('valueSetUnchanged'); $connectionMock = $this->createMock(IDBConnection::class); $connectionMock->expects($this->once()) ->method('executeQuery') ->with($this->equalTo('SELECT `configvalue` FROM `*PREFIX*preferences` '. 'WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'), - $this->equalTo(array('userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged'))) - ->will($this->returnValue($resultMock)); + $this->equalTo(['userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged'])) + ->willReturn($resultMock); $connectionMock->expects($this->never()) ->method('executeUpdate'); @@ -218,19 +218,19 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?', - array('userGet') + ['userGet'] )->fetchAll(); $this->assertEquals(1, count($result)); - $this->assertEquals(array( + $this->assertEquals([ 'userid' => 'userGet', 'appid' => 'appGet', 'configkey' => 'keyGet', 'configvalue' => 'valueGet' - ), $result[0]); + ], $result[0]); // drop data from database - but the config option should be cached in the config object - $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?', array('userGet')); + $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?', ['userGet']); // testing the caching mechanism $value = $config->getUserValue('userGet', 'appGet', 'keyGet'); @@ -239,7 +239,7 @@ class AllConfigTest extends \Test\TestCase { $result = $this->connection->executeQuery( 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?', - array('userGet') + ['userGet'] )->fetchAll(); $this->assertEquals(0, count($result)); @@ -249,15 +249,15 @@ class AllConfigTest extends \Test\TestCase { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch', 'appFetch1', 'keyFetch1', 'value1'), - array('userFetch', 'appFetch1', 'keyFetch2', 'value2'), - array('userFetch', 'appFetch2', 'keyFetch3', 'value3'), - array('userFetch', 'appFetch1', 'keyFetch4', 'value4'), - array('userFetch', 'appFetch4', 'keyFetch1', 'value5'), - array('userFetch', 'appFetch5', 'keyFetch1', 'value6'), - array('userFetch2', 'appFetch', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch', 'appFetch1', 'keyFetch1', 'value1'], + ['userFetch', 'appFetch1', 'keyFetch2', 'value2'], + ['userFetch', 'appFetch2', 'keyFetch3', 'value3'], + ['userFetch', 'appFetch1', 'keyFetch4', 'value4'], + ['userFetch', 'appFetch4', 'keyFetch1', 'value5'], + ['userFetch', 'appFetch5', 'keyFetch1', 'value6'], + ['userFetch2', 'appFetch', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -267,10 +267,10 @@ class AllConfigTest extends \Test\TestCase { } $value = $config->getUserKeys('userFetch', 'appFetch1'); - $this->assertEquals(array('keyFetch1', 'keyFetch2', 'keyFetch4'), $value); + $this->assertEquals(['keyFetch1', 'keyFetch2', 'keyFetch4'], $value); $value = $config->getUserKeys('userFetch2', 'appFetch'); - $this->assertEquals(array('keyFetch1'), $value); + $this->assertEquals(['keyFetch1'], $value); // cleanup $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); @@ -288,15 +288,15 @@ class AllConfigTest extends \Test\TestCase { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch1', 'appFetch2', 'keyFetch1', 'value1'), - array('userFetch2', 'appFetch2', 'keyFetch1', 'value2'), - array('userFetch3', 'appFetch2', 'keyFetch1', 3), - array('userFetch4', 'appFetch2', 'keyFetch1', 'value4'), - array('userFetch5', 'appFetch2', 'keyFetch1', 'value5'), - array('userFetch6', 'appFetch2', 'keyFetch1', 'value6'), - array('userFetch7', 'appFetch2', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch1', 'appFetch2', 'keyFetch1', 'value1'], + ['userFetch2', 'appFetch2', 'keyFetch1', 'value2'], + ['userFetch3', 'appFetch2', 'keyFetch1', 3], + ['userFetch4', 'appFetch2', 'keyFetch1', 'value4'], + ['userFetch5', 'appFetch2', 'keyFetch1', 'value5'], + ['userFetch6', 'appFetch2', 'keyFetch1', 'value6'], + ['userFetch7', 'appFetch2', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -306,20 +306,20 @@ class AllConfigTest extends \Test\TestCase { } $value = $config->getUserValueForUsers('appFetch2', 'keyFetch1', - array('userFetch1', 'userFetch2', 'userFetch3', 'userFetch5')); - $this->assertEquals(array( + ['userFetch1', 'userFetch2', 'userFetch3', 'userFetch5']); + $this->assertEquals([ 'userFetch1' => 'value1', 'userFetch2' => 'value2', 'userFetch3' => 3, 'userFetch5' => 'value5' - ), $value); + ], $value); $value = $config->getUserValueForUsers('appFetch2', 'keyFetch1', - array('userFetch1', 'userFetch4', 'userFetch9')); - $this->assertEquals(array( + ['userFetch1', 'userFetch4', 'userFetch9']); + $this->assertEquals([ 'userFetch1' => 'value1', 'userFetch4' => 'value4' - ), $value, 'userFetch9 is an non-existent user and should not be shown.'); + ], $value, 'userFetch9 is an non-existent user and should not be shown.'); // cleanup $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); @@ -329,15 +329,15 @@ class AllConfigTest extends \Test\TestCase { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch3', 'appFetch1', 'keyFetch1', 'value1'), - array('userFetch3', 'appFetch1', 'keyFetch2', 'value2'), - array('userFetch3', 'appFetch2', 'keyFetch3', 'value3'), - array('userFetch3', 'appFetch1', 'keyFetch4', 'value4'), - array('userFetch3', 'appFetch4', 'keyFetch1', 'value5'), - array('userFetch3', 'appFetch5', 'keyFetch1', 'value6'), - array('userFetch4', 'appFetch2', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch3', 'appFetch1', 'keyFetch1', 'value1'], + ['userFetch3', 'appFetch1', 'keyFetch2', 'value2'], + ['userFetch3', 'appFetch2', 'keyFetch3', 'value3'], + ['userFetch3', 'appFetch1', 'keyFetch4', 'value4'], + ['userFetch3', 'appFetch4', 'keyFetch1', 'value5'], + ['userFetch3', 'appFetch5', 'keyFetch1', 'value6'], + ['userFetch4', 'appFetch2', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -363,15 +363,15 @@ class AllConfigTest extends \Test\TestCase { $config = $this->getConfig(); // preparation - add something to the database - $data = array( - array('userFetch5', 'appFetch1', 'keyFetch1', 'value1'), - array('userFetch5', 'appFetch1', 'keyFetch2', 'value2'), - array('userFetch5', 'appFetch2', 'keyFetch3', 'value3'), - array('userFetch5', 'appFetch1', 'keyFetch4', 'value4'), - array('userFetch5', 'appFetch4', 'keyFetch1', 'value5'), - array('userFetch5', 'appFetch5', 'keyFetch1', 'value6'), - array('userFetch6', 'appFetch2', 'keyFetch1', 'value7') - ); + $data = [ + ['userFetch5', 'appFetch1', 'keyFetch1', 'value1'], + ['userFetch5', 'appFetch1', 'keyFetch2', 'value2'], + ['userFetch5', 'appFetch2', 'keyFetch3', 'value3'], + ['userFetch5', 'appFetch1', 'keyFetch4', 'value4'], + ['userFetch5', 'appFetch4', 'keyFetch1', 'value5'], + ['userFetch5', 'appFetch5', 'keyFetch1', 'value6'], + ['userFetch6', 'appFetch2', 'keyFetch1', 'value7'] + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -411,18 +411,18 @@ class AllConfigTest extends \Test\TestCase { ->method('getValue') ->with($this->equalTo('dbtype'), $this->equalTo('sqlite')) - ->will($this->returnValue(\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite'))); + ->willReturn(\OC::$server->getConfig()->getSystemValue('dbtype', 'sqlite')); $config = $this->getConfig($systemConfig); // preparation - add something to the database - $data = array( - array('user1', 'appFetch9', 'keyFetch9', 'value9'), - array('user2', 'appFetch9', 'keyFetch9', 'value9'), - array('user3', 'appFetch9', 'keyFetch9', 'value8'), - array('user4', 'appFetch9', 'keyFetch8', 'value9'), - array('user5', 'appFetch8', 'keyFetch9', 'value9'), - array('user6', 'appFetch9', 'keyFetch9', 'value9'), - ); + $data = [ + ['user1', 'appFetch9', 'keyFetch9', 'value9'], + ['user2', 'appFetch9', 'keyFetch9', 'value9'], + ['user3', 'appFetch9', 'keyFetch9', 'value8'], + ['user4', 'appFetch9', 'keyFetch8', 'value9'], + ['user5', 'appFetch8', 'keyFetch9', 'value9'], + ['user6', 'appFetch9', 'keyFetch9', 'value9'], + ]; foreach ($data as $entry) { $this->connection->executeUpdate( 'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' . @@ -432,7 +432,7 @@ class AllConfigTest extends \Test\TestCase { } $value = $config->getUsersForUserValue('appFetch9', 'keyFetch9', 'value9'); - $this->assertEquals(array('user1', 'user2', 'user6'), $value); + $this->assertEquals(['user1', 'user2', 'user6'], $value); // cleanup $this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`'); diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 0e895b5f999..68e4a5beaf1 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -35,29 +35,29 @@ class AppManagerTest extends TestCase { * @return AppConfig|MockObject */ protected function getAppConfig() { - $appConfig = array(); + $appConfig = []; $config = $this->createMock(AppConfig::class); $config->expects($this->any()) ->method('getValue') - ->will($this->returnCallback(function ($app, $key, $default) use (&$appConfig) { + ->willReturnCallback(function ($app, $key, $default) use (&$appConfig) { return (isset($appConfig[$app]) and isset($appConfig[$app][$key])) ? $appConfig[$app][$key] : $default; - })); + }); $config->expects($this->any()) ->method('setValue') - ->will($this->returnCallback(function ($app, $key, $value) use (&$appConfig) { + ->willReturnCallback(function ($app, $key, $value) use (&$appConfig) { if (!isset($appConfig[$app])) { - $appConfig[$app] = array(); + $appConfig[$app] = []; } $appConfig[$app][$key] = $value; - })); + }); $config->expects($this->any()) ->method('getValues') - ->will($this->returnCallback(function ($app, $key) use (&$appConfig) { + ->willReturnCallback(function ($app, $key) use (&$appConfig) { if ($app) { return $appConfig[$app]; } else { - $values = array(); + $values = []; foreach ($appConfig as $appid => $appData) { if (isset($appData[$key])) { $values[$appid] = $appData[$key]; @@ -65,7 +65,7 @@ class AppManagerTest extends TestCase { } return $values; } - })); + }); return $config; } @@ -346,7 +346,7 @@ class AppManagerTest extends TestCase { $this->groupManager->expects($this->once()) ->method('getUserGroupIds') ->with($user) - ->will($this->returnValue(array('foo', 'bar'))); + ->willReturn(['foo', 'bar']); $this->appConfig->setValue('test', 'enabled', '["foo"]'); $this->assertTrue($this->manager->isEnabledForUser('test', $user)); @@ -357,7 +357,7 @@ class AppManagerTest extends TestCase { $this->groupManager->expects($this->once()) ->method('getUserGroupIds') ->with($user) - ->will($this->returnValue(array('bar'))); + ->willReturn(['bar']); $this->appConfig->setValue('test', 'enabled', '["foo"]'); $this->assertFalse($this->manager->isEnabledForUser('test', $user)); @@ -373,11 +373,11 @@ class AppManagerTest extends TestCase { $this->userSession->expects($this->once()) ->method('getUser') - ->will($this->returnValue($user)); + ->willReturn($user); $this->groupManager->expects($this->once()) ->method('getUserGroupIds') ->with($user) - ->will($this->returnValue(array('foo', 'bar'))); + ->willReturn(['foo', 'bar']); $this->appConfig->setValue('test', 'enabled', '["foo"]'); $this->assertTrue($this->manager->isEnabledForUser('test')); @@ -410,7 +410,7 @@ class AppManagerTest extends TestCase { $this->groupManager->expects($this->any()) ->method('getUserGroupIds') ->with($user) - ->will($this->returnValue(array('foo', 'bar'))); + ->willReturn(['foo', 'bar']); $this->appConfig->setValue('test1', 'enabled', 'yes'); $this->appConfig->setValue('test2', 'enabled', 'no'); @@ -462,11 +462,11 @@ class AppManagerTest extends TestCase { $manager->expects($this->any()) ->method('getAppInfo') - ->will($this->returnCallback( + ->willReturnCallback( function($appId) use ($appInfos) { return $appInfos[$appId]; } - )); + ); $this->appConfig->setValue('test1', 'enabled', 'yes'); $this->appConfig->setValue('test1', 'installed_version', '1.0.0'); @@ -511,11 +511,11 @@ class AppManagerTest extends TestCase { $manager->expects($this->any()) ->method('getAppInfo') - ->will($this->returnCallback( + ->willReturnCallback( function($appId) use ($appInfos) { return $appInfos[$appId]; } - )); + ); $this->appConfig->setValue('test1', 'enabled', 'yes'); $this->appConfig->setValue('test2', 'enabled', 'yes'); @@ -532,7 +532,7 @@ class AppManagerTest extends TestCase { $group = $this->createMock(IGroup::class); $group->expects($this->any()) ->method('getGID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $this->appConfig->setValue('test1', 'enabled', 'yes'); $this->appConfig->setValue('test2', 'enabled', 'no'); diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php index 2c566b0ea0a..dc7e1920896 100644 --- a/tests/lib/App/AppStore/Bundles/BundleBase.php +++ b/tests/lib/App/AppStore/Bundles/BundleBase.php @@ -41,9 +41,9 @@ abstract class BundleBase extends TestCase { parent::setUp(); $this->l10n = $this->createMock(IL10N::class); $this->l10n->method('t') - ->will($this->returnCallback(function ($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); - })); + }); } public function testGetIdentifier() { diff --git a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php index 1c5d2a480e9..bdbc3f172b7 100644 --- a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php +++ b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php @@ -35,7 +35,6 @@ class EducationBundleTest extends BundleBase { 'circles', 'groupfolders', 'announcementcenter', - 'admin_notifications', 'quota_warning', 'orcid', 'user_saml', diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index 38e813dc251..f18c24f2f61 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -57,16 +57,16 @@ class AppFetcherTest extends TestCase { static $responseJson = <<<'EOD' [{"id":"direct_menu","categories":["customization"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/juliushaertl/direct_menu/issues","website":"","created":"2016-10-01T09:16:06.030994Z","lastModified":"2016-10-06T14:01:05.584192Z","releases":[{"version":"0.9.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/juliushaertl/direct_menu/releases/download/v0.9.2/direct_menu.tar.gz","created":"2016-10-06T14:01:05.578297Z","licenses":["agpl"],"lastModified":"2016-10-06T14:01:05.643813Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"ERBS9G5bZ3vwCizz2Ht5DehsVJmb63bzF3aYcH7xjbDVMPagOFWdUAiLDwTeZR1n\ni4gdZ73J/IjHQQJoOPwtCjgbZgLPFqL5x13CLUO9mb/33dZe/+gqEDc/3AuJ4TlA\nXUdLxHRb1bwIlJOwuSr/E24452VG20WUhLXBoM0Zm7WcMxvJWo2zAWnuqnLX3dy9\ncPB4PX+6JU2lUMINj8OYQmM1QnqvjG8YV0cYHbBbnSicOGwXEnni7mojsC8T0cn7\nYEJ2O2iO9hh3fvFEXUzDcL7tDQ5bZqm63Oa991bsAJxFo/RbzeJRh//DcOrd8Ufn\nu2SqRhwybS8j4YvfjAL9RPdRfPLwf6X2gx/Y6QFrKHH0QMI/9J/ZFyoUQcqKbsHV\n85O+yuWoqVmza71tkp4n9PuMdprCinaVvHbHbNGUf2SIh9BWuEQuVvvnvB+ZW8XY\n+Cl+unzk3WgOgT0iY3uEmsQcrLIo4DSKhcNgD1NS13fR/JTSavvmOqBarUMFZfVC\nbkR1DTBCyDjdpNBidpa3/26675dz5IT5Zedp4BBBREQzX08cIhJx5mgqDdX3CU09\nuWtzoaLi71/1BWTFAN+Y9VyfZ8/Z3Pg3vKedRJ565mztIj0geL3riEsC5YnPS0+C\n+a3B9sDiiOa101EORzX3lrPqL7reEPdCxrIwN+hKFBQ=","translations":{}}],"screenshots":[{"url":"https://bitgrid.net/~jus/direct_menu_nc.png"}],"translations":{"en":{"name":"Direct Menu","summary":"Provide easy access to all apps in the header.","description":"Provide easy access to all apps in the header."}},"isFeatured":false,"authors":[{"name":"Julius Härtl","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEBjCCAu4CAhADMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE0MTI1MDU0WhcNMjYxMjIxMTI1MDU0WjAWMRQwEgYD\r\nVQQDDAtkaXJlY3RfbWVudTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB\r\nAMkzWsAkKP/40ktvJMpnr0IJNVoPOR0hvh24igcDskL1WKiD2eiRUenj5LE0Nvn+\r\nsiGmWsAqRVpdiz+Y8ghQqQMzKi43IrRN0AxlCrHWrSqBZT3wIAUcFz4RzEoFxc1N\r\nUZzWma6ljukGnvt4V1ZyT+H/cjqxUkBhh/y9SS0jUen1a1grND6Rw54X46V2dlCu\r\nFH+pLsfPJJGw+QLeTGHn7dqdv18cYMAlWDCzPixVnNiCXHZcUtKMmstU2xU4R2e6\r\nzimp2rgkE4TNHrafpjH8xGdNi2FG5Dmokob/L5Q2r8jyNaW7UsFfrvLTRj371b3/\r\n2FhhxoGUvDzaG2An02Exwm52LJfdTVMHAMPZub5poHfy5vAEdZGPQ/m02l8ZK/Y2\r\n7yT807GlfPMXfdfjCxR6wNtmv7rvBDdrUZmIRNJfpFSdvlH/+MOTWnabyfQv2K4Q\r\nBIwltX6Elh0lh4ntvt1ZVtvFv+PL1Dc7QLV+w19+/LJA0mnsh7GIFYKFlbA65gA0\r\nc/w+uqDy0+5MxkR9WGPpd79KRA1tKWTis4Ny1lApK5y3zIsVGa3DfBHXcwqkWHbV\r\nwIpyuyyDsFtC1b9LTFONX7iU9cbNk5C5GTM331MdA2kLcD/D5k42GNTBSca7MkPx\r\nFx/ETSn0Ct167el30symf2AxvXjw+mBYPN71rVTMDwe9AgMBAAEwDQYJKoZIhvcN\r\nAQELBQADggEBAC0fJKnbEhXA8M283jA9GxABxLyTBcQyVVNnz2L/bYYNi81Y9iZv\r\n+U0S3qaIfoqNcV9FTKAutbsKvWyolnI7MRRK6feNuFfoP2jKubM1CnawpyT/RF2Q\r\ne/zxnB1EmeI2X5D2xceJDLB7Fy5W0EGrLixRIdFaSUommWFUm9E2hSIaNlziSBdc\r\n1J/mOQeNYO5zg5ouEt1rzQW4Mhh1I2uNQmGe4ip+Jl/2LAv3FZuu4NrSEcoXH3ro\r\nG2dF9Gtu4GiQ5fuaJknaxlgXHovfqeZwZJX9o4M+Ug81AqiY7XjdiaCPdh0Tthcx\r\n2OmWZo7UBREWenjKyFZZ/iKoqH5sdenBtpo=\r\n-----END CERTIFICATE-----"},{"id":"apporder","categories":["customization"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/juliushaertl/apporder/issues","website":"","created":"2016-10-01T09:16:47.111889Z","lastModified":"2016-10-12T19:50:16.038821Z","releases":[{"version":"0.3.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/juliushaertl/apporder/releases/download/0.3.3/apporder.tar.gz","created":"2016-10-12T19:14:10.802359Z","licenses":["agpl"],"lastModified":"2016-10-12T19:50:16.104357Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"nhlT9lhrmBxIsqh/e3RLm2NDw/U8ZvvoMyYQTLMM3H19DQmVcPYPYC9QWVTsowUzXblVaOXVGylbpKma9yOlOAqJtF3qyXecLl4+tA/Awb6BBhKPgHFdcLDAL5yy1K7/uei3SgEojMlJoI9vEK5I1C5YTh43yNH+//Im6MAuNYFUTlMXK426zdOe6ogpCI5GlYdXopqYANxcpT+WXWET6DDSM5Ev+MYwMcSAY4r8+tvARRU4ZAenRgjkBT6R5z6cD76emRax14tbV6vkjjwRcO+dQtM0tFPbd+5fsNInbauv50VzIMgjA6RnKTOI17gRsSdGlsV4vZn2aIxEPWauu6T/UohMvAE9HMn13vtbpPBSFwJAktj6yHASYGzupNQLprA0+OdyALoLZPpQAKNEXA42a4EVISBKu0EmduHJlUPeqhnIGkkGgVNWS8AWqzP2nFoPdXBgUWateiMcBTHxgEKDac5YmNc9lsXpzf1OxBaXHBhGYKuXPwIfyH3jTWb1OdwixJEuRe9dl63T9qOTRre8QWns/bMqKLibGfMtFhVB21ARJayBuX70eVvabG/2N7Y5t1zUlFygIKu51tvo3AVCRDdRrFWDvkAjxzIz5FIdALVZ+DReFYu/r4WF/w3V9rInFuEDSwb/OH4r8sQycs07tSlMyA74Y3FpjKTBxso=","translations":{}},{"version":"0.3.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/juliushaertl/apporder/releases/download/0.3.2/apporder.tar.gz","created":"2016-10-06T14:00:51.532409Z","licenses":["agpl"],"lastModified":"2016-10-06T14:00:51.598455Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"gRVFOtj9414ZNSdRH/qNB2SwVZUQh+gaFnNLFjjXjJ1MdRMCISzvwb+QU1qYuK/y\nuL8K0pn1+fFQf8A3VsC2pb6yaLQ5U9C3Guf886Flf4qtYw1P8UWRA9yOJ+6Md+PH\n6pTEiDIdm4xbmM0KkBhsE5kL8dvLIq4EwwcAh2Qq8fjytzAk1YiP+KrTaYrVwskM\nDmm0lgP4NVnjRBTX9myW6tr6N3w0tq2jJ/+a/vEDJv+5ozKJx8N5gbJNdrtI4k7I\nyaQNWJ7cngtAHmUREeoBggV5uJayDceu83PPQR6N9/WVyNyZjw1Q8/Q6e/NyiXT2\no8mGv5tHl3DBOVuv8v7gBQgDh6ppp12M81aiCZymn2XIgjw50VQ+K15KHnLHuFFw\nwuHZVcoQ7b6oR4K4TURSfPFUeNgGS4R9v6gjg1RUcSm1Pnryc6pYnh10AUY8dk6q\n1CZ6Upt6SScP2ZEGWsFwVjjQhY/ZJmNfnhaGoFOZ5L9CnzyNCkGXFg0rL36i6djb\naqFy/z+Brnklng5ct6XWoP7uDt5BaHznQj1NHSfHn0GUQ0N968zWm9vQvy+dyXyC\nxR7vKeu2ppZ2ydoeQ9CVwfhOEsGs5OvrpapQdh9KbUHcX7b7ql01J7/P6dFuNuHe\n+7/y4ex3sEVg5YBmDtF8iZ6d7zsHd6peL1s1EsLnenQ=","translations":{}}],"screenshots":[{"url":"https://bitgrid.net/~jus/apporder-nc.gif"}],"translations":{"en":{"name":"AppOrder","summary":"Sort apps in the menu with drag and drop","description":"\nEnable sorting for icons inside the app menu. The order will be saved for each\nuser individually. Administrators can define a custom default order.\nAppOrder works with the default owncloud menu as well as with the direct_menu\napp.\n\n## Set a default order for all new users\n\nGo to the Admin settings > Additional settings and drag the icons under App order.\n\n## Use first app as default app\n\nYou can easily let Nextcloud redirect your user to the first app in their\npersonal order by changing the following parameter in your config/config.php:\n\n'defaultapp' => 'apporder',\n\nUsers will now get redirected to the first app of the default order or to the\nfirst app of the user order.\n "}},"isFeatured":false,"authors":[{"name":"Julius Härtl","mail":"jus@bitgrid.net","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhAEMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE0MTI1MjQ4WhcNMjYxMjIxMTI1MjQ4WjATMREwDwYD\r\nVQQDDAhhcHBvcmRlcjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKVK\r\nKn5jivCu+eRfe5BECjDOzNaGHlpiegb49Hf4nh0W7DqcoLHip5c1O2BcEYdH6rkw\r\n20WclvjoQpgavG5aFXzXzur6eKTT5TpgY5oZTLoWjbx4e+fKdhyDPTpqNZzs1pxz\r\nsZLDL/ElpbSErE0s+QK/pzP11WNPylAkI9AKSyDMO3Mbllg8I8Bt+bT7LJKYOO/T\r\nLhv9m0anLZ4HrdfimhVIoMiu3RpyRigk8titXZA94+F8Fbf7ZQ9f14Y/v3+rfJFQ\r\nii9cDoox5uUrjplH2LrMr5BodfCfydLu4uVpPWYkdccgvcZ1sugjvNXyCQgdzQDK\r\npOpiwVkkiQFaQJYbGSDblFWPl/cLtA/P/qS7s8tWyTQuc1rYlEpCHG/fG8ZFkSVK\r\n9eCMGxK908VB4IU2DHZHOHi7JvtOz8X/Ak6pIIFdARoW3rfKlrz6DD4T9jEgYq0n\r\nRe7YwCKEIU3liZJ+qG6LCa+rMlp/7sCzAmqBhaaaJyX4nnZCa2Q2cNZpItEAdwVc\r\nqxLYL1FiNFMSeeYhzJJoq5iMC3vp2LScUJJNoXZj9zv+uqTNGHr+bimchR2rHUBo\r\nPzDLFJmat03KdWcMYxcK5mxJNGHpgyqM7gySlbppY/cgAospE8/ygU2FlFWIC9N0\r\neDaY+T8QA1msnzsfMhYuOI8CRYigan1agGOMDgGxAgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBAGsECd+meXHg1rr8Wb6qrkDz/uxkY1J+pa5WxnkVcB6QrF3+HDtLMvYm\r\nTTS02ffLLyATNTOALZFSy4fh4At4SrNzl8dUaapgqk1T8f+y1FhfpZrEBsarrq+2\r\nCSKtBro2jcnxzI3BvHdQcx4RAGo8sUzaqKBmsy+JmAqpCSk8f1zHR94x4Akp7n44\r\n8Ha7u1GcHMPzSeScRMGJX/x06B45cLVGHH5GF2Bu/8JaCSEAsgETCMkc/XFMYrRd\r\nTu+WGOL2Ee5U4k4XFdzeSLODWby08iU+Gx3bXTR6WIvXCYeIVsCPKK/luvfGkiSR\r\nCpW1GUIA1cyulT4uyHf9g6BMdYVOsFQ=\r\n-----END CERTIFICATE-----"},{"id":"twofactor_totp","categories":["tools"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"","website":"","created":"2016-10-08T14:13:54.356716Z","lastModified":"2016-10-12T14:38:56.186269Z","releases":[{"version":"0.4.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0 <7.1.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/ChristophWurst/twofactor_totp/releases/download/0.4.1/twofactor_totp.tar.gz","created":"2016-10-12T14:38:56.174612Z","licenses":["agpl"],"lastModified":"2016-10-12T14:38:56.248223Z","isNightly":false,"rawPhpVersionSpec":">=5.4 <=7.0","rawPlatformVersionSpec":">=10 <=11","signature":"bnwWxmHEn8xkoWbtwhC1kIrJ0dQfAI3PUtU62k+Tru/BHt1G2aVxqO8bCdghojZ7\nzdFMlIJw4kekYFsVfLk8jzjUTZKVbNVKCdkHrVTQ0bUUryMAMLqGQ3PSRI5NX6D5\nFpkvwO1coYwU0XVWF8KAS0meX0ztSkT3Mv96LLrxr8F8SrB/MGmKIE4WTjt1fAIa\nZLAVEUo/3sNFTGLYBtL3wjctrkZvJltP8abeRfls9FkRHu+rN7R3uLFzk42uZn3X\nWpt5BBmlYm5ORbnJ2ApsxEkMNK+rOy8GIePaz5277ozTNrOnO04id1FXnS9mIsKD\n20nRzjekZH+nneQYoCTfnEFg2QXpW+a+zINbqCD5hivEU8utdpDAHFpNjIJdjXcS\n8MiCA/yvtwRnfqJ5Fy9BxJ6Gt05/GPUqT8DS7P1I1N+qxhsvFEdxhrm2yIOhif8o\nh7ro5ls+d3OQ8i3i4vdZm821Ytxdu/DQBHiVoOBarvFWwWAv2zd2VAvpTmk6J5yv\n3y+csRqpEJYd9fcVMPsTu7WBRRrpBsAqdAHJcZEwak2kz1kdOgSf8FIzP1z6Q71d\nMl2RKcPeutMHHSLiGIN/h7fM5aSs49wGgGZmfz28fHVd7/U0HFSMYmkT/GMq5tMP\nIyc+QZAN4qbX8G0k/QSTkK/L4lOT2hQiQqiSqmWItMk=","translations":{}}],"screenshots":[],"translations":{"en":{"name":"Two Factor TOTP Provider","summary":"A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)","description":"A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)"}},"isFeatured":true,"authors":[{"name":"Christoph Wurst","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIECTCCAvECAhASMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYxMDEyMDkzNDMxWhcNMjcwMTE4MDkzNDMxWjAZMRcwFQYD\r\nVQQDDA50d29mYWN0b3JfdG90cDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC\r\nggIBALC1K94104L/nOtmTygx7QNjUcnHs3yrn71mw4pMxTlonXOnMTpwxsfL1Hhu\r\n/5GMSgupTbQPlevSl6J86UMs455/sPShd6ifmAuhb8VFaAsjpizjs0RMaUg1sjmF\r\nuV18PD9FXLourx51V/c4MG5kpavlV+bLUrVMAjbsJY2+k30tCC/XkP5u8jUWmM/T\r\n5REChn7/obPgaeddhuJoILYhKEW3VNrR8Fm9SYiviB3FLhM7URDZ97IBnXYqbvbT\r\nZnvq+E74Zc7HgYwQwrjU/AqQAInhNpAR4ZM6CkWWWWaL96O1q3lCfKJNaxqC0Kg/\r\nkGn/pxYkl9062jtMUz60s9OPDyuisfyl68UyM68Ozyz4SMRLmDVbewOqQAwmAbtz\r\n8p9AQrX3Pr9tXhARR4pDSsQz1z+8ExEd6EKbhMyiTtHtZQ1Vm9qfoR52snpznb5N\r\ne4TcT2qHAkOWV9+a9ESXmQz2bNjgThxEl5edTVY9m4t248lK5aBTGq5ZKGULNHSQ\r\nGGpr/ftMFpII45tSvadexUvzcR/BHt3QwBAlPmA4rWtjmOMuJGDGk+mKw4pUgtT8\r\nKvUMPQpnrbXSjKctxb3V5Ppg0UGntlSG71aVdxY1raLvKSmYeoMxUTnNeS6UYAF6\r\nI3FiuPnrjVFsZa2gwZfG8NmUPVPdv1O/IvLbToXvyieo8MbZAgMBAAEwDQYJKoZI\r\nhvcNAQELBQADggEBAEb6ajdng0bnNRuqL/GbmDC2hyy3exqPoZB/P5u0nZZzDZ18\r\nLFgiWr8DOYvS+9i6kdwWscMwNJsLEUQ2rdrAi+fGr6dlazn3sCCXrskLURKn5qCU\r\nfIFZbr2bGjSg93JGnvNorfsdJkwpFW2Z9gOwMwa9tAzSkR9CsSdOeYrmdtBdodAR\r\ndIu2MkhxAZk9FZfnFkjTaAXcBHafJce7H/IEjHDEoIkFp5KnAQLHsJb4n8JeXmi9\r\nVMgQ6yUWNuzOQMZpMIV7RMOUZHvxiX/ZWUFzXNYX0GYub6p4O2uh3LJE+xXyDf77\r\nRBO7PLY3m4TXCeKesxZlkoGke+lnq7B8tkADdPI=\r\n-----END CERTIFICATE-----"},{"id":"contacts","categories":["office","organization","social"],"userDocs":"https://docs.nextcloud.com/server/11/user_manual/pim/contacts.html","adminDocs":"https://docs.nextcloud.com/server/11/admin_manual/configuration_server/occ_command.html?highlight=occ%20commands#dav-label","developerDocs":"https://github.com/nextcloud/contacts#building-the-app","issueTracker":"https://github.com/nextcloud/contacts/issues","website":"https://github.com/nextcloud/contacts#readme","created":"2016-10-30T14:00:58.922766Z","lastModified":"2016-11-22T22:08:01.904319Z","releases":[{"version":"1.5.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/contacts/releases/download/v1.5.0/contacts.tar.gz","created":"2016-11-22T22:08:01.861942Z","licenses":["agpl"],"lastModified":"2016-11-22T22:08:02.306939Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"ZqqhqtbHcNB+rzGCQ7FDIjjvHjit+dhAE1UhFgiXApkx3tmPP4nJOBAGNjHe+2Ao\nVcTIX2SrWEfieRrA4Gp+0k7pUPWag1Z0T1OVOwO4cmS1AVFyGIOE1bRvDhMfsWTU\n4CI4oXaKBFAY6mtnf7VJ7EeIdNqhImkohyWDQ88NiPRLM1XNkJJk6AvZBcT0fvCv\no145X4dLpbixSXsN99QFNJ/oXvK+9tBGwTd5i/WnNFY90vcNRLia8aRo7SA0YJRx\nLnxnj2HMqwTTDQEKE+1elYKWsqQ2DeqwScP97UIKe5bZXnrwOi9kH9PDmR4abtzd\nlHL8E1Wgw25ePDeHG7APrx0tVOJy1bP+g8vcarpGynWZoizDkBvYZD+xtxizpBXC\nJsDOSzczApptY6dnOtv0Vat8oh/Z/F99gBUahEu4WZ16ZgR1nj40PDK1Snl18Cgk\nMe1EZcde8SLEpTbCWYIfIw/O9Fkp5cWD/dAqoiO6g+gNxSZ/gGp57qoGfFxn7d/x\nH3aH8GljatAFjrwItw1JzR0THt0ukkOK+bw/pfCslk10sjHMitmz/GXa4qMS91DZ\nBKLUd0dSfQUQzkfwcojImbzJRvca4/DYe3mfG7+RCH0tDL6t72dKL9joB++u5R1u\nVZPgkToexlXcKWpiDB8H2/SEShKr4udAOjR5de9CYWM=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/nextcloud/screenshots/master/apps/Contacts/contacts.png"}],"translations":{"en":{"name":"Contacts","summary":"The new and improved app for your Contacts.","description":"The new and improved app for your Contacts."}},"isFeatured":true,"authors":[{"name":"Alexander Weidinger","mail":"","homepage":""},{"name":"Jan-Christoph Borchardt","mail":"","homepage":""},{"name":"Hendrik Leppelsack","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhATMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYxMDEyMjAzNzIyWhcNMjcwMTE4MjAzNzIyWjATMREwDwYD\r\nVQQDDAhjb250YWN0czCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANzx\r\n/zJF+5/s4lOJLWIlfKQgTy+UpvIpiUXCgrsHsDZTx+hjQAhIWukH88a+7NVAL7Ys\r\nkQNC0Tlm755FJi/T6EdR7edOwIRdo2ZwakOWLZXd209+6cCd2UloHL0bgnbWepTl\r\nR/4YgbLg/G+FVKCfkEiYc3PuDZ3EVrcwQFcg7h74X9ne6CHH0Z1WQLydxJuVEb2n\r\nX9I+nIRpPHcVostkSiUmzHR7C5TjTIo2PzzgnCU6GC0iBa6z6dDYfz24QEp/b8UA\r\nZaLhjkyKghVGMnoF/s9KPgH4NM8pvvtadQN8pxlOPju4wbmKPUrsXo4ujurDXbbc\r\nYkzNt8ojobGwdTXoyDogAsGZLQd2FQksWpRvY+I3zVPokBfPMdUPLllG5VcV0VA5\r\nDRK+h2ms+XmspdBvGonjF+XdbFm9hEmDoFmoi9aU6C6AdofjmG/e9+pw/20dXUWk\r\nmMorWwXQ5yLmIn5LnpRXrOuK7CS28VRhBYuVNMlsyKhzU0rophbsD9OFXxYLjr6s\r\n7UPNwZ5h+kjXZDBKD89QctBSViT8RhLe8nulRIm0iJn1sb9hca/CF63KmsFzENfK\r\nQeM6MO0H34PB84iNyz5AX1OIy+1wHD4Wrzt9O/i2LkWK6tBhL69aZiBqdLXWKffj\r\nARDCxxIfews51EZFyHzwsw65I97y46aBKxY382q7AgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBACLypX0spxAVAwQIS9dlC9bh1X/XdW2nAvSju2taUTBzbp074SnW6niI\r\nbnY4ihYs4yOuGvzXxnp/OlvWH7qhOIchJUq/XPcEFMa7P03XjVpcNnD3k0zQWlZb\r\ntGonX9EUOeLZKdqI4fkrCkMLScfjgJzoHGYQrm8vlIg0IVuRLCKd5+x4bS7KagbG\r\niuPit2pjkw3nWz0JRHneRXz/BNoAWBnJiV7JMF2xwBAHN4ghTM8NSJzrGTurmpMI\r\nGld7yCP47xNPaAZEC66odcClvNtJ2Clgp8739jD6uJJCqcKDejeef0VU1PG7AXId\r\n52bVrGMxJwOuL1393vKxGH0PHDzcB1M=\r\n-----END CERTIFICATE-----"},{"id":"mail","categories":["tools"],"userDocs":"","adminDocs":"https://github.com/nextcloud/mail#readme","developerDocs":"","issueTracker":"","website":"","created":"2016-10-19T19:41:41.710285Z","lastModified":"2016-10-19T19:57:33.689238Z","releases":[{"version":"0.6.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0 <7.1.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/mail/releases/download/v0.6.0/mail.tar.gz","created":"2016-10-19T19:57:33.676730Z","licenses":["agpl"],"lastModified":"2016-10-19T19:57:33.834580Z","isNightly":false,"rawPhpVersionSpec":">=5.4 <=7.0","rawPlatformVersionSpec":">=10 <=11","signature":"VbMsvDpt+gSPeFM8LrZXEK10rk8kkLlgCcblgqNdCSeGZeVpwDAYv3CccVSLa0+l\nlTSqQ0VIoH+OIU6vIQNBKHmSCzTplk7OrY0+L5FajXx8LnBaOh892GfGSlEt1neN\nKyM0i0uOjO/xpCP/NoUlgkz6hnmYY5XEdN6DTsJtJ/XZhDQ45IYuIkMkHE/eFehS\n0JnOagIz+PSipeBY2Ry+tV8YbRa7bC1JAvZzlod0dyI015AHZESeitRUY+MwMWkt\nN/me7g7/Kev0wggIQQZm9aYcw63GMk/1VHUPB7Y0ESW9tx2nR5+KwTDn/Jy4DGf1\nrg8h0t5I+aPhHOBLrpczH0qaZWY2lsVZWq8KWjJI9aR9P0v2f2aXixXzD/Cuz1cK\nhvhKWkOSla4D+/FxeyHGjQvdXMG8gXm0ZmTimKChCoVuCbncDd8pzkdyNoGXcvuk\nsP8OrkQFooL4E7S4BWfdSiN/a8jUITJQkuXp/OVrVGeCupLWJh7qegUw6DvoqyGy\nD4c6b+qYn68kx3CLaPPiz+tFAZQZQdj7+Kx/lohso8yTnVSiGYrMj4IvvCbpsQjg\nWF3WSqF/K/tTnPYTWb9NUPSihTbVNv6AXOfTsPEp/ba2YSS5DjvjVjkr5vhR9eg1\nikQ3Cw6lW3vaA4LVCC+hFkMRnI4N0bo5qQavP3PnZPc=","translations":{"en":{"changelog":"### Added\n- Alias support\n [#1523](https://github.com/owncloud/mail/pull/1523) @tahaalibra\n- New incoming messages are prefetched\n [#1631](https://github.com/owncloud/mail/pull/1631) @ChristophWurst\n- Custom app folder support\n [#1627](https://github.com/owncloud/mail/pull/1627) @juliushaertl\n- Improved search\n [#1609](https://github.com/owncloud/mail/pull/1609) @ChristophWurst\n- Scroll to refresh\n [#1595](https://github.com/owncloud/mail/pull/1593) @ChristophWurst\n- Shortcuts to star and mark messages as unread\n [#1590](https://github.com/owncloud/mail/pull/1590) @ChristophWurst\n- Shortcuts to select previous/next messsage\n [#1557](https://github.com/owncloud/mail/pull/1557) @ChristophWurst\n\n## Changed\n- Minimum server is Nextcloud 10/ownCloud 9.1\n [#84](https://github.com/nextcloud/mail/pull/84) @ChristophWurst\n- Use session storage instead of local storage for client-side cache\n [#1612](https://github.com/owncloud/mail/pull/1612) @ChristophWurst\n- When deleting the current message, the next one is selected immediatelly\n [#1585](https://github.com/owncloud/mail/pull/1585) @ChristophWurst\n\n## Fixed\n- Client error while composing a new message\n [#1609](https://github.com/owncloud/mail/pull/1609) @ChristophWurst\n- Delay app start until page has finished loading\n [#1634](https://github.com/owncloud/mail/pull/1634) @ChristophWurst\n- Auto-redirection of HTML mail links\n [#1603](https://github.com/owncloud/mail/pull/1603) @ChristophWurst\n- Update folder counters when reading/deleting messages\n [#1585](https://github.com/owncloud/mail/pull/1585)"}}}],"screenshots":[],"translations":{"en":{"name":"Mail","summary":"Easy to use email client which connects to your mail server via IMAP and SMTP.","description":"Easy to use email client which connects to your mail server via IMAP and SMTP."}},"isFeatured":false,"authors":[{"name":"Christoph Wurst, Thomas Müller, Jan-Christoph Borchardt, Steffen Lindner & many more …","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIID/zCCAucCAhAVMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDE5MTkzMDM0WhcNMjcwMTI1MTkzMDM0WjAPMQ0wCwYD\nVQQDDARtYWlsMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp++RuliQ\nlBeeiPtP0ecBn00OaU1UCpft/NVI5pnSiT9nU4l2kc5IvKjA8UxDB3gWfYTOeBFh\ntUHQ2P6UKCmHZT9sApHhqLu2n0V+YhlFIViuaxndSID/M414cl56xOYQusV3Pcae\no2dOSeRRzLab3tEaVHlkBSFkGmAwPZItsmTklvV3h1sUysDicYgfXPCkf7K+JgWA\nBP7vsWC8B7MDRhcB3enYv5tTcpsyvtGX7bb1oTIWVypcmKsGYfTX12VNBxKzNBIG\n8pwdb8Xo0o14TytWsWN7mSHf1XbwfwYMjDWOlMqiRc+mcoKMBH41TfM/CXslSivI\nsyvxasEaFdlj8lmKPENdzw1OfYRs43usIf4szwyt4rb8ocXfDipnY3P2hccN6YcZ\nl8y8Vsr69ASluDj2A2Pl5vH6xp6tNybZRnN5G6sghhaYaLNDU/TdMyYzz4AY33Ra\nHSaMypfcXjd76Aj8jZvcwk1BH+ZsvFqNK7ZKCb7WVcMH8KRcU1sxZ4rp9vviM2fL\nL7EVtznm3bSI9jjHXbiwq7RvNRRy+F6YRpAdWGwTU8uUkDabPFi41FikYyzNWauK\nJhlDJXl514XjKyMVBjAZYVr5gZZkO1J7C4XzLFbC5UzYNSzW5Iwx/1j5OeYJRxh6\n5rhiUwR+COT1wdVsl6khMC8MfBR4unSd338CAwEAATANBgkqhkiG9w0BAQsFAAOC\nAQEATBvpqz75PUOFPy7Tsj9bJPaKOlvBSklHH7s43fDDmQbJwswXarZi3gNdKf8D\nyO/ACZvO8ANWAWL/WahkOyQtKOYzffaABGcEIP7636jzBdKtgwSGzW3fMwDghG10\nqBr2dE6ruOEdSpuZxgMgh2EulgknZUXaHAMI2HjjtAMOBScLQVjOgUqiOHmICrXy\nZETmzhx0BXDt5enJYs8R2KMYJNIme1easQRYmWKliXogNY09W7ifT9FHtVW1HX+K\nxRS4JXbapjolkxyGSpP+iYSgItVnYzl6o9KZResR4yDsBv7G/8fpV4GQU9IS3zLD\nPiZOosVHWJdpUKCw9V4P1prGTQ==\n-----END CERTIFICATE-----"},{"id":"audioplayer","categories":["multimedia"],"userDocs":"https://github.com/rello/audioplayer/wiki#user-documentation","adminDocs":"https://github.com/rello/audioplayer/wiki#admin-documentation","developerDocs":"","issueTracker":"https://github.com/rello/audioplayer/issues","website":"https://github.com/rello/audioplayer","created":"2016-09-16T05:44:24.857567Z","lastModified":"2016-11-17T22:34:34.637028Z","releases":[{"version":"1.3.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/Rello/audioplayer/releases/download/1.3.1/audioplayer-1.3.1.tar.gz","created":"2016-11-17T22:34:34.215350Z","licenses":["agpl"],"lastModified":"2016-11-17T22:34:34.867778Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=9 <=11","signature":"p6Zz0IEFrxvw6y/3jHgGWWCxR6qpMzvU2HKfxcIVsK6sJnoRUhWLeAXwZ432fH2a S2llj+IGS9OvW+5VQElrXgPtEjDK1BT00DRJnp5RFCRlUv0LNoedJMzx6B6AHqPP JBufk3cG1O/CO0M0L1ITGSmSOzfKvWTRo3lxVGF792NyBaP/SyZCkH1N1TzBQzUi Ywl3+HiglPcXbHjtJm/arnKorbJWVKoaN93xFuaBapd2ozQSpi0fE0uGRsici+U7 HNa1M5WFE1rzUJoufE0E9246At07rFY1e+TdNEq8IlLgCXg5vGCKkEyuWpWno6aX LfRaIiT9x39UTAwNvuDKS0c+n4uWDYPsGfKhDx9N7CXpUrthfXVEWRzZEXG7as10 6ANvrRPJemSZH8FUSrdJhD7k12qa9R825y7mIG68Li8P71V92EOxFfo9tNXqXwBt VuDGxBqByFVPqSCj5I8hrzJzQl2Xt40g8+8ZcSF96RMg/pM+bwRMTv+mz0V+vQQ4 DWjqnWVPalaJ1PPD5/QFFErtXuNRbyxKZ6BMWxfJlLM9Kz66P75K+8fYaSwz+2KG NxY7I3svzS2K9LGH3fBLUy1t3Hl+c3zGFq/ll1MJrf9NswV4yxt2WmISfM/KDww8 yELkGs2cRzbw2tCvnmYlJJhIqRLkyFAbDzWRH/XdVx4=","translations":{"en":{"changelog":"2016-11-17\n- fix: one-click-play for wav not working\n- fix: wrong sql statement for PostgreSQL [#90](https://github.com/rello/audioplayer/issues/90)"}}},{"version":"1.3.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/Rello/audioplayer/releases/download/1.3.0/audioplayer-1.3.0.tar.gz","created":"2016-11-15T18:11:19.539636Z","licenses":["agpl"],"lastModified":"2016-11-15T18:11:19.592881Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=9 <=11","signature":"lbp7wd3JhMHW5mC8kVnQFvcwzf3aTIhYhq3ak/C/vfDXJDIPFuQ1odVRWtaHXEKQ XmKYIoTobV1TAU5q9G0O0Kds73T/XtHG4ATLxMZE8RsUWNSj5v3H4YDub6A0uoX6 rzyLEYV6SGEtdPFMwLcUjDExKpzAzKpgxcd9uyz2NhcHJEO8FJmirn34bm69//TO vjjiMW4zpL+dho+7LQbOX+L1SmwmdBqwypE9zzeuIuhUWDEQtImHAvjIO6Temajm lX0H5JaowJa8kvP6Jkh3KAvsHQ4sJklvWTPGcv0gboN+o6CmjWNOb+3LeSH0nhe6 BmiPloUDJcPQwq2gQejH2pY+qJEdRcULSKS09/dRbE3gOSlG36FThN0INpv6uNP4 qVIiYs3/SEHMmlS5CHvJDt2S2XN9LT9IX7QPeuS/0CMcuopaG/+cdC4KscVCq4D4 bllgew9asiBqix8iV8C4oerYOiC5vWcgBrZhGShoJT1Qq+NKz+H10dFgjFCAZuPj nVagJkbXmf2NdcvpSC7qsufhyEZyCSp+I7QEYsbo1PW3aUU35Syt47lgeVFX0hVQ jC1wMIhEW5Rm2nCkRSZkRupKDQ+N6uWuB0lykeMV2ShcDvvUZrhN3c49sooWgigB yIqKryzM4fLErjjNHdYgwCq6bbgPDLK3ic9b3B4rF3E=","translations":{"en":{"changelog":"2016-11-15\n- fix: handling of temporary scanner files [#68](https://github.com/rello/audioplayer/issues/68)\n- fix: simpler analysis of incorrect files in scanner [#57](https://github.com/rello/audioplayer/issues/57)\n- fix: album sorted correctly by artist and album [#80](https://github.com/rello/audioplayer/issues/80)\n- fix: neutral cover for unknown album [#16](https://github.com/rello/audioplayer/issues/16)\n- fix: error message from ID3 editor shown in front-end [#77](https://github.com/rello/audioplayer/issues/77)\n- enhancement: occ support for library scan and reset [#72](https://github.com/rello/audioplayer/issues/72)\n- enhancement: select a dedicated folder for scanning in personal settings [#79](https://github.com/rello/audioplayer/issues/79)\n- enhancement: exclude folders from scanning via .noaudio file [#79](https://github.com/rello/audioplayer/issues/79)\n- enhancement: significantly reduce database reads during scanning [#79](https://github.com/rello/audioplayer/issues/79)\n- enhancement: cleanup of classes; move from \\OC\\Files\\View to \\OCP\\Files\\IRootFolder [#72](https://github.com/rello/audioplayer/issues/72)"}}},{"version":"1.2.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/Rello/audioplayer/releases/download/1.2.2/audioplayer-1.2.2.tar.gz","created":"2016-10-06T21:21:05.414691Z","licenses":["agpl"],"lastModified":"2016-10-06T21:21:05.483224Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=9 <=11","signature":"toeS45z50Lm0djgrQokOTN7gA8a113IZtiKKiLsGUKWrCV/6AKJBmEFcSun6rhLH\nbz/RtIdFKwQql6O3E0m1Zch2y1A8aLWHzFTO+5orLCVi7y15SshrJYbb9aI5Pj3i\nSR7+kMHGS8uNx2uIn3B4mO6UYF8AzCfp+ule18DOjnpu86KWvEOGtFXsQkLtgepp\nbJhOGWW/uOVIos/T1xPP4GCmtVmgn7U3b9q0pMYRH7ONXEiNsfQxDrR66EZH3Jfo\nlVyM9UvQmMKoDSdBUlvLlhCEGJGqFOD7hFntLYloI4oXv9uGqcagaJVh3TkEysY2\nMbBZpVhch5zRJ/HGlZOvmEzZ8Inxkk3iap+JmJ5/gZTefwfKUyYHALsILlh820U2\nNA/1B5A015XH5a5uflGE/tnlPtrOeecIN4mg+1njo2RG89HJWJNHM2ZDO4SkXjSR\njgygmAS5aR5+KKifiA/pwjhLozDWPU4lNzsj3Foz3bx3Okopy7eq83LORqieT4Jp\nFvP64q/45LOSRBWIWLitYzRzZp7HYywMsnz12WpxtqxIjO7+7y/ByeWWOBNU1IJC\nK2D+035ZGWZr0CxDJte33WOISwjVoSwrcov++O3BQW8lM5IkcDNcJFyzNPKAXcQU\nPUXmQpYurHoIw6odAYcbrG6iOiSesuNOf2kQWbjV3/c=","translations":{"en":{"changelog":"2016-09-18\n- fix: icon issues with alternative apps folder [#65](https://github.com/rello/audioplayer/issues/65)"}}}],"screenshots":[{"url":"https://github.com/rello/screenshots/raw/master/audioplayer_main.png"},{"url":"https://github.com/rello/screenshots/raw/master/audioplayer_lists.png"},{"url":"https://github.com/rello/screenshots/raw/master/audioplayer_share.png"}],"translations":{"en":{"name":"Audio Player","summary":"Audio Player for ownCloud and Nextcloud","description":"Audio Player for MP3, MP4, Ogg, and Wave with a lot of flexibility for all your needs."}},"isFeatured":false,"authors":[{"name":"Marcel Scherello","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEBjCCAu4CAhAIMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE1MjExMjA4WhcNMjYxMjIyMjExMjA4WjAWMRQwEgYD\r\nVQQDDAthdWRpb3BsYXllcjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB\r\nALyC+iLscLs62NeNmUXEBmg+xMuUtDmZKr+xzJWtl6SSNRz+8K1JygvUIXFJ3RIL\r\nCYA3xyq8/wyZH1gNrLKyz5eTeYawG+eT3ges/FT6MWGUbZoRrBrikVcLC94QzxTH\r\nxOl8Dn+SCV/2bhcvPTQdhK+dqtvGilOtjHa40iMrk9gSdlKVys5CK/xdlEp8uiMa\r\nkz1WENn8MVCCJV58bAUbaCupDWXR9CCoSsw8XinNsCenZ2B2XlnmbM44280w0ojs\r\n72rfQRgj3yDG+ZUUyUOuxIuodu8liXYciLf0ph6t/f/qoSmctbBdsR5Fl1Upj1Ac\r\nqeHb5Yf/B3Vi6Mn3XfDx0H2EHk1v9Dhzxay+v9BHUzyIX2iH/q+7TE0/Jzo5AwBW\r\nvFKWXvG7wXaALcHYZf5v/M93IE0iCHsv2EsZKQPBnzXVGmp4DwFSP4po1B7hcog1\r\ngAMaellAzzvUAizgCovN6Qct3qDEANYniPlvtnlcaQGonajW4N019kFQRHLIzPFR\r\njab5iUMMwSnT8FhZO2ZOWuWhJven+gXjxC8mfMVgBfZnAVgydNfx9rN+KzTc88ke\r\nobUdZ0OOeBzA7pIxGEFg9V6KTEEWZ+qH048vxXz4HI9B1I+2wQLBrZl8CvweEZ5U\r\n5ID8XrrE/UaNZ1CvLKtCgB24gj/m1Elkh7wA3gEcEo2JAgMBAAEwDQYJKoZIhvcN\r\nAQELBQADggEBACtgUp+FCmjWIkQUuWSdzKWdO+IH4v9wBIrF9mo0OLIakFyDYyM5\r\nLlkYZXbplGXd4cfn3ruIqJNzlIb4xa5CU0bM4TMbD4oOSlLMKM/EamKPHI3bzr++\r\nzi7mQDFxmAE6FWSMBgKKUb4tqLc5oBap8e12tPEZl/UR6d9iUB2ltvrm3T3vrjjl\r\n2Worm0eYBNqnagXmX5+wS11AQqeJemGqRy5e1yXRlTgB0IJhH0dCsFNwifEigutp\r\nFNvGFVBn4r5qCiChEoq+rCXHRjPi/eCfbW21XeLFDiLxapcZyc85JIcA7znUYoFe\r\nP7Y/ekMscwWhLbF91OaQlcWpRtEMyde/DaI=\r\n-----END CERTIFICATE-----"},{"id":"calendar","categories":["organization"],"userDocs":"https://docs.nextcloud.com/server/10/user_manual/pim/calendar.html","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/nextcloud/calendar/issues","website":"https://github.com/nextcloud/calendar/","created":"2016-10-01T12:40:39.060903Z","lastModified":"2016-11-22T20:31:13.029921Z","releases":[{"version":"1.4.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/calendar/releases/download/v1.4.1/calendar.tar.gz","created":"2016-11-22T20:31:13.020268Z","licenses":["agpl"],"lastModified":"2016-11-22T20:31:13.087340Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"nThwe9CJBCan9nuDLdhfBiQyPhmum6Aa0UcYsIDdhGMw+C2acf81KhEmBJuTTWxo\nWGby6WcrcJJmeuCW+ePU91ju7Pd76RirprhVXIEceIDzSCxin+K0oZCZ1IGVIJjP\nIkVehTsLuCeTBbjvz1b3k5QFyhUhvd32Xt7k5d7VARyI4OqnqYYNBtH9vvgeRrFw\nAxsQr4o4axof6i3iykLg6WfWarYArY4dIuu5DkPuGPWf2bbgjwWEra4sQejhOs7G\nsk1xcsfYv2NpArIbpw/wnATdjiax+Gjz1URMD3NgL5ky0ecuZmNvN25QErg3nlVr\nhh1FBfA5pvCJbkJ6nr5bU4bKaffwDX1nr5h77FS5zzn0Pyd7ZIExmVmNtaeJfnfV\n5vnclapzXMNU+R6t/ATJQd1srvSJhyljQapzsqnrjNMEUojOEvqqygJp0KwNVPqs\n3g9XGSoOnO+WULWBeISW7UVOg8BOF8pwvHIU2++bSzOdpypW0Eq6p2DPWO6qL/H1\neFLKrUg3EvnTjvknbBxMB55h9jNJr0SAlkrmyEVm6+CE3BwRWpKB+cJMBuGiwPwv\nr/ASRiJrkDThbNWAUtX70rUmCqDV6/MujLXViqOc/Q2OHvcXd1oGDccJSQT92/1z\n7nonnedyYQIDqUt7u68WL8JRxp7pFsEqKLVuWSgxW3c=","translations":{}},{"version":"1.4.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/calendar/releases/download/v1.4.0/calendar.tar.gz","created":"2016-10-06T19:58:12.724588Z","licenses":["agpl"],"lastModified":"2016-10-06T19:58:12.790604Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"b//hJbICFMLR0Va1BGMzpLpaPREOo9QhjgfrHvDOfXVpddhvCM8ocz74X1s5hKyy\nGg67EE0pOp0dBf6RyJjduI+Dz1wQX55My7J9G1vXGCN30C/8zAcKSJoA218IWcub\nICavLkz2PkiitIOSZyBCAfEiSAeHPop/JGkq3KxQDC7QwFC78BnE9/adD9tO55c/\nDGLhvP/uTJIeH8RUifikTqVMmPH+aP3uPbZzl+AxhUezRiNCpEtZPA5QGqtQdJU4\nFc6x3d9y4IWbJV4TEIAP8jdfqtLVUQ6szFVnN8Oi1wtN9e8LIylBSYbmIZRj0+qh\nZcgntzEq6U843ZwXcAnL5jNYV0m+KNI+EkXFeWHkjvbwfCdvGPBvgFVbhc0YPzXU\nqHOe4Lvcx9X20ALG/MacV9zX69GzNnWgbBp9RnIHuaSRPFEKrNXUeXl2THuKsTyQ\nF9QtTwS5U5DcMyTO2RAN45NrRxIh8IL4stoIg5rmF7/ZaOm/Jza2gnUquOTarDE/\ntiWnNW5kWUAWyYYHvQgQix/of9qXvc2hhZaw0y623WDNrEwA+rngnjDMLA/vNv3B\nhgwQ6NbCOuHWsRK3S8DcJFpB9Kj/i7CDvDLEuJYnjSTvQ/q1XqawbJPDoRlydX43\n3/L0LvHvKVakYybv2OE5gy6bQ2Dw8e7D27DtZ6XTaBY=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/1.png"},{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/2.png"},{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/3.png"},{"url":"https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/4.png"}],"translations":{"en":{"name":"Calendar","summary":"Calendar GUI for Nextcloud's CalDAV server","description":"The Nextcloud calendar app is a user interface for Nextcloud's CalDAV server.\n\nIt integrates with other apps, allows you to manage calendars and events, display external calendars and invite attendees to your events"}},"isFeatured":true,"authors":[{"name":"Georg Ehrke","mail":"","homepage":"https://georg.coffee"},{"name":"Raghu Nayyar","mail":"","homepage":"http://raghunayyar.com"},{"name":"Thomas Citharel","mail":"","homepage":"https://tcit.fr"}],"ratingRecent":0.944444444444444,"ratingOverall":0.944444444444444,"ratingNumRecent":9,"ratingNumOverall":9,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhARMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYxMDAzMTMyNjQwWhcNMjcwMTA5MTMyNjQwWjATMREwDwYD\r\nVQQDEwhjYWxlbmRhcjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMm6\r\nFTeqgzCXprkU83VM4/DrZWn3kqtfaR/edkC4gYT3ug7RHa/Uv1C/S++vr7pvgpnk\r\nYzQoavl/0Qlh5sKEYX+0ud/LQDoiidwBRDckFUQ1bRfVLxAD9UAVvDRHxDqJMOx2\r\ngZArbeQ3ztdSHZp4ThzBFWq2FILsJD86weG7LwHjzhW6SWgLb/YTLbuuW6tRCDVV\r\nbtB0I/a0vCwj2u91Chw3u6pWWjPakc9DQrIDH4HCIBKQ4zVrYDxAmJDRFGDvVVWx\r\nuIAeux8sd8drqSMqAhX+XMcZPRD71NQTWbCupSwWO8kgjmZnBpIiBNpzvMQzJf3A\r\nQloZtjZ2RDXAQG88eTeT8pp8yEOCEoDLpGdraKxJrh/z2Dsk30JP3lOiNYJ9vBaB\r\nC8NJbJ3oAlG7THwUaFF9fsdAKoTwzs5Xms04TI7W/v4Z/GClOzMymnR1T4sR72Oy\r\n3WaMNHv/1QGffvQn2/TtZt23Ou3P083xWx2vn5FgTcac8+x85vRgWsVCA4hq9v6m\r\nAlktB0+UWDEXpDTKD9BdFNWM8Ig9jQf7EJrvTLNnS7FIJZMB4GK8lpvPxyvACWnh\r\nR2hQOe987Zvl3B1JZNO5RvtSeYld9Y9UfMgW1aPRweDNjSuZYAKlugx1ZoyI5HyA\r\nQjfzAwicIMwZsCJDV/P5ZO8FE+23rdWaoJczpBqDAgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBAHQXwvj8q5khWR/ilg3JGYpmMNBYHE9OeDaOcNArkKaGMd478SDPOXeu\r\nyW7hCvNEpiTk5g0h3g3yleZFws0xH8fPsQgZANgvQXb3RCcD61NL77d0cMTr7Xzr\r\nN3Lq/ML1YLc/WwL4uV1XvpMQMwALFL1p63BU2c0ysO31zbLOjMKAJi0hHFDYz5ZQ\r\nD3xxtc17ll3B5IqrMnMHRqmOQ39Sbe56Y7T4agaIz/sUWpseo85D5kt7UAIOR+Mr\r\nQ0Bl/QinETk72afGR46Qvc7tC1t9JjQQD3AUbEGuJdGvXjJJ9GREYu01XoODmPdT\r\njXXOI8XIOK6kxXhPHUc3iWu9b4KqGm0=\r\n-----END CERTIFICATE-----"},{"id":"gpxpod","categories":["multimedia","tools"],"userDocs":"https://gitlab.com/eneiluj/gpxpod-oc/wikis/userdoc","adminDocs":"https://gitlab.com/eneiluj/gpxpod-oc/wikis/admindoc","developerDocs":"https://gitlab.com/eneiluj/gpxpod-oc/wikis/devdoc","issueTracker":"https://gitlab.com/eneiluj/gpxpod-oc/issues","website":"https://gitlab.com/eneiluj/gpxpod-oc","created":"2016-10-31T10:57:44.387319Z","lastModified":"2016-11-23T17:27:37.793159Z","releases":[{"version":"1.0.8","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":">=9.4.0","rawVersionSpec":">=9.4"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":">=5.5.0","rawVersionSpec":">=5.5"}],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/963bbf246412bcbe8979bccadb3b8d03/gpxpod-1.0.8.tar.gz","created":"2016-11-23T17:27:37.783365Z","licenses":["agpl"],"lastModified":"2016-11-23T17:27:37.862469Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"hqhMh1l/mnwbYf4uPzEjjLFtZWHidzgR57X471OuXv2K/s87T5WhIkTSKk+2r8sp\nS7CtrF5+Pc5AgCCHvwzawN3e2+4eO4cK0+HD9CCzygzzHZEbSjufNHMMQucVoSD8\nPqR6MV9azzUpwHa/5d8fp3cFLVAle+aG0o4v5eHky9c7eaKxVJcgfjw3pjDE73N6\ngJVdtw1jf1kOFYk5pZQxDfBKFDrO5BRo5ZfZGuOuP2u/SmTwj42oTZiT7oTVWhqd\nLvJw+2TPv7B8s0Gin+J5e9K1Rs6CEWQ6WBxM+NhS5KgWB5Ig3pwm0QvMgza2cvoh\nlwVobOotfKLUBJzg0+wR7B2YH9Ao+m94h93vg7H0OKPReoTKhlDj2UExoTyeurV8\nhJdQv8sKVAxjC7/xrVaGSjM4YxFdBpzq8Zl8z4zq1o2voH5+u4ko3c62C1loDpsC\n8KrL1t6A7QpMk/XAMrPqwEPmFqlLEdv6FhzpOGyt4IEVnv6vdMTShcYw3tPvU/mD\njPtiVwpo8gWbGVIfpmwBg4wPaTrWK8V3+/1iTahIQHZfu4Lebb5mzht80HLQIcd8\n+oB4cGDEX4Rix1WxnCmE5ZzURY8xQXcvqYN+mTrUDh/3OtxQPSm5yC945SGoFNpr\nBYxfEyQcwulZrOMBdY0Ssj1AB5NOeC9OHwjJrnVe7dQ=","translations":{"en":{"changelog":"### Added\n- save/restore options for logged user\n- option to choose picture style (popup/small/big marker)\n [#25](https://gitlab.com/eneiluj/gpxpod-oc/issues/25) @eneiluj\n- add average speed and average moving speed in comparison table\n\n### Changed\n\n### Fixed\n- bug when python PIL is not available\n- deletion of bad parameter given to getGeoPicsFromFolder() in controller\n [#20](https://gitlab.com/eneiluj/gpxpod-oc/issues/20) @eneiluj\n- bug in file cleaning, bad use of array\\_unique\n [#22](https://gitlab.com/eneiluj/gpxpod-oc/issues/22) @eneiluj\n- python script do not need to be exectuable now\n [#23](https://gitlab.com/eneiluj/gpxpod-oc/issues/23) @eneiluj\n- jquery.colorbox was brought by \"First run wizard\" app, now included\n [#21](https://gitlab.com/eneiluj/gpxpod-oc/issues/21) @eneiluj\n- avoid JS error when failed to get options values by ajax"}}},{"version":"1.0.8","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":">=9.4.0","rawVersionSpec":">=9.4"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":">=5.5.0","rawVersionSpec":">=5.5"}],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-nightly.tar.gz","created":"2016-11-16T14:06:33.937534Z","licenses":["agpl"],"lastModified":"2016-11-16T14:06:33.971502Z","isNightly":true,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"JtUhKRDFGYDx9xtHjdfEUFOb0O4idexUYw6ixlBhKPP8Dn7NfyBfV6KH6MJTIVLU\nQ5Jw6tv/Nr1YDOvVikcWPG0p23mQdn1+7w8DzzIGKmknxCat9/vKr83oJZdWYxS7\nTJ4I7qTvWNlbMfK8OEdl13VJXgc6ftX+1isluLYqLjEm3aBFCS+/awYNMmXO55a1\nyG0NgJRu3pw1CBCMhDaRLsunhpRNDVLsamZj1SPmeT8qy0I/arFaG6hQnAo6JosE\ndi1XkvK6TEt9g16L6eizd+JpGE7xiWFP9ZEmMmmQSOLQYwU5Sk1YWcrW3EX4vtz5\nWnEIC0SENyyAyzBO6YJfu/EP2lLnlbNJiuc4zzKLqRw/zyz3j+imJLcXHIA78ZkQ\nuyUOBkkk3xeyBGeUcYfDuBqYQOQs+F/7+cNMsIBKJhx9ef3OPURBc7X16upk3mxV\n6GsOktbHkgUwWk3WiXRriBIqbAZocvDp0+PN++PAEZVWFEZEJzztd4Fxaeo+QSN5\n5Pz/9yXYRsoSPZv82Tlh7dx5tIPUvYb+UsANh5eGWUGufTSwgYBN0H2KT/iO35D7\nkDzNyh1qNakfBhAgPjrC2p4mBKBJJjlM0D9erDwr5D4GSTW2fp92vlRHeD0X8sqo\n3kBbwGuWnmhdJhbd7zYy0jVM6tVX/zgbhycimNALG0I=","translations":{"en":{"changelog":"### Added\n- save/restore options for logged user\n- option to choose picture style (popup/small/big marker)\n [#25](https://gitlab.com/eneiluj/gpxpod-oc/issues/25) @eneiluj\n\n### Changed\n\n### Fixed\n- bug when python PIL is not available\n- deletion of bad parameter given to getGeoPicsFromFolder() in controller\n [#20](https://gitlab.com/eneiluj/gpxpod-oc/issues/20) @eneiluj\n- bug in file cleaning, bad use of array\\_unique\n [#22](https://gitlab.com/eneiluj/gpxpod-oc/issues/22) @eneiluj\n- python script do not need to be exectuable now\n [#23](https://gitlab.com/eneiluj/gpxpod-oc/issues/23) @eneiluj\n- jquery.colorbox was brought by \"First run wizard\" app, now included\n [#21](https://gitlab.com/eneiluj/gpxpod-oc/issues/21) @eneiluj"}}},{"version":"1.0.7","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":">=9.4.0","rawVersionSpec":">=9.4"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":">=5.5.0","rawVersionSpec":">=5.5"}],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-1.0.7.tar.gz","created":"2016-11-14T00:57:37.521001Z","licenses":["agpl"],"lastModified":"2016-11-14T20:35:45.363487Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"SigBof6QJZ9IMZyFgc+B3LO2+EXaAPvnxUHjJQjIl3jLzomocpDGR6WjO6gtvB81\nzXUHjJ8+huc+P9TvgjUGRTmn9a/29HZ4IKTXnYBKIUY7wSLcJNMbJSp2Zd3OFHAG\nJwRaEdh/cIRk2X6NE1VT6dFCxB+LhTM4BXOEwuNYQvU1lZDVQgTz/r68zFLWBt6R\nqhBCNJHrVp87ecS4+XaGq/CfT4k1ihiOv+f4eX9iaPzUhxBJ71iYKF7wHpDoVmIk\nNrzWFUJH3BLBuW9oiC0PApli6Xu5RXrWUsOV7OAmxXgylRCPuTFwe09hw16JMbiS\nii8WFiUtp4qW53+7eoS7Fllm7CRi/Dg6Jvjtp3msrf1m+OiYM7dLyoKw22/S4P/a\nBIErZpSCHaCfrZ+DBXrAYcas27GWE7HizzG3yXk3aDJMa0Otcsq56bSPo01JDfNx\nm1y9iuwmlon8zKKoxsJCwxaFDnQpqazaLcUO0ATHUk8LdomTA7MCXVvNFPaO86Ea\n16iyw7Cfs0k3GrvN71+SdpvWss359CEEwBMpDwJZqwSFbLRyHtogUgbRWLIJqR4n\n5uVvJqirxWkr/EtXw6UkDWAI3ZoMhMRtjn4H4ekANP5mC8R0yp+UuFs2RkEC5uA0\nKzzh73WmxmpeUl6jcMZ49gXn3PTCC2fJNrdmSYch5Dc=","translations":{"en":{"changelog":"### Added\n- option to choose waypoint style\n- show elevation, lat, lng in waypoint popup\n- ability to display geotagged jpg pictures on the map\n- pictures slideshow with colorbox\n- pictures work in public dir link\n- use NC/OC thumbnails to display pictures on the map\n- options block hidden by default\n\n### Fixed\n- fix bug in geojson generation for waypoint-only files"}}},{"version":"1.0.6","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-1.0.6.tar.gz","created":"2016-11-07T12:11:00.619161Z","licenses":["agpl"],"lastModified":"2016-11-07T12:11:00.699921Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"WBts2fm2rW/7LMHYjcx9a0k0WTXV6PnGRxTl+158cjfV7ruMpNvhK58iTjrox69k\nFWAoIi1wNAlLBu9Xet1j7HKi4TC9q61IEN+lPlnwBCu0uHawiqS2gqB4i8A019Ei\noLsgAPWh8ndy6+gyUtPhVLVduLH76aT6KTwAiHPknV0zPtxsUy1P6nbbNOS5A5rG\nSQBqljy0TbcjOctTudEPp1IqjJIwcd12eZ9MLG4CEIO13n53pMAsuXJf4jnKSCm0\ngimvsFOwFRjBab3ZPwtOqeVw6aIh/lYF3U3/k8YBpaDN74m30nDtkp8teXBgshSY\nVYvX3yOAYe0PIR419IX0eoHb61K0VfZYvPT4FsOqjDr0zlVB8Rjq+6SiK4vMD2+6\neGE0aHbjR9HV5jymUnFYdm/hlhcZGaKrAiQKfBY6Vh0SWKfIv7bdGfQYauePAdZt\njlsV8lIwOy7FGAeP81CcjzWWfDeBgYr+MSzfoDNoTi41MvUaT14iWPIU/s5P1/Qv\nALGxgsbmB19wEgNbdh1UtTUY3xARLpWPYdUqU7yDcsddX9vCoCG2G5wCcbYJRj8o\nC+H7wdgPJoiMY/p4Go/lyWkvmzhfXrOeXytZIFXjb3ERVd1vD9WSt1DSy/7gsFYt\nxzzOPgqMvL3BbeluNuzNv366oT872s3OuFKa1ZOYY7A=","translations":{}},{"version":"1.0.5","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.6.0","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://pluton.cassio.pe/~julien/gpxpod-1.0.5.tar.gz","created":"2016-10-31T11:08:41.017766Z","licenses":["agpl"],"lastModified":"2016-10-31T11:08:41.068782Z","isNightly":false,"rawPhpVersionSpec":">=5.6","rawPlatformVersionSpec":">=9.0","signature":"UXeZVh5f0/WZE+r/dHWc1pu9q4qr/zACX6XraMhhIuKIp7vNCwUESeqJtVc99QZw\nw9kJp0isvib6l0zbQBRS1vI7xwKKBQyeaEhIciEs1JjsaCiato1Gyi26N+fY2N0Z\nFWlTwCsF3DdlwERXTYfeCpsOWCoxLxHKhnJIjUc0PVme/Ste4zxYj+5Su1RpadSw\n4vGnkW8zy/0tzua50NQCrOg+B4jXzH9kMWAP47w3sdP5CYalHSHl8EX0D1RjgGU5\n7vZYX3wF853FvQDbL4JXXCJupj3wZe8py8McWpQIcgz1p3KmE7A7d/rdNWExT+T+\nDxtStJ56qTRMz4aFwoSFxJrrEfgHIsE9Gv+Vo7nshCUYA8gkfHeckiaUtH1EiFTh\nVNeO6mTIqGpRosFvfUrZMKcuF5j74vGQjNM1o+M5N31gtLoPSkU605f/U4v+j2oC\n3/N1rYF2SEDFO0EgAGXaXVhB0ltSDkHJw6vZJ1L8Qz6tooUMDxaMri8vycA6LHvE\nqN+z+S6TXMfLvN/6ATYPGhicrWmkMT/k7v1az/hcnfH+zRyLZyFx94s88JWF7Jf+\nI+tgDbfqTMAIcytJUC+KfdQW1ueXh5F0owrOYM6jgBRvhqj1T8s+Twgw8orGmRPe\n9h8G9Z3wZAooQvmC0KdVhLuOeIkqt/S5krELNFFBRnk=","translations":{}}],"screenshots":[{"url":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/db5af6ba7ae1cd4d22ea81d418f5c762/screen1.jpg"},{"url":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/123588561a8067185572a8d1887ef906/screen2.jpg"},{"url":"https://gitlab.com/eneiluj/gpxpod-oc/uploads/427688b80bf8428dd45bd15d69b19075/screen3.jpg"}],"translations":{"en":{"name":"GpxPod","summary":"Display, analyse, compare and share gpx tracks","description":"\n# GpxPod owncloud/nextcloud application\n\nIf you want to help to translate this app in your language, take the english=>french files in \"l10n\" directory as examples.\n\nThis app's purpose is to display gpx, kml and tcx files collections,\nview elevation profiles and tracks stats, filter tracks,\n color tracks by speed, slope, elevation and compare divergent parts of similar tracks.\n\nIt's compatible with SQLite, MySQL and PostgreSQL databases.\n\nIt works with gpx/kml/tcx files anywhere in your files, files shared with you, files in folders shared with you.\nkml and tcx files will be displayed only if GpsBabel is found on the server system.\nElevations can be corrected for entire folders or specific track if SRTM.py (gpxelevations) is found.\nPersonal map tile servers can be added.\nIt works with encrypted data folder (server side encryption).\nA public link pointing to a specific track/folder can be shared if the corresponding gpx file/folder is already shared by public link.\n!!! GpxPod now uses the owncloud database to store meta-information. If you want to get rid of the .geojson, .geojson.colored and .markers produced by previous gpxpod versions, there are two buttons at the bottom of the \"Settings\" tab in user interface. !!!\nGeolocated pictures can be displayed if python PIL is installed on the server.\n\nGpxPod proudly uses Leaflet with lots of plugins to display the map.\n\nThis app is tested under Owncloud/Nextcloud 9.0/10 with Firefox and Chromium.\nThis app is under development.\n\nLink to Owncloud application website : https://apps.owncloud.com/content/show.php/GpxPod?content=174248\n\n## Install\n\nNo special installation instruction except :\n!! Server needs python2.x or 3.x \"gpxpy\" and \"geojson\" module to work !!\nThey may be installed with pip.\n\nFor example, on Debian-like systems :\n\n```\nsudo apt-get install python-pip\nsudo pip install gpxpy geojson\n```\nor on Redhat-like systems :\n```\nsudo yum install python-pip\nsudo pip install gpxpy geojson\n```\n\nThen put gpxpod directory in the Owncloud/Nextcloud apps to install.\nThere are several ways to do that.\n\n### Clone the git repository\n\n```\ncd /path/to/owncloud/apps\ngit clone https://gitlab.com/eneiluj/gpxpod-oc.git gpxpod\n```\n\n### Download from apps.owncloud.org\n\nExtract gpxpod archive you just downloaded from apps.owncloud.org :\n```\ncd /path/to/owncloud/apps\ntar xvf 174733-gpxpod-1.0.0.tar.gz\n```\n\n### Post install precautions\n\nJust in case, make python scripts executables :\n```\ncd /path/to/owncloud/apps\nchmod +x gpxpod/*.py\n```\n\n## Known issues\n\n* bad management of file names including simple or double quotes\n* _WARNING_, kml conversion will NOT work with recent kml files using the proprietary \"gx:track\" extension tag.\n\nAny feedback will be appreciated.\n\n "}},"isFeatured":false,"authors":[{"name":"Julien Veyssier","mail":"","homepage":""},{"name":"Fritz Kleinschroth","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEATCCAukCAhAaMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDMxMTA1MTI2WhcNMjcwMjA2MTA1MTI2WjARMQ8wDQYD\nVQQDDAZncHhwb2QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCq9p5l\nzNzR98l/xPgrplWrGQBhF6aQSLpnIyCdLAYKk+CmXn47W1pHh5CRYyCCyB8YPBBG\nTwbpP69pP1updfK2vUt+ShYmCXLxOLB3qEdhnwgqFfwpC48Ocev9d6XcacYp7jwu\nRNtv0ocMkm5o0TWWupcutQWkmqzCVq+OkrqM0xrf3mfPymuM6edEREshukoL86Ei\ngTuMMGT0XO99LikszvdceNQYEATix1MHzSVhkE7jHCNBXb95H6nQGr0v7R1MIbrI\nGFlgqxwwNNKwBFNfPMWZVnKwz9hoIwW6WOuu7ntwVcPqwB/gUsRZJTu7EjIW0trX\nnhA6xLlc4X66W1sdUCkJOxsV+Y21akz6wynI0SzIfjALLI2Ls4QWrPM8GOX8nPVM\nm+Y5WXzqLJScdWYoefFJKS7kxwUJRewREB9ykCG5OdDubV+Iu/6jh6HWx3h4p3ih\nqkDypPWoxpfLgA8VZkLD1RRKGkRa858QBGdF/RHbYT3JfLEp9l9gJVKZE/yw7HKk\nwsZ/T6CMpLyorpd1XWtp2wLX8lr3pp9ecVDOdAMSqD2thDMDsZA82JrJ/vITwkCF\nBlqtDZmT0UnpxYNYTfYBam5Cd00jsqCt+Hr+QkODNe8Yae9c/D0zE3h2Vt7g9H+W\n7Ei+rF5nDYTBAApoETxK7+aUZpycBf3THAJOcwIDAQABMA0GCSqGSIb3DQEBCwUA\nA4IBAQBbCGAEwg3M5QJDMnZgu0zNOH2f9bamAS9ksyCZqzLoeQic1W7GYYe9NqAi\n7lO5jXRZpTN4L133IUQPtxCxuDooD2vFmCne92tLxJbc7uqlSVfhL8uMVOlnrA99\nKTAhySTZU5so8/OibrngnBmcdWwbhaWoCQ671M8aXM1wg2FVYDqB2GP3RvbpW11L\nOc+4tfh4mO4TwXygf7KYMOJyJW8mNNY7PZ+XW2Qe3vSXR3DuN8H8fgMh5wppXPJf\nE0+yNs42hwFjSojtI8BCb0s5DTleaakpDo8HQGNzEXP8tBlUYudtjzdP0jxFXbFa\nsT9pcMdeJ0/t5HqJSx1EjUCLYS4y\n-----END CERTIFICATE-----"},{"id":"ownpad","categories":["tools"],"userDocs":"https://github.com/otetard/ownpad/blob/master/README.md#mimetype-detection","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/otetard/ownpad/issues","website":"","created":"2016-09-29T15:58:52.814912Z","lastModified":"2016-11-19T17:37:52.278497Z","releases":[{"version":"0.5.6","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/otetard/ownpad/releases/download/v0.5.6/ownpad.tar.gz","created":"2016-11-19T17:37:52.234684Z","licenses":["agpl"],"lastModified":"2016-11-19T17:37:52.423930Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"dh+Txg1iVfqXr8+cxplNQuBZGErSnXUo0ewGwnybNMJqp8/EjEo72+zPpW3dVnhY\n67YCvhrm2bo+VRdFFymEfymzSJu9nWVFkGJhEwvTxPyIdAtuD5YAVrzmnR6L+H7m\n7Q1nXE63ICPCAQpHkxIfIXLh25OhWeyofBB8AVsjDUNn58FEYJ8fFkr6dCgPriZS\nsM2J+xtZMDYufy+xFMsVf/Q3WopjFuBjMC3qOecW76ZTwtREaswOC2RtpzUku2r1\nsogrfFlFer3Ii9/CWgOktnLfjB1DzbTwdEkM2xNVBRJgdMXt2VLA9FsxFFkjmr5A\nl7x9cNLWA8RLpOIpIMBbaef75u5HgRBvSvq114UsA9GCu/EYbIgD8YxEt7xuKd4t\nenksJB5gJ2IQNdHrPbsil59AsJ/dismDN6ktYgWQEk5dINzvm9EAvucueW0Gt+Jr\nqEC5WBgJucsFxSvkHh52v43M8jgPYBfHWEL/M/+377z3+mbuIh+BcQ+vcDdiqxTF\no3n0+gw3QYIhLEe75sUhxG6ynVUdW25AKKju1kVj3KJnZTBH1R8t8/zy4DnJG8d4\nuRGqyU4BXpZjEC3nVlsC7vCncWWhxl0WZQ/MWKqsfjVAU4I88E518D6NioqMnPEJ\niCZ2x+69UCDEQyfCSKajgAYT17r3OhZei8F9KSCH8Vw=","translations":{}},{"version":"0.5.5","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <11.0.0","minIntSize":32,"download":"https://github.com/otetard/ownpad/releases/download/v0.5.5/ownpad.tar.gz","created":"2016-10-06T07:51:05.278637Z","licenses":["agpl"],"lastModified":"2016-10-06T07:51:05.348825Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=10","signature":"nYsQ9U5r7uXwtcquaWGm2XMJBNYCcA95aUx9gLZ/wEmjCHqId7+MzcCdBnom33+j\nat2XR2a4R96UAUP78bfSC4Yb7nPepFT51Y8CSpV3mDT85/+SgJdq500fXldq+qGY\nffXLneadAztyOfZO9TXljaCLdREYI0LJIGVENsxBQVKM/eyGIuZO7fF70cH5vbfS\ns37+BXB+fxcDTlP2Xuulra8HsNoS81bzjsdVMLM7B7QwwO6rZ1zd5c3UzQ1LmY5g\npQUBNd0KjfHfZ6+Fd64XZO6NGfgucGNmL3lgxdsfUqKiLtikvFxK39dYW5MckV8p\nvLoS2nZ7cgETQmAW9Ahn3ro7gXWcPxzL41oWtZOOHRRC2Yz5zlZ3Bky1o+bF9g5a\nYdDF13zV6utUkhlplZhWbjKaXa04rzOvmut8Iqhx/tmDtZRYtaQXJZWutVJYtPC3\nH86uJJnUHHNFHeoT560mp1Hq0dTeR+G+yWsPacPD1rTYgZOUVEtj3Y+YdbTODR2o\nOdGzeYFl+6CL/OcY4wPGRUCTFwvc31lIUd4DK5SPfN+IGtuuXhAqVhwy6lpkcKRs\ncj8sBoVXbMvEtMnt5uARBvA4tyVffUL4oyoIsUnvXz4u+q4WVt3T17swLm6HjGVC\nNVqU0srHN7EeBRhHlXP1CrKQWGQlS4k9j9Li4Iw+X8s=","translations":{}}],"screenshots":[],"translations":{"en":{"name":"Ownpad","summary":"\n Create and open Etherpad and Ethercalc documents.\n ","description":"\n Ownpad is an ownCloud application that allows to create and open\n Etherpad and Ethercalc documents.\n\n This application requires to have access to an instance of\n Etherpad and/or Ethercalc to work properly.\n "}},"isFeatured":false,"authors":[{"name":"Olivier Tétard","mail":"olivier.tetard@miskin.fr","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEATCCAukCAhAPMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYwOTI5MTU1NDA3WhcNMjcwMTA1MTU1NDA3WjARMQ8wDQYD\nVQQDDAZvd25wYWQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC6CY7I\nHRJTaqDu376vt+kruX+QOL864joScxRuh3IOVcQktCvxasuA0EtrX7TCAQrV1tBK\nfkqJxU9uOV54RTgyh30yH/ZtnF2bYQwViGM06Snc0riqWydFrN5fxK52dpZWs63o\nUFCNhHxrX4aUGyfXu5nQMISLm4QHoZ3LDLofk1ZsiK62fM/Jz8N2PM8qeHzf1ATo\nSKcAOd3UeaS9C8bv2DuiZM7unkSO/tjrBzkMiq8ds9sIzBBsyk6BRh2HQjHPOtmO\ned+pS9mIZmc2xhssXoHL4IfZwTqwhktpsaTl7v0ROw2dwDATz/QoKMkUpboQ5lkz\nwgLQhoIZw6uAZ1R/Qjze59I3iU8zIo9quDarHBotZNXboYCmg9FRfE4mHtegVaa8\nv1a1JvFQ5gvsWEsKSV6Bzb65GTp4KG4q7YnUrzh6HJyDCGLvLlWm5OWsFj6sNzXX\nwLOv6JLORMbF4ZIo2iybb3x7gdfCu9JxMZ4JtOUC8KSJ6+ub15C1Aia3lN68dNts\nY6KwUF1Ted0o4OQPAulq5pUc+g6dTYmIKsavIiPKhMtl86AbUK50vRTeuGdFsT7X\nav73IanPdFI9bKth+tajgvB6dxcVnvBXbrsLUyEcsxsxtBJvQcMYS4aZ6ZJYLTep\n7AdK0Zt1iMdXB8+4PCps4rcG6bYB/uJeEAVm7QIDAQABMA0GCSqGSIb3DQEBCwUA\nA4IBAQCM10O+sCYhIExnx01vGzKlnRS7MSQNx8ZMmbR5Elfz4AVJAEJ96ytS2DXH\n2c+hcD0wAenXQEFk920AEqFQBT8DP34p0FmF83aMHW08ovzFiu4MdlhcqrLnko0h\ncZTXHVyS/8JZh+o6SVm8R0/BBLF1MQQ5TqRkJehbmk6gL0+MSYxehUDKWTjJITkR\nifneTw/Ba1d0AXBOq0c0HFyGxMPIlWe4qn5LtxH5t0wyVGeSj4jyv4nvd3ZGuAgY\nEUa2uYht/z475k4+vf0YhV98iQH07GnmlfD2TDZgmOCQGKlNfJh1v88OZyLLa3dz\ngRHzGwKbAiJ8T8bbpZ3e2ozXxADr\n-----END CERTIFICATE-----"},{"id":"announcementcenter","categories":["organization"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/nextcloud/announcementcenter/issues","website":"https://github.com/nextcloud/announcementcenter","created":"2016-09-14T10:38:53.939634Z","lastModified":"2016-11-24T11:21:50.324839Z","releases":[{"version":"2.0.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=10.0.0 <11.0.0","minIntSize":32,"download":"https://github.com/nextcloud/announcementcenter/releases/download/v2.0.1/announcementcenter-2.0.1.tar.gz","created":"2016-11-24T11:21:50.317635Z","licenses":["agpl"],"lastModified":"2016-11-24T11:21:50.386203Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=10 <=10","signature":"lmqeE6xBqUJfhuXPbjCfuWiIP0FEB4V/SsF/OvYar6rLpvDpJVf3DJoeIoxXurRP\nE9/xCcNN44P8PreRRDnFLCa0XsKOtwoGa56Lxk7IKvtiQG6xu4J6PKM+q/tIeF9K\nakw0LQXtjZB5InPhnCDDbY5YS9jgGEBylSHsgNgrElipcW+BzOBu1Amw4FECVlQw\ncQ83bio+YPZvsnE5+v3/bAx0m6QNxfyN9Sn6rMEqRkY3jfA3vejXGQH/XkputfV+\n5hOz48KbOVg7cKxg+ieJlSwC0aYjb+RXiopjc3icCoIF1llltOOeSsVYSflOb080\nupociPgQ6qIab/VNNXa2YQ==","translations":{}},{"version":"2.0.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/announcementcenter/releases/download/v2.0.0/announcementcenter-2.0.0.tar.gz","created":"2016-10-06T12:41:56.195206Z","licenses":["agpl"],"lastModified":"2016-10-06T12:41:56.263124Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=10 <=11","signature":"NVWYz73KtuoZ7ti2sluztJO5aFUc7PzhlDcg0VWyAQd1H7sk5wjw7i0bhrjw8O7M\nLsrb+PegnsL9eMlYM2WrRom+RF1PDP482xymZf1T8vh8qcTCm3TK89xSuiSm8yoA\niWUb/Uv/ODj74wVDWqWxAFKaAG/FestCB3InOOZQqQZLzlAV0U9ziYDGNzBjFqof\n9rLNxJ2IOqZOA7hhMIKhSrpA0KkSfNhBsVf8CWClYnVkZQiq0LoYkHkHIlXmXUr3\nOfQFKEjtsx+bNLa6CkAaocHGHJXAofX3GQZ9cjBsjZqiTfbXfcVk0kRfz7pwL92L\nI1McfJYvgMxDQG5bjRpNJw==","translations":{}}],"screenshots":[{"url":"https://github.com/nextcloud/announcementcenter/raw/stable10/docs/AnnouncementCenterFrontpage.png"}],"translations":{"en":{"name":"Announcement Center","summary":"An announcement center for Nextcloud","description":"An announcement center for Nextcloud"}},"isFeatured":true,"authors":[{"name":"Joas Schilling","mail":"","homepage":""}],"ratingRecent":0.75,"ratingOverall":0.75,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIDDTCCAfUCAhABMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwODIzMDkyNTQ0WhcNMjYxMTI5MDkyNTQ0WjAdMRswGQYD\r\nVQQDDBJhbm5vdW5jZW1lbnRjZW50ZXIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw\r\nggEKAoIBAQDPx4Hp1HdBo5v7bDEiVcv2UrVjNW+fPPKS/5rwbagtPcE/1v3WDcwX\r\nvFwaXk8qCn2UpPSQ2b1rTuTDm51G1ZmEZhNiio+rBfEe9F+3tLsq9lElqIPKhkAq\r\nEUVI6dcN+jSqvLmLhuwloEoQQSYaLrX75mY3lGqTb83h1l2Pk/brVixuVf4vJW31\r\nTgeieuGKnC+keLzKOrvTHffJakU8ktwB2Nuu1o+jN5a7u1bxKkP3LjEWPjq236hk\r\nAoOcW/wi1dUEyUKUZsZQeJyvTJh1UXdLHKwYywtUu1/VLZ1IUtNyPBfiQ8ukPp3T\r\nTnSSmG3ZnvsfM6DmAvLZ8bBQkMBzEcTLAgMBAAEwDQYJKoZIhvcNAQELBQADggEB\r\nAAB3i2NgiZ4rpNag7cXYdaFxAxdDWnke1+LX2V2R3hzGmx73/W6cKLpo3JBn9+zT\r\n1aEjlqkt0yHu4aAPVYQzOa5zIV8mjP84p3ODSyV9J8lfjFNXT7wdA8+9PVx3lVki\r\n2ONoCNBh1kOxnxI4+BsMlQfF00ZbBSuGcMm3Ep3lTFWXzuUn3MQITzPwkL5LkW6a\r\nsli/yAYQRTVDsXD8A3ACYT7BG31jGxyXtIHzqCci0MhZFdKKayMYkwfjZchIUtGN\r\nJJoU8LQoHwGRtp3wutk0GlFzpEQEvSsn/Lsvvot5IfIe46tnzA6MVj5s64s5G8+Q\r\nphhXFlzXqO/VxquPdbfYjvU=\r\n-----END CERTIFICATE-----"},{"id":"ocsms","categories":["tools"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/nerzhul/ocsms/issues","website":"https://github.com/nerzhul/ocsms","created":"2016-09-19T21:56:04.745481Z","lastModified":"2016-11-11T16:29:55.864273Z","releases":[{"version":"1.10.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0","minIntSize":32,"download":"https://ftp.unix-experience.fr/owncloud-sms/v1.10.1.tar.gz","created":"2016-11-11T16:29:55.856768Z","licenses":["agpl"],"lastModified":"2016-11-11T16:29:55.947926Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9.0","signature":"hVzbkmmtJCtiOkZGe1mkWElqS3IPQ8wLtSzikVvoKmcg+Zq3YLQjpQWzy0t3UVjo\n9I/BfnL0bF+kjtGc9xF6M8IQaFqPrfJmN+lNT8WYIKLI97TTsLmJGg8Q8PAux3nY\n8/NxMjWdByMw9nVBClKo0o9eSW4+EnaUSJ62Gl/XWjq728kbB16WZm+iesk8LjJJ\nqqAgczWGwz6lkZTCN5o9n0a/YoLJTf4iT+OItHZyS609Cqaxx9CAmZPj/Xn5g1fm\n8hqO2ITAXLoBj4rYS/QsZTMcubtGkJ8fq3XYKVSv2UXZfvGsNWbbGV7puKN33uWJ\n5MrdoMlJ8XnJRPDlCBcb00LY+AB+hAMooLnNy765/Ew6ztp4KNLEPWGG+Ut8/Lkk\n0jIULl1RF/FjlW8P26NfwH36K30RCJFY06OFcWnxGBkkQaNFORDIsKcqTAxkl4x5\nnfKBkNdQZppCVfOSKOZj4NkWfWx75Ouq1S0QksmOsMZoOcjy1TbBKR8h6dt9DQub\nWpYBL0QwyQShGp0Vb1qCKkP69ZQAHVUJNzIFPz9LyoguvFyv8iZmAPLYDnFBvlf2\nnSHtA19rnJmZ4H7RJ02r6BdkstxISvEiHU7RLjNQxcb+DptIWX5C03wH87HTNIhr\nvptPorEoSY1KwW9fqUvvLE/c+vfkr5cvIEwZlyVKVXU=","translations":{}}],"screenshots":[],"translations":{"en":{"name":"ownCloud SMS","summary":"A app to sync SMS with your ownCloud","description":"A app to sync SMS with your ownCloud"}},"isFeatured":false,"authors":[{"name":"Loic Blot","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEADCCAugCAhALMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTE5MjE1MzU5WhcNMjYxMjI2MjE1MzU5WjAQMQ4wDAYD\r\nVQQDDAVvY3NtczCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANqZVIzM\r\nwBJuacuvgYKr2KnXuYhjKjZ58nfspSebsaGLr0ifBbo8L+NH5eaynnLCNhpegmu0\r\nO8D+KrbM1LtIkcdg1/eFpN5dTc6G2OAc9H9stmHs9nroF6MNhszgdZCz8Q8xkSoD\r\nGdSm8hdPg5GcfLrH27UilGtzdQlWJ1DralLMt3l+SfGJo152c/dc+e6SuT8+EbY2\r\nCeLdH5ImasXNpUgY+tAoEt2ZvhBrUghykBJTJVOjwL1jGLT37ybMtV4FBKo6hpeg\r\ntq/YzEk1ijBAC4pmoNWixDKCdolpVJVz0fijI9mlda3llurcp8eMhxfYJ9soXLHp\r\njvLX02YY6RfPcyy48uWVk4IEt9BvZWEVAAp7hCGA2yXrVSsR37E6sDbLsBcKav9A\r\n6dkGAgfmGkr2WT6O1/EhK/MakmnYO4WD1B+E7PnxtP/wOa+aQBmntQcd7igDiwzG\r\n6h05NYAWcRhqfZ4KWYsq0t0SezMbuHOhwzzi22q8wijC5YZbmhKSh+b3N8XwYKDi\r\nZaw+fSahPbRWaLyR3wn9zh7vKCwqrG3ugrNo6CtyoACAnmxKZ97ROFJIQTe3ndLL\r\nmv7Wy8iCZLhRYUaW/GKrF11AFwBVec9xmvkgU+PIKq2HSjwi9sCF+pFyhVjmq29C\r\nmZEPKUV7ySIpNHXpsXm8kTJJfqjSdb2ECbLfAgMBAAEwDQYJKoZIhvcNAQELBQAD\r\nggEBABvn97e8Nw8KAscf6FX/nZ99rEX+3IrZxTC8fmBgNwAvlbF2A+QZQcFI4G9/\r\n85nHK117+u7XDuwWl4QG3flWlI0hDE59Ud9Bd4AiTQ12VoXlNdYoTg/mXARxVozb\r\nKYqZ+1xRQclZKb2AqW8YiGo18okIKovn9VVRAFYPYx4O3Ve1FjgfsaMlIZLiXUFm\r\nkk+2qWo6kYsdU9FABLo6izx7RFOMbnYNre5FmDrWP1Dga/U7ErK/Dilh8g9b3HrP\r\nwP8OIZhdtFWw21wDTfyqrb9EhC/tsjPVP9u+bqyognHeiMhjbVYRbSvz5o8T7Mhj\r\nbxalCt4/LnMIfMwVyIvye7Uy2GY=\r\n-----END CERTIFICATE-----"},{"id":"rainloop","categories":["social","tools"],"userDocs":"","adminDocs":"","developerDocs":"","issueTracker":"https://github.com/RainLoop/rainloop-webmail/issues","website":"http://www.rainloop.net/","created":"2016-10-20T04:17:37.217555Z","lastModified":"2016-11-18T11:36:04.309739Z","releases":[{"version":"4.26.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":">=5.4.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/pierre-alain-b/rainloop-nextcloud/releases/download/v4.26.0/rainloop-4.26.0.tar.gz","created":"2016-10-20T04:28:21.491747Z","licenses":["agpl"],"lastModified":"2016-11-18T11:36:04.619927Z","isNightly":false,"rawPhpVersionSpec":">=5.4","rawPlatformVersionSpec":">=10 <=11","signature":"nTYIVSB6mIwKtXIrKoVGsOGFflpLjed8jFem1VLQNtXQj4bztnNrdc4YaPIn0yzM\nyLpMSqRDNzdYNFuOeDiyKLPJPTA++MotLCNjEe7kxUekek+m+qzgnGBdcT7RQT6R\np9xWGecnVx94d6aA55uiRhgQRyHpdDMMLCOz1be+HvpwHy69DRFZ1+SPmGUt6eW0\nu5yS0vHCu1K22cbrVNXFKjxAOlGcIDm61oQuz7ycl3uAujZO4rZbWt55jilgKGak\new559A5gTp9W+j+TWKIcg6LIZ9zLRlGjcQrWJrsc+OBZQcqiYimSFyO6HhfT9TPS\nPof//I+dSsd+H0SRGGeL8DvSnK+NKZL1q5EX5pziqsv6nZFITpCDwmAN+I8AnXXL\nSNkFi53M8RZTOABpD2x7YPYP1cEvwrRweqV/C/oHcYnpfh7D2DjFeWwXsjeAXrHY\nhgFhPrg+7rf7g6UmJFOCp0dC9sBdyQ3KtJkv7bGqPr854r2cdA7xW0QHWQ2in9qQ\nLhIczc32ECi3ZVVgyF8zyT4Y/3MRS05oX3FHvHyt88mjni6bVaO78F7ZRSha8gHh\nNOAkku7AMXPvUCHaZP2iVCCoAViEso8GeR3O8xh2G42Ai61RLYwx8LB1+23EoJTr\nmfFuRYNSg+qAKCokXNnh+lDlwu4AkaQo3vtKGPXvU7A=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/pierre-alain-b/rainloop-nextcloud/master/screenshots/2016.10.20-screenshot.jpg"}],"translations":{"en":{"name":"RainLoop","summary":"RainLoop Webmail","description":"Simple, modern and fast web-based email client."}},"isFeatured":false,"authors":[{"name":"RainLoop Team","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEAzCCAusCAhAXMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDE5MTkzNDEwWhcNMjcwMTI1MTkzNDEwWjATMREwDwYD\nVQQDDAhyYWlubG9vcDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANqB\n5jnF9qZ/qjckt0kRjpHCOMtJumW/KiQoMeNP5nGv4ad0DS3KemOapUef8Zn7qCYb\nMnODhK7HBwPifFzI1j8bnT2hP6E0geFLb0MdN59d2NF0n4CCs1+BnepQPJ1kFbPK\n35wQRi0RDeTf/GQ+/owEVCU9a9W1P/VUXk8Z0vMoQxCXEdRqnB63SgsKl7DB9G/C\n4SYrgGor+OHVGl4ntMZhJujiM996DttrNK3iZRGkQ07L+lfUIwQ52XOhQNRdic4p\nB03lw7PpChwPGMv/EEvdR5HpCJQBJniqJbbu3Jh8bMBKTE/8fCzN3vMXICB2g3Bq\nlKkZW6fnJRGsrZ79fsQnl+WBPNSrWRLOxOfe1fyCFV1ljFB4nTH7uF3pC8ZRgJes\nkHIESHz3GJm28hn4+17ESMGHBCbs7L9FK2GY31cobU0VRntLxpSG+d9njbIAgMG1\nS7U+oKVFQhSVpdXNOaUNqhcQ3HkbQTLEP0k53A/lhLQb2+KPd8nntaELjwNyrmZg\nsVMgHj/zdlvrbguZjZFzUzDBFvkuv/5M58lNT/D1C6ufVp/R6eLsYI+nnk1ojAjz\nl7N6U8X5SXpD+Bm7+Kn1PH+bHl7cViCx8oXJXO2RhP+COXckw7BDZKtjItYHNG7M\npFwgYqWpvCu9LN6IN5a/eLqSI76dOOP3iYbaTH+NAgMBAAEwDQYJKoZIhvcNAQEL\nBQADggEBAGB0Vq0l6ndGTgNbZxSEFyBR3u3tiR3pWK81DYjsui7qBoO6P/BaGmf+\nraSwHPaBOwA9XNS8jcGLh5xdqY2p/m0dTS64xNjVL9nweWsG+FwVnPANo8C4nXdm\n9ajJ4cdg54stQK8qn1uh/xPcd23GKfYJazjYSwYmZ3pXXdzlGN9NxkeYJQxJ6B+5\npzAeVGiABI/e5URpxzz2UayRX7EE+vtpe3B84hzkLqsq0N39ZN6KLfaTyEBGLzqE\niLYeXQTV0XSRs8xVt+iyGlj7nPkv2DR0oCqRpWUFWeSBI//niDG5WxS3qg8kacSW\nfDSYhSN+IjrnIkwNtc8V9t7/GeQB5FE=\n-----END CERTIFICATE-----"},{"id":"richdocuments","categories":["integration","office"],"userDocs":"https://nextcloud.com/collaboraonline/","adminDocs":"https://nextcloud.com/collaboraonline/","developerDocs":"","issueTracker":"https://github.com/owncloud/richdocuments/issues","website":"","created":"2016-10-31T08:55:45.631429Z","lastModified":"2016-11-24T12:13:53.905352Z","releases":[{"version":"1.1.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=8.2.0 <9.3.0","minIntSize":32,"download":"https://github.com/owncloud/richdocuments/releases/download/1.1.3/richdocuments.tar.gz","created":"2016-10-31T09:03:40.389355Z","licenses":["agpl"],"lastModified":"2016-10-31T09:03:40.439510Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=8.2 <=9.2","signature":"s5giQeiU2zwV5X6FmxWXiG9LtNDeKBlFqK+hfvGNbGZ+nic77Y+AnXHodV4lb3Ko\n0C0ThFLuafaZRdp9rBIN2K/acCfCYKJewGuYErb7FlEl+P9J4OQbb9pva0htZJw6\niuG5eyeTufi5MKB4vuj4+jo9zhepOFAtZMa7o+ZCfJkt8vDBuq5AXxomEiZRtW+n\nf9PPUnq0z7DJVwINhHvvBZJlSLjkpJ6VIHAr+/ElWr8O/mDKq5S5ohbvpDcPqR7b\njnsBckFDLFUz1FX9dA0JCJEKMMfkcfGqZcjH17NdjKAxRW2soN5cEKluu5MkOhz9\nFEPKfshzbrfUIm5MaFGv6w==","translations":{}},{"version":"1.1.14","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/owncloud/richdocuments/releases/download/1.1.14/richdocuments.tar.gz","created":"2016-11-24T12:10:13.337165Z","licenses":["agpl"],"lastModified":"2016-11-24T12:13:53.963638Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"prDGlfRPxqT6LP0BsAFPwGww7P4Bngha2N4u5B6+F02N+RVOjGtTcXKqvM1KjZb1\nCo7qJvgJmjpvIvDmB+rup02i8ObfwP2ct6UdsD7ouzOWJG2sJANXK31bHyvOmQ2h\nvKu5eNcOkf+WFyFKYi51TbsfWn2+1Wge3WWujKAVcEvqtcOOz+uMWNtqzBptEupk\nE1aaRnQfTx488YB8Ubul06LIY0PNCHgGCWPgy817tOVT7JA+V0P0FFonl/PXE0dr\nWgtxRJmvGaNiFzYq+kQmdKMfayZTm3kdVgP0W52t5wp878K0i4s2KPg5lANvjTz7\nDCT+VV2IGIE52o4RpMUGyQ==","translations":{}}],"screenshots":[{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-document.png"},{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-app.png"},{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-presentation.png"},{"url":"https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-spreadsheet.png"}],"translations":{"en":{"name":"Collabora Online","summary":"Edit office documents directly in your browser.","description":"Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that."}},"isFeatured":false,"authors":[{"name":"Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIDCDCCAfACAhAZMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYxMDMxMDg1NDExWhcNMjcwMjA2MDg1NDExWjAYMRYwFAYD\nVQQDEw1yaWNoZG9jdW1lbnRzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC\nAQEA1jk29m6JykcJ2Ld0YEpjPMYh6kwxY6GysNJnfkA/th7tPWL3+vBJ9oTYyVnZ\njwAE1Cqwfa9MyBKMZ2IdfIqtT8PeWzuFP7Ib942EdxUpwwh9F3lykeGsj0h4zQwX\nF9OooiS99PfLX+JpkKm15Ujb00iLB6xQmq0+3NeOT1CTD1ziJ1ueOcxBKMwaFp2a\nPuz3F5ywqCvpmxG/OBuOs0LI3/zStXhBNbUMxBrWblr7zaVNJXl/I2JCKj8Wah/H\nXUEEGbW15fAUP1f+90eQSxpEoCZDBHXOQCTJYzySGv+BjU+qlI9/gS0QbrsiyzUf\nO5lyvi8LvUZBzpBw+yg1U75rqQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQA9jU3m\nZmD0ywO3MUsG/GLigFtcWi/p7zp2BliR+NpuY2qNFYDcsIb8ZUudmUc/cJRRctzy\nAPaLLj/d+h5RFaxjTVvim1PSe6M7urK/IMSvyUVYCeQRYpG8ZJixKTCOVIBaWHMz\nxTfc51tm9EPlpJpK6JtaWrYYoWGE3k9sINdJ4JkvKkE2CBAqVhX6ZGyEQ0bnEhtk\nRu1DXn+LW7TJ4NZ8VtLWvmW/6Kfmi7dQ1V++Kmn0lO5ntRt5altePbStCHC8bhGp\nmyBOrjhrJgLIwvgH26MYZhdiSkFzoE38nMPZdrUmUDxcPCwucWJqgzDPudguFthj\nWCVZ3TTG/2z3+tWM\n-----END CERTIFICATE-----"},{"id":"ocr","categories":["files","tools"],"userDocs":"https://janis91.github.io/ocr/","adminDocs":"https://github.com/janis91/ocr/wiki","developerDocs":"https://github.com/janis91/ocr/wiki","issueTracker":"https://github.com/janis91/ocr/issues","website":"https://janis91.github.io/ocr/","created":"2016-09-19T12:07:49.220376Z","lastModified":"2016-11-21T11:22:21.024501Z","releases":[{"version":"1.0.0","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":"*","rawVersionSpec":"*"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"}],"shellCommands":["ocrmypdf","tesseract"],"phpVersionSpec":">=5.6.0 <8.0.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/janis91/ocr/releases/download/v1.0.0/ocr.tar.gz","created":"2016-10-24T06:50:43.283900Z","licenses":["agpl"],"lastModified":"2016-11-21T11:22:21.269108Z","isNightly":false,"rawPhpVersionSpec":">=5.6 <=7","rawPlatformVersionSpec":">=10 <=11","signature":"CBJkCIiUKyf2NuWfz2zJ3grhf8p7wJes7DPV/OxUzhlxIH0Fh7K54+U5A9JOOi6f\nWPhjXG1ylkyIVY1glr/B8svWNsD4jAclpnUi1/9ZW5UPT8LnRBfTbtF9Uoj0OgNs\ntsGQYbpuREoHnjbJWTRe0kq1OsOfX44xuf8PuX43B+lpQPW4iRSSz3ZIhdPcDGq1\n7pyqQM7gdKhBQ6/tOiwd7Enyt5Hi4V6jhwhUOCYeTNiLD2V3yKL+qA9DzpXUfNNw\nLGTjcaMrifibHQIZBZWbPPMmCfMJZ7GO9oR4gWHwkhWqt0yVWAJXAHJBLd5vXC5I\njtRTXRpHO/k6Dtqem8tZCVoDE5MAC7fDZ/0XzoFiXHciP6MenVasVcXo6xJOJc5y\nGsrecNftUEhP/ngxA6lMBVkLmmdpiexVisvsavPi64i34OUA6qOuxjgNVBDwg56i\n2lOEVvHa3nn0UX7ZZoQ/Nu6Mz7J3Hx/VDlttPuWe42eeJAphyDGubT1M62gW8dVB\nD3tJOF7spnK6I3BhVLviou/zs30AIRVBDTU0Orzx78cbInwy6/vyJib2a1olAaHz\nv05SzlQRnBWM4jYBe0mA/2ds9AO6VrXGrT/iLlHemj6JYoGBM185TGewA7OJyX3a\nHSlSDqaremmi+aS3onx3AKhXykDxTRkMVarePwTzzFs=","translations":{}},{"version":"0.8.8","phpExtensions":[],"databases":[{"id":"pgsql","versionSpec":"*","rawVersionSpec":"*"},{"id":"mysql","versionSpec":"*","rawVersionSpec":"*"},{"id":"sqlite","versionSpec":"*","rawVersionSpec":"*"}],"shellCommands":["ocrmypdf","tesseract"],"phpVersionSpec":">=5.6.0 <8.0.0","platformVersionSpec":">=10.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/janis91/ocr/releases/download/v0.8.8-beta/ocr-0.8.8-beta.tar.gz","created":"2016-10-10T18:01:16.076330Z","licenses":["agpl"],"lastModified":"2016-10-10T18:01:16.169733Z","isNightly":false,"rawPhpVersionSpec":">=5.6 <=7","rawPlatformVersionSpec":">=10 <=11","signature":"uEvhHfQCrzb6z+QuOoO8rYXiMsZFkrFWEqDvTyOTSgFKvo7dVoj3EfDfaApgcKEB\nIM/SqjLSO0lNhrp8F2mST3twbvLDprKsfrDWKFE6eiH0yKl2aNB+cHWE27utARaX\n/QZBD114vbWeDnbaBa4b9OwtBXDqKJrnO1LmqSLFP8guAlVTkU1jSPkRTpmwAcAZ\nJA/aiN/D2LSGfiNp/YdeTuzU+gPINIs9dCb6+PPkyam8PCBaXUSSaW+c0lAQHln+\ntb3EXxZ5YXdjPWrpEyHvFLk1N8s/w615QoMxr5fEs1M8D29aGbcL/wu7LXH4X0Yn\noiWwIFbpfrpJQlrIFumxWZR74JXiNr9J7ijnQ7SjxdHCcrLxMdnZ2cwq4iD6PnYm\nnIojhlhPOqUIzsWYCYutLWDQbUQz9eyWbj/+7XL+5KjetUUr/MnCu6xJ27IqFbAX\nHc8KRCO+9I0/qMQ2/rCZXBMeo39MGhhkgkVl5YAKwC1IEN/jlfyVNXZwYlfcHLKj\n6aNQ4zN6gGOerWWZ8qXtOeNJN+qv0nmXUKrZdnZUAhxOdB4G9Ym+JujxJZ9yNIWV\nsiqAI9J+OIzCwv/dzZhaHadONoo/RTF+Fl6Hy56HyBtMehb8w9p8ksVediqf33yt\nFAE/tzKtNK5NiRd+8MZkq/GbocaFUv3C7Y6pLMpTE1c=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc1.png"},{"url":"https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc2.png"},{"url":"https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc3.png"}],"translations":{"en":{"name":"OCR","summary":"Character recoginition for your images and pdf files.","description":"# Description\n\nNextcloud OCR (optical character recoginition) processing for images and PDF with tesseract-ocr and OCRmyPDF brings OCR capability to your Nextcloud 10.\nThe app uses tesseract-ocr, OCRmyPDF and a php internal message queueing service in order to process images (png, jpeg, tiff) and PDF (currently not all PDF-types are supported, for more information see [here](https://github.com/jbarlow83/OCRmyPDF)) asynchronously and save the output file to the same folder in nextcloud, so you are able to search in it.\nThe source data won't get lost. Instead:\n - in case of a PDF a copy will be saved with an extra layer of the processed text, so that you are able to search in it.\n - in case of a image the result of the OCR processing will be saved in a .txt file next to the image (same folder).\n\n**One big feature is the asynchronous ocr processing brought by the internal php message queueing system (Semaphore functions), which supports workers to handle tasks asynchronous from the rest of nextcloud.**\n\n## Prerequisites, Requirements and Dependencies\nThe OCR app has some prerequisites:\n - **[Nextcloud 10](https://nextcloud.com/)** or higher\n - **Linux** server as environment. (tested with Debian 8, Raspbian and Ubuntu 14.04 (Trusty))\n - **[OCRmyPDF](https://github.com/jbarlow83/OCRmyPDF)** >v2.x (tested with v4.1.3 (v4 is recommended))\n - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 with corresponding language files (e.g. tesseract-ocr-eng)\n\nFor further information see the homepage or the appropriate documentation."},"de":{"name":"OCR","summary":"Schrifterkennung für Bilder (mit Text) und PDF Dateien.","description":"# Beschreibung\n\nOCR (Automatische Texterkennung) für Bilder (mit Text) und PDF Dateien mithilfe von tesseract-ocr und OCRmyPDF ermöglicht Ihnen automatische Schrifterkennung direkt in Ihrer Nextcloud 10.\nDie App nutzt Tesseract-ocr, OCRmyPDF und den internen Message Queueing Service von PHP, um so asynchron (im Hintegrund) Bilder (PNG, JPEG, TIFF) und PDFs (aktuell werden nicht alle Typen unterstützt, näheres [hier](https://github.com/jbarlow83/OCRmyPDF)) zu verarbeiten. Das Ergebnis, welches jetzt durchsuchbar, kopierbar und ähnliches ist, wird anschließend im selben Ordner gespeichert, wie die Ursprungsdatei.\nDie Ursuprungsdatei geht dabei nicht verloren:\n - im Falle einer PDF wird eine Kopie mit einer zusätzlichen Textebene gespeichert, damit sie durchsuchbar und kopierbar wird.\n - im Falle eines Bildes wird das Resultat in einer txt-Datei gespeichert.\n\n**Ein großer Vorteil ist, dass das Ausführen und Verarbeiten asynchron im Hintergrund stattfindet. Dies geschieht mithilfe der PHP internernen Unterstützung einer Message Queue (Semaphore Funktionen). Die Aufgaben werden somit getrennt von der Nextcloud in einem eigenen Arbeits-Prozess (Worker) abgearbeitet.**\n\n## Anforderungen und Abhängigkeiten\nFür die OCR App müssen folgende Anforderungen erfüllt sein:\n - **[Nextcloud 10](https://nextcloud.com/)** oder höher\n - **Linux** server als Betriebssystem. (getestet mit Debian 8, Raspbian und Ubuntu 14.04 (Trusty))\n - **[OCRmyPDF](https://github.com/jbarlow83/OCRmyPDF)** >v2.x (getestet mit v4.1.3 (v4 empfohlen))\n - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 mit den dazugehörigen Übersetzungs- und Sprachdateien (z. B. tesseract-ocr-deu)\n\nFür weiter Informationen besuchen Sie die Homepage oder lesen Sie die zutreffende Dokumentation."}},"isFeatured":false,"authors":[{"name":"Janis Koehr","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIID/jCCAuYCAhAKMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYwOTE5MTEzNTAxWhcNMjYxMjI2MTEzNTAxWjAOMQwwCgYD\nVQQDDANvY3IwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDDpXiwec4f\nXAT//7YBPSb4z6ZsBJSMfBq0VTL/HagjJnQ7BL+WagzWlS69IStNDqlIlenamYRX\n4B40heJIUinzYKjTRbr5UAw6MX29HibZccm/qgrk36o1XTgIsoRhmvSxbXDVIo1k\nbDOJN8gc2Gvswa8X+uOe9pfcDgAdqGxOvFnoKW89GnB01pCNT+xakNErGAFqVLsr\n2AeademAZnbxJ1cB54tQn2Bygb/7DKKY8EmFfIq6/27n9Jbph1FG9HIlWRT4/M2H\nU2pG3cCScWMEBPsW7kpfpnzLk7Q30Oj6k/rEYjJgmNYgg6oVnn0D9uRmhBYBnGyx\nMab1ilsK53lyuzQY0pmU8V5ULqpnNFAK6DVFfofEamDUhBPO+TZXEA5cZmuULRpf\nQQXmGpUQSyV6pS9WirMIqXFp9wmQ4vtjMdhu/6CP7cmtYZdq9uOhWEHbQM0mZUkb\n8hMjeItPx9XITI7Cge1JUOI8ZIwiB3USnQXcMd3v82l++/VgqHB7s5OaKPhygsWI\nM6RCoBcGiuQB5/fEUOg5ACOpGVyJiBda0Mi57AdoxdJmfnr7Bxcf2tAWIJL9Y7T3\nE1+V2BMxJOWwvVz26Cq83F41yXK2hJS+SbfQTqNUR8Cfh50CS9POvgRxNrJK9yvI\nkKle3ITRtGVM1XU0njWjnsdGg3D3O2mmjQIDAQABMA0GCSqGSIb3DQEBCwUAA4IB\nAQAbFddMbgfPI1szT57V1FKZrOrdYqQ7qjewlIQOzshGydbMtqS/9XL5hYocJCMt\nY6w+C/i6iEzO2Jx8D/k4rcZMXoVR6y3ZvO0Ke0gzSRsU+5eYj2FK1VV+cNIQW5Iu\nCYYIVa7pVPVHdeQH2Bba680bLV0HMF6b1fI9IwkfdCAinvCYZLjyEXZlmB7YjyA8\nHR7qPCNz4uG2Va7mlUHE3UYUYnlv8JFOV3YdbVL0nxhWwIdzSri5sxFIhdlabpzY\nyA1z/MCBEyTRo80jxFmL+MpwbsdbUJi7Qxlnd56zb6HHDGrLHXZTh9LXgyVbnhWL\nkxomWjIXQh4aMHQL4QF7U4EK\n-----END CERTIFICATE-----"},{"id":"spreedme","categories":["tools"],"userDocs":"https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md","adminDocs":"https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md","developerDocs":"","issueTracker":"https://github.com/strukturag/nextcloud-spreedme/issues","website":"","created":"2016-09-27T08:43:07.835196Z","lastModified":"2016-11-21T16:51:23.703819Z","releases":[{"version":"0.3.4","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz","created":"2016-11-21T16:51:23.689599Z","licenses":["agpl"],"lastModified":"2016-11-21T16:51:23.826509Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"Mhy3hXeGWlIujx1Op39MMRdqHYOo360BCwr4FPWoTNNggH3aS0gWlh48DAfGYK9W\netNiOqIuRyA0NrVlsqR2vDILgFtODJSbKPyHd3PQn3hcGsjogjQ+dkKciLNLinw7\nOhbv6aDdRFLBeRHpX/7wOnWL5W3ko/gyn0Awvi88M9+nC5aARtqncQqPy2SxDGzH\nKlOZHSNDnEQCGMhA8hNWWKdVwNUJHod/wmBWpW5QVNSJq5DqrKZcNwpGM2UUJoql\nEqUMwDXk5uVH5r5k62Tr9kguDWoUEG1OqQSyeMY24AmA64tq/HSlAdZ+CX32bc4E\nZvm+n8poJBrdSVmWEaa4ZfYaLFdOc6Kcuid1B1Sv9kPhD9WD6T1sicdzjDzcorBK\n/MLReCuSb2E8aPTnFWRoAZ4xCUGs1IXzX5fmxI8VdzwR42R6RhGJ/rqMuZRFenZF\nbOks45K5gE1da4QpkYOUQa3GVMNPqPiT3CqjmJ8tjxq7bGpb6v+YoCLACjjPpPZL\n2Y28qLxwHVaINDFUUxD75WWdrlulRbqHwiSw8jolP9qrpXhDuLAqYam9tRwV5K5R\n8uNawnFwWkicBEYkN/WtBTouWzehOPn38tHXov6SyEyD6lkuxUBZrsGQ2ru+t33U\nk0kKCbV0GFw43I+3Ji5DiB4TUVNZYVoPG1B7Qve+UfA=","translations":{}},{"version":"0.3.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <11.0.0","minIntSize":32,"download":"https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz","created":"2016-10-20T09:09:26.520692Z","licenses":["agpl"],"lastModified":"2016-10-20T09:09:26.666738Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=10","signature":"D62Ck7JUnrYbrfFlX7xXVaYUMZIh2acmykIKapqfemD/tuX5Bvb08GYGTeFG61MA\nQzsqcIylDfGnC1UJbf8yWEX7PbyJD5w/R4WlbFv34njDvM8rBs4HpzSjkqQoykOF\nZpYAjH2ydfKqtZadgoIRm7et5B8X2AeoGg11ec52DId5t1wAEBcDIv824CDBUt8t\n0pVY8Z8n1MUYwU7DCjCbPy23br2+EBODFCHp+cFfMBLg3F0BJI5nY3Q8ku+0tqMR\n0NDxQcscNZ2Ck/wpVDWylfhpS+ICIxSMiyq7urP593mRrK3399SUyaMqDfgl/pxo\nqTzdBxHLaAqcnKZYglbqp+Gxbyj4teqCod8TiSMlp90VaxhC72ACuVQQRWQKuTNI\nZeW3YweWB5d7VErqBNmQR1tGnX5YFFHiKo41fVDQFsrOqHx4zP6AeU3nkl2ol/r/\n3pg553so1MOxMkyLEhGYGMfrdQqVEtajNWHUdj3B73LS+M3jcjBFIdOD+AGXPtDX\njCRymt07c1znhkL+aT8yY5SHMVbKBZj9mExL49hcLjAYYc4U++60uq9MFH5r9g4T\ndph+yT6VVEM/UH2HjvKsHv2wm937sNgG3EXQdh79JU8nCXIz7cVrJ8f5/9r6n1VP\nBbjtfDAPEjmfVCXX2gmgLuZHV+GMhLBS9bTh+61AhhE=","translations":{}},{"version":"0.3.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <11.0.0","minIntSize":32,"download":"https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz","created":"2016-10-06T08:14:05.212553Z","licenses":["agpl"],"lastModified":"2016-10-06T08:14:05.278533Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=10","signature":"X9zXDyMBPoXPMpZ+XXWK3MLufjY2MG8lJ+93LiW3rv0iq9yd8PafK4IvP9czO6o9\nf/vNilq+1mfl6mjTvL6QF5+sySlzbRGbT3uTBwYXyYL07HVYgl1ZLrwe0kxvxqaW\nxTvPem7+HzwClI3VnWc7ylQfzGrcYIaSIg7nNq1GOHocsgZVNyj/nVW/eQx24MjZ\nuLzZs9SJqYoBGq+mo63vRswhqv5OzGebo+G6dHm0hvRSOw9qsWCDWBugiSRU8zU4\nD9PQ0e8WbyrIrQhBoUvvkuijO3zCySx606S1HUyaHmbJzMc4Fbpwz6ggmi6IRBbT\nFBKB1DWJDwN/7mY4fhS4KhircVnAHDqiBVCTu5i3pSfMPrwFymcmbn9OBuFHAFuZ\nd9PZvWQg4v32w+Q/NNvZVW5lRi+l0w5DEqNREaj79hljk2reZMaB65lvtV9NCYw+\nHmwWqsGqZ1SgGZuhYkOzEIkCfJ2fF/VpyavJ4X6bHP9yYdkt1pxnSSoZ2HC8mkG4\nBnPf28mEXRcY8EJv0rEePqKSBIhAt8yfEW+joH/8nupe1qOdfPvP08ifLad5m76s\nt23UzlSljzq9kVO+d16z2uagKomN9USZaNnJcUDVblfjvCPpdiHLfRPEJnRsDZCm\nNffFWEMcz+TWmwBboZgTRO9v0bPDEuwfCCEW0zy8rT0=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/conference.gif"},{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/presentation.png"},{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/import.png"},{"url":"https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/users.png"}],"translations":{"en":{"name":"Spreed.ME","summary":"Audio-, video- and text chat for your Nextcloud","description":"Securely communicate with your friends and family using rich audio-, video- and text chat, and much more right from your Nextcloud – in your browser"}},"isFeatured":false,"authors":[{"name":"struktur AG","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\r\nMIIEAzCCAusCAhANMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\r\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\r\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\r\ndXRob3JpdHkwHhcNMTYwOTI2MTYxNzMzWhcNMjcwMTAyMTYxNzMzWjATMREwDwYD\r\nVQQDEwhzcHJlZWRtZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKLx\r\n2dCPBLIgX948BnOdLij0YyI2+FKD6uZOvzxMaoi3rlxNf8MJgraNMzTBWEXtxT5b\r\n7ZISNp89WEXhaQ1dwwCocodd/xow4Ek63m5nUvTZXsm+YSbMgrFbxzsBhYU7KuIE\r\nT/jhKdzYgemzErwwN/gtwkLMfPo3jkgg6c8NPPohYv6k7V4VnsqtJ0JS0kX19FqM\r\nMiNz9XkcncBHy9x0BSxy4+YnwbFcgIx/MtYKlBL8NkPuuJaB/6C1O+IPYhdEdnpX\r\n+RaIue71nSStOYOqT4YDqHAIw7EmqgA1my09mmK+0Pn92GJVEAEN7JGBSQ+F32RI\r\ndB3ivGAOVtUtVvJlepWdbHxj1xqeP+LCjWzHMLQjm0TyH8VqU4Cg/wxwAEFnBATH\r\naOaWwrggzY2d9KBo1mp0k71NArLbBdlHykFU4bgiSDWrXXMz0fZzLQVwGI0Eqcxc\r\nouf6t0kvrK8oKjrnso+FjBoT7lHV/H6ny4ufxIEDAJ/FEBV/gMizt5fDZ+DvmMw4\r\nq+a088/lXoiI/vWPoGfOa77H5BQOt3y70Pmwv2uVYp46dtU8oat+ZvyW9iMmgP1h\r\nJSEHj1WGGGlp45d10l4OghwfTB0OSuPUYwWR+lZnV8sukGvQzC9iRV1DGl/rREMC\r\ncQ5ajRAtO5NPnThvN5/Zuh4n8JoDc0GK4jEZsIivAgMBAAEwDQYJKoZIhvcNAQEL\r\nBQADggEBAGHMRbPV0WTI9r1w6m2iJRrMbZtbBb+mQr8NtOoXQwvSXWT1lXMP2N8u\r\nLQ1a8U5UaUjeg7TnoUWTEOqU05HpwA8GZtdWZqPPQpe691kMNvfqF64g0le2kzOL\r\nhuMP9kpDGzSD8pEKf1ihxvEWNUBmwewrZTC3+b4gM+MJ3BBCfb5SCzMURLirfFST\r\naxCNzc7veb2M98hS73w5ZE6vO+C/wz0GTsxuK0AoLitApT5naQnjvxSvSsjFPEGD\r\nsUNUEU2Decyp0jxLVnrrpz6Y5UupfBR0V8yAv1t5Od/mCKLc5DxHsDWiKOpsob9U\r\nJN+bdzJil2NNftihD4Dm7Ha7OS3O8W0=\r\n-----END CERTIFICATE-----"},{"id":"nextant","categories":["files","tools"],"userDocs":"","adminDocs":"https://github.com/nextcloud/nextant/wiki","developerDocs":"","issueTracker":"https://github.com/nextcloud/nextant/issues","website":"https://github.com/nextcloud/nextant/wiki","created":"2016-09-14T14:34:35.977699Z","lastModified":"2016-11-22T16:02:57.758477Z","releases":[{"version":"0.6.6","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.6/nextant-0.6.6.tar.gz","created":"2016-11-16T15:11:14.344704Z","licenses":["agpl"],"lastModified":"2016-11-16T20:39:59.030384Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"aOZeEeThyZ0V/vXBcn6c+Z0vyCsZcN6nfSJ8oWEea4zXh4g705Si+MFZESqix3M2\nOPCnA/U8eASwdRTAEwQJrW5ECmu1THXSIsrzQzc9kFycvyOGzCgAWtuu0ayzZD2/\nU5aDWlzpLHC1Czg9QJ5UnfZR0AfChWQ402N1YzGqMShdJv6AHXFrVE+uYnIyxuYI\noPJQBUYbQwthVUjpYwFwSxw50YU17gmx5RZ0Y0OPz3i/EiuEUrxopXtfDVYAuCML\npDw37LOTRQ2JqxSU3teALh8LcrwJbTeOP0n4bTeV+vU3jvtiaEoRrwfVrK41F701\nQymGXy1/EFG0kxPGS2dRNPBAXYLZfeoWlROl3D5BWlbsCcXKU1S+22yn0TEdS7x1\nY44x8jRKnBddDE7qkn+QoQYHNNcxOREsFFLmIoyCUpdNOdDX2PvTFUYkIqdnXaJy\noAKv2GkvWPQ0aiiBtA1i4oXuzvHW/M2wOrK7v7DCpNfILrD/sjxpljxcX082nRCd\n9P3iPd2hQ6yOM9fG21LVN74b6wggI81BzFf/xJPd4ZqYLjfeG/yqd0zaiMOzMm1W\nse+kc/a4iB3BoCNX3E942pBBzew4ya8LkCXdCHUUsuelDf1va1ikTh/G7D84ll9/\n2avNqQnUh3hgOnxFCLI/5VrbqxfSTVdO6O/LTuAmwgw=","translations":{}},{"version":"0.6.5","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.5/nextant-0.6.5.tar.gz","created":"2016-11-09T16:58:06.856332Z","licenses":["agpl"],"lastModified":"2016-11-09T16:58:07.139404Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"DVOIbLEVggiLkNkuPW+pXqu8WYT15unUsMoqHSw81NiU6HF0Nuf3XiwnHJJDDqo5\nyX+QyHADO4ZiQpvXhGigvwD2eS1jVLatAztyxE0tEQv5eBU/7R0jQYxI8YCnC/jE\nZDa0qs+TI58EkDek0LBzueVQqrLubKgGU9P+E9H8gbWi1JHvl/2LdY7CplPqaJ+J\nMRokobPntzgx9m4DZC1RsCoXzSON7o2gp2cmunPJiXVHPhMUfIfolGEbNGJ1/xdp\nra7Y7XkPnDx4po98a38UpUh1x/2m5goOV54em35bWbh4ShNDykiE5ttz6tOywlYN\ngxceSsStTKyqscVaOV2Xu6Ive0pY9CInvrSfRnRktIWBYDyWdbK9sJuqs/s69kqn\nKQ/SjzE2smw0zwOUMnSaz0Jzr1vdPFgNu2xDYAVQO5G03V+wQ5AhxuhBz5Xp5Fll\nLaOhymZLCC7lq0DUqkeTeQ2QCfiG23hvG2VUPsIqW7xFe2YzKHZVXi9JuH//Gwym\nDmJmcyZDMvNwNiObx3ZRKsZNH2XwbldFZ9nTpb9AafyoSR/qbwd473NewaDLRTiY\nLrOP5Wx1xx6DOkRmDF2l2iT1bSJ6eoAoWQU2I0aYRH9NAr2Ugd4f2Um4o61EJaL+\nRHT9cERRySEloU/NdgmZEOi+CG0rEu+9LC5G/jGlHE8=","translations":{}},{"version":"0.6.4","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.4/nextant-0.6.4.tar.gz","created":"2016-11-05T18:17:47.622023Z","licenses":["agpl"],"lastModified":"2016-11-05T18:17:47.678445Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"RdkvnhNjw+kAnT6Or3+N9FzAv9DjJ9BAlmgANMwZZcaqo1gZRFewsGD2Rx1KEb9X\numSC28tl2B5/3r/+dprVJmOnYJny/7+kDmI/d+vigKfnaQJOUZ0ya5+f72pFgow7\nth8fw9rX/3+zIBs2IeEN66cis8ioFq97BJDsnDMBDr7wl7CnFJjYe6eviWuiFTnC\n4sBXlYjHoaIRRu561nwAooV+WXmWsparYPVhj2cXdyP/CnWo5HSF5jA51WCsz7Up\n7a0URXdh85xmxEbZtnjUymTW2BIegdxj9Erbfiuy/m3ApgnP+DiEQRcM13J7pXqg\n4cgFOBSzKDZgim599WBW2uNO1ztnDYOzz47GXDfJhcdvKiZZoQpUF9W4LMRtheMz\nxD9YArO3j3d+VOInSYU2Rpvhugwo1LExhwnRdT4+cOZfEeq0VojiM7yBZLDdEjIb\nGdYUJtNWSU0F6cPab2Au8FgZymLrHL9EpGvxuA1oAwtRxHAgMElJG2O6Jp89gGl9\nh/AptypeTvzNEc9/Kg24ueBKqmSUd5a45pZ3gM2pNATJhUK7fzLb/K6cq/kEzZtj\nOPra1ZfP0/20u8VP32Rgw1cFmIjqt8DFzUmOMpMfyoJkdldtTwQtGk+yIvtN1zp6\nT2zDknAKA2N/rZ/0SJl8KxVVNLhQWtYBJ+rFAdapuxI=","translations":{}},{"version":"0.6.3","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.3/nextant-0.6.3.tar.gz","created":"2016-11-03T21:51:27.654342Z","licenses":["agpl"],"lastModified":"2016-11-04T18:25:35.697130Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"Hf5GB4xd+rVXzWvVpGbbF5tqmnI+DGHlNHdLYPImFLS/Z4K5wKeNp80E5sd/RkAi\nhyuEsdWHlGDVMT6s7oeCmH/ClyWqLNSz9VH4KYqyFgD4+usHZp9PrEeEKbvPDPKv\nD3eB7Ats34cWcpf4E1oR5wsPicgmdgIgb2uMXzc/1G9xUBRWzocwCstzjEEAB/VJ\nvJuHvhDTGG294P4gOb82MxKCQ8LZ4i1QXzOf/mLETOubiUbZtJgTReYvpdAo2Wct\nbdfDFw13LYZkCf71r9jIQ3PSPlIpD+0BwAlE1fi0Br9dP2JjIfiKN6CGVaki6O0v\nKR42jtcE9xXiAop0Ym1FYMWJvQUy5PFLMwYDfEd6CvfEFJl+fi+RjXNDNZcTyw00\nHa48sACoGzxwts2JknWMU57mwvi0Z4uwpE0cFp/PRzBsXmSlCzWHjJhu7+2qambE\nAabdP9nH2NvqJHUJyPsxtDSrSWCBY4CoL3wYu36UrIA4NepyudMPNe9fhKTEU0bg\n8DLclw6hYdj5p9Zj3OUuwOZLz6r85KwnooTsUjOYkBXvdUuHWkgONqqZlPMApS4i\nChRQ7ysHAinPyyzsvr0PR9g6J52CSCO/7qwSJy6yqSzuSWrbZUa4FVTcKIwWJJPu\nJ2XzB4rWVG1wWjzMM6MIvFbO2HY9upzh651OdOwsYvk=","translations":{}},{"version":"0.6.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.2/nextant-0.6.2.tar.gz","created":"2016-11-01T11:24:58.054892Z","licenses":["agpl"],"lastModified":"2016-11-01T11:24:58.151609Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"h8KgwMh2RGGIp7q/II23VSfE5Ibkha7p/C1kvIfG6QIIc2Zu/Mm3Oekynnysh5ZJ\nZuMTaeWbejbBAmlnxW+AwBWa/s2PoMhv7foVvdtg76l9/qr+9jGvUM7D1LbbBvAy\n/XW6JSrhhBZHOohdU7kwV5Xnwsn/NC/zUe0G4eZ+9fc9uSntkob9wnWvUs2daAeD\nY6Mi7Xt/XAIX65OIVTKfC6ah1SlbXgtJ2i2j4G32I9jRhmbkpt/UJEangn90fHnY\nQXNJ85OyV0aNMafNHoMSL3uLscdvjp0Hy8w4iBeavsRlCs0GiUoG1+YdwTwmC9EM\n4CjbMfRJ0DYK7u697TOmS8MQzk8O7f5THtjeokZlrom2YnV9t6gLvjnxl/+gXPdJ\nmgLixnA8P6tPsff9pquHKQZsvxjv6vVa2DVJc8VpcqJRih7yj/3V7rxesEP7MUnP\nznIOcwzTsKXHuAnvujpCwyQj3QtpQK2XJPQ5WkKgwbTdvriVJfnzPironhcHo1vC\nbuUDOdhL59aySChw2cZGD9lCWaxYR7I1BDDzWKNl9Qg0AZ2auyGUGTv8P2vi5qUB\n0CmnkzkZurR5ju6Nb9/2lcZvda7QJdIdMtm2Wnn+Ak/Z3Y4IehB5PPDP5/MMAhQY\nXE8Jqe0mGtiU/O2346L5IThkS58JlRmep4kYv+II9zE=","translations":{}},{"version":"0.6.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.1/nextant-0.6.1.tar.gz","created":"2016-10-27T21:16:47.066097Z","licenses":["agpl"],"lastModified":"2016-10-27T21:16:47.125641Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"axSX4Kz2P4PbKU676DibjPZsxk8hCIG3lLOmeMXoiBhp3ka4wJ8u5tNwTzgY8/MV\n3mjXe5DNttD66SqmiRNSPKbotYHVFFW3wFK+Dgh/++n/KTomGYUeIwt88Z9ecbuG\nNT6U46jFrfZBYzRHWzbgiJ4c7MCoid9cfmoB7HDuQSyw+E0S2vbLL8+jzMcIzF+5\nTh/sJEterXCyrWSciw/9x98F+4svNbskdEIvrOox3+K6UIhpsojqJR2+bQhG3rsM\nPerOb6J+bzHdLV1ZL/4nWEz1F30T7B08QxY/4pHD68JFQcdtzmHMIhXfCoRvWhN2\nVRnizx3IXBALY4F49Ql6bjsnr6BCp+LroM5RSQ3eupDcqejDJLbjPz8xfOMOwlx7\nz84Xd0MUyqaEkxg1ihsWLbPlYACUZ2aoDkSQUIbfZTTiov7eqTM8UBc/UqVID/LU\nyEW4gjFZzQy6kX76XRAGq1vebKFjCU63asCnVyJhF/YQVTu1hPGbFslkRKnYuh8W\ne4MeaNfbdjcSEX+7oTcPJz6V09pOPvukXL0M1m7lS9PhTisI6oGj8c33GPYp/DSK\n6SGk+ukbt1mwFuFKdTvAMxo1lk96D+pKUv4MX/ralaaoIAmwPTGsSQ04RyL454ae\nU6q8PApwrVyPHYwMBPtXGoQMyb2ZV9rylazYbKCQ8I0=","translations":{}},{"version":"0.6.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/v0.6.0/nextant-0.6.0.tar.gz","created":"2016-10-26T01:46:48.419025Z","licenses":["agpl"],"lastModified":"2016-10-26T01:46:48.521063Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"W2TmbX/NbbfPPjIJLalO0kCDhhQF1pEohH/CxO9bY+yR+a5NKiTbpAhG2McqpTSj\nmgC4J8/thmwGlWGC+VW+KlpXzzjc7wCgMGMKViOpGD3pIy8p8U5MXTqVgjjrEb9g\nKgr9uErXzxJ5oDfkx8Uh1bUeBJTsAAivGJqMlhBYFGxw8BSB09sfOZytNxo4wbwZ\nNAcYP1qvkUQ8CVR0nInSTRfLvAp5+e/8xxyYZwJIWrdNgpoP0CxiwzKP/VSjBk/U\nsPU4R72UQnVZB0InRCeh/KNTwu1YiPkUKm+mNmt2hCfN7Fm6bY2rUMH7oa8KTkqn\nh52FhbaYRSAR1OPdC5RnHiQWlPh71gq+4Xqgp19Eawnl/QiVteVifSjNQZ+Ban8M\nRyw/PxHnzIWg/OAjx81Jx9mXjUIHSeUxMTJTKTp+lEqIAzjku0iHeU5UPGCfE+VM\nwmopZfnlfk2nLkUwjQXLCIcnZD1ME1m0h/H4Ad0Q/qXpBScUp47npkxg2b8zPIhk\n3aXUmNPLgwyXPWvAuaBK/WwpNefUnqWFns8t2Alpzg/EpC2PrZqciCNDcRFEycoa\nX+JsFyD7eYA7Dc9iIf09gXZX+tZ+Jinb+iPDwYrl1u/7IIBoBlUGCgo+cF7/dL9S\nc3vYeWw6MCH8Sv+ckgS2g726BfdN5EjB/8cb071b4lE=","translations":{}},{"version":"0.5.1","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/daita/nextant/releases/download/0.5.1/nextant-0.5.1.tar.gz","created":"2016-10-17T15:23:04.515057Z","licenses":["agpl"],"lastModified":"2016-10-17T15:23:04.576640Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"Pp3rC/9RmAYURneGpGit4HZ2t1qH9A9nwsUnGDgRuJ0akIii7CtJC+n8l1b9k73/\nhxMYnp2JOBu2HWKgFp9a3yeo1xphI5hOUdVQ1UZAWxIQyDI1FZVYDr81l7GCdkqm\n2lMxgviFADSYURCgEnAsj9Nt0NZ6LDcJZiJg3iPAjkDI0U+KnEBjtx/XRFqGUnfp\nCUZ/XLHh/hvoEitSHepTBDCMKkTNjbDEwBYfA2rAoz4zbMR5zKLU+1r1DIUgWSRe\nbk2i8TaTDVL4cbb6MhkGKwkujb+Atikvkpi45o7+fyQMs84c6fjjh/TZJaC+dMyG\n1GCikMPwwtEPjXtnLzynERAxJOd5mP4Ee4sD8ZrnzNUehpyFR88pwWU6r+dmiebb\nnsYlGkhIu2aIO2O4HZ4sUTsO5sfjZ9me7jsafhgJl6iG4IBeHa/L1MsSbhsh6mvH\nYsz4Xsluwr0QcFLmSDDQQYynyogKfJZG2xQsadM0GETWgXE44dVeRvMUsILfB4uZ\nmfKgd23SgaOhYC8m4bg5Hxnkl+xHJnyGZ6jhqg7bhuKwsoLymc18Vmjmb7a45HGV\nXbL5CTmw9yaPOBS3v7v91TnlB+0lhlzbKzZ0xIhY55qsTC76uScbTLwndPqNGaF7\n2koxRbJ3jcmf/Z2MLymdRi2BTZbZkPkxgVrSf9plaR0=","translations":{}},{"version":"0.5.0","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/daita/nextant/releases/download/0.5.0/nextant-0.5.0.tar.gz","created":"2016-10-11T11:47:46.191539Z","licenses":["agpl"],"lastModified":"2016-10-11T11:55:40.393000Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"qzQJSLK8nkrQedwwxUdhxL8bq3aXyppAlWJo+n3GqSvqA8uNTzl3Wsci0LsnBV0E\nDvDNW8K0enhl563F/bywQrDhgKl8jTX/CA5KCxqO9P+tvE80zAfMqiRnQayVcWuY\nSWX6RqfI/kqiWyN1SsFp2EDlas6eb+xfIoiJamlfsN0qzHYOFt5W77wmw2Bn9dB5\n9nwHHyC0z60Pf2pPduc/KuZ/971WrDFaIapL7Gm+z9XoaKSwUT575VtS+RNJkOKy\niBrwnHdc8x/62HPFOXsUYjCt2aEmLzPCQN8Ke5pd3596hm5wbAVzTHuxf2H35tb3\nljfGqAZ5AJX2Xd13d4aHXFdSEILwv6IFq2fx0hO3vkvFEoKF5oQ2t3hi++Mw/h8R\n15OKZCOC1bFH3gTwdshmnHSTSr3LxDeTF60aH16wpXcehQuJHagpb/aG8mPD1w+v\n759/mekqa4LYlqT9TLWTqX3UPeQXYIwcPijG84IvW1BDK1M4Mj2Vqsld4jXwG6CP\nORIL8xoQbA52dQI1Y19JXcU9zxIb6GaHYgpV0wejatsZRfhPv2Yd0CBShF4HY7aw\nnfcm88pqzOKNvjnLZjTFQwuJ0AUUSOsWhgZzYt8tATJ2KDZ+lxz+WAMGXJAC/ciY\ntrrglY7YxwJNLbYp+arE0sowZx+IOVaSZBvmUGHiEBY=","translations":{}},{"version":"0.4.2","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/daita/nextant/releases/download/0.4.2/nextant-0.4.2.tar.gz","created":"2016-10-06T10:31:12.482416Z","licenses":["agpl"],"lastModified":"2016-10-06T10:31:12.551117Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"QHJhYcBMi5HyPofshZ7EdcXsOfRrl7o48Y3BBBq8CkmYtFDbekghdJqjFbwwZa5u\n8FtgMVwssql/RSDNP6M2Zc/MpQ3K9gDm+DyxE5KRmtMEpzHB+oD+1DxP7kAoyW8/\nnBr5iiQSdLCelddMcTwbdxskLFUXIs3cFuLGhMvr8pdQOAgfxte5lolrj4/8EsJ0\n0yUImgIYG4NlgmvCygGApdpVaOcK7XVtv4oH+x43JmX9YZ3Ce0DQPYPUbFTCf4ZS\nS075j1vcnPx2cRFGxc+YpKzYVVYoy7ZdB75Hq+kaei/atxrTyV5+gcCrVPnH1RkX\n6G8rgu5l8FoGJYopi8/9dd8LsGLFx53CHMdEVob3tFR0WeK4TJAGJa403zE6S3hM\nxr86WCedmjuti0uOhSQr5AEVAoXZ/JUWQMMsPAUMuKEYVjKfmve6TlcNMC2oM5XT\nXcOf4OP3pcQq4ViN53o4Pj6NGSci6IzD6xLeAxKZUoTX37ArVKH6RHS5Najc193H\nRhYRnfE7D5YOr1u10HaZCFCVJif2MgMP0/uH2759NoRjXFowrh7Z6dW7JQG5lbHN\ne0jjJH1Y8m8H1peGGcmM0YxFiOVZ0ER7P+AxT4Cbau/cVhaS8vnPF2a2a6YFRiFS\nVH4aqazvvXrtifDr3lfvlyPCrP/570nwvOJgZGk+K/Y=","translations":{}},{"version":"0.10.0-alpha","phpExtensions":[],"databases":[],"shellCommands":[],"phpVersionSpec":"*","platformVersionSpec":">=9.0.0 <12.0.0","minIntSize":32,"download":"https://github.com/nextcloud/nextant/releases/download/0.10.0/nextant-master-0.10.0.tar.gz","created":"2016-11-22T16:02:57.740378Z","licenses":["agpl"],"lastModified":"2016-11-22T16:02:57.900805Z","isNightly":false,"rawPhpVersionSpec":"*","rawPlatformVersionSpec":">=9 <=11","signature":"kDO3xbPpoUdl2qo362tXfJIqKeiKE12M8FkMXbdKiRNzuQyvDOehQq3dErALZDOr\nLG47Tpez/Kn9Fsx1y4dQDx0w9SD3pyoqvjj1O6KkTYN6srpitQcj9EzEItCY+MZd\ngRSc7Px9MzxpFpgwtuThGVlSt5kLMd0vjWFLVcv7k07rZfWEsTwXd24INIDtlr1A\nC7hyLB777nEOGa7oAzx8nr+FJcIbmu9opVZk8AL40FOFDNBgfAy2AS9hGZreUmRV\ndV9Zh7UAR+RsEeO51xcU/CKqC8Jb0jL1gkYyUaQy16oe1HF9bRs1PWuNL5mYwsmy\nZNn0ay/a7mb7hxJbza1F3lbgBtodvbgUm7+So/QvaR29CSAqqoUXeQy6FfSBVWhZ\nYlTxdQfKcBcUPFO14BBk/O5p5iQaG8JCLJ/EZGDPDIVDMn7crGQ4oLZJv80eqTeB\n7ueDmWaD3gQ9j2XKsMk1uLSyY4unt9AaTofBylsKD1SjLhyxofGZym4jc2+M1GnQ\nyLcoEMSexnKuextu4nzrA0y5k3z9tvO07R29lwT1GFp6oGAakMLob/6XrGsm3YQY\nRQXgfXKFw8XmXBumqG8ayEIyvQ/O8nO6r4R1H8a7ooj6oWa3PhPsen+gLE0SpJPZ\nz3e2TLliwC4VtZp69H7u3px5Qn1Fc6RMDTh571edCr8=","translations":{}}],"screenshots":[{"url":"https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/displayResult.jpg"},{"url":"https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/admin.jpg"}],"translations":{"en":{"name":"Nextant","summary":"Navigate through your cloud using Solr","description":"\n\t Navigate through your cloud using Solr\n\n\n**Nextant** performs fast and concise _Full-Text Search_ within:\n\n- your own files,\n- shared files,\n- external storage,\n- bookmarks\n\n\n### Recognized file format:\n- plain text,\n- rtf,\n- pdf,\n- html,\n- openoffice,\n- microsoft office,\n- image JPEG and TIFF (will requiert Tesseract installed)\n- pdf with no text layer (will also requiert Tesseract) _[work in progress]_\n\n\n\n## Installation\n\n- [You first need to install a Solr servlet](https://github.com/nextcloud/nextant/wiki)\n- Download the .zip from the appstore, unzip and place this app in **nextcloud/apps/** (or clone the github and build the app yourself)\n- Enable the app in the app list,\n- Edit the settings in the administration page.\n- Extract the current files from your cloud using the **./occ nextant:index** commands\n- Have a look to this [explanation on how Nextant works](https://github.com/nextcloud/nextant/wiki/Extracting,-Live-Update)\n- _(Optional)_ [Installing Tesseract](https://github.com/tesseract-ocr/tesseract/wiki) ([Optical Character Recognition](https://en.wikipedia.org/wiki/Optical_character_recognition) (OCR) Engine) will allow Nextant to extract text from images and pdfs without text layer.\n\n\n\t"}},"isFeatured":false,"authors":[{"name":"Maxence Lange","mail":"","homepage":""}],"ratingRecent":0.5,"ratingOverall":0.5,"ratingNumRecent":0,"ratingNumOverall":0,"certificate":"-----BEGIN CERTIFICATE-----\nMIIEAjCCAuoCAhAFMA0GCSqGSIb3DQEBCwUAMHsxCzAJBgNVBAYTAkRFMRswGQYD\nVQQIDBJCYWRlbi1XdWVydHRlbWJlcmcxFzAVBgNVBAoMDk5leHRjbG91ZCBHbWJI\nMTYwNAYDVQQDDC1OZXh0Y2xvdWQgQ29kZSBTaWduaW5nIEludGVybWVkaWF0ZSBB\ndXRob3JpdHkwHhcNMTYwOTE0MTI1NDQwWhcNMjYxMjIxMTI1NDQwWjASMRAwDgYD\nVQQDDAduZXh0YW50MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsbnQ\n+9acjKHfcrUj4yqBpD++GmQ5z2Sp8C8uOz4ZbLyM9bUXEYHo4a4u3CdC49kGUkb3\np5MkEAEzslTWDi1eh5MZgPWpbPgItsDsXY1o55O3jtxNkzSG5/yYcPQcuKtIOm9S\n7DY0K+UQt3nK+RrXEZfARMNrzFbEzpE3b7w901Yl5n+m/B8rhW4pqg8uSfx3u04J\nwduV1fHwoHUB0Ox5HyWib4Pq1XppNh7xdc2Fg93JxshwuCPJyOOzrFTnxC7s1yzQ\nUvaqkjPW5QeQRunQjZ2XtpYH8f8v01W18bNEiHwqtFwuDEyCVx1rvEMgUDVXdPkP\ngZrlB5TzGmz0U3HzYvf6205WuzfHxz7kPj502wP51PoZBKpniggKzmuXkx6BpsZC\nZX45VpDHdiATLwRj1t2bMs3C01nzpIWO5ZwFtkepH3Y+mvwX5lDh/XDsqJC2Yo8o\nWMmniWNW7dspufYOsBUqqYGP7rkailgVT4oYk6D1j6oFZ5SSpfPF5lsyYedDSM6y\nbIGVkSF+sjLK6R9BenBijKceAKsS//WwRYCBPC+JHlsYpXKW12bL+C47Kj2/N6d4\nrYryzV6ofVSF6pwIq0oEjoyfBfNpYavf3xrRkSSmIIlPSnMY7DT1xkGD5retxSm6\n+WIfkWKRZpv2S6PhMHGLspYc4H5Dj8c48rG5Co8CAwEAATANBgkqhkiG9w0BAQsF\nAAOCAQEAOZUwyPaUi+1BOUgQJMWqYRoTVZUyBshTXSC7jSwa97b7qADV9ooA6TYF\nzgsPcE41k7jRkUbnjcY45RGtL3vqsgZbx5TjPa5fGMxlqJ6eYBOY61Q6VIHEVm3u\nxnPEO9dsMoDBijvo5D7KtE+Ccs907Rq70kCsbrdgPHkyb5tDSnCKogN1LiQrg1EP\nmy7Z1C7jG9/h57vx0+QBMDCYnTmqLsvMKqo27uHskzAiB7VXLEdSZ2FtMGHkLUQO\n0bfhnvTZ2VhMmK83t7ovo71An4ycmsolGD/MA0vNI78VrVISrdI8rRh2WntUnCBU\nEJL3BaQAQaASSsvFrcozYxrQG4VzEg==\n-----END CERTIFICATE-----"}] EOD; - static $expectedResponse = array ( + static $expectedResponse = [ 'data' => - array ( + [ 0 => - array ( + [ 'id' => 'direct_menu', 'categories' => - array ( + [ 0 => 'customization', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -75,28 +75,28 @@ EOD; 'created' => '2016-10-01T09:16:06.030994Z', 'lastModified' => '2016-10-06T14:01:05.584192Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.9.2', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/juliushaertl/direct_menu/releases/download/v0.9.2/direct_menu.tar.gz', 'created' => '2016-10-06T14:01:05.578297Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-06T14:01:05.643813Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -113,36 +113,36 @@ bkR1DTBCyDjdpNBidpa3/26675dz5IT5Zedp4BBBREQzX08cIhJx5mgqDdX3CU09 uWtzoaLi71/1BWTFAN+Y9VyfZ8/Z3Pg3vKedRJ565mztIj0geL3riEsC5YnPS0+C +a3B9sDiiOa101EORzX3lrPqL7reEPdCxrIwN+hKFBQ=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://bitgrid.net/~jus/direct_menu_nc.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Direct Menu', 'summary' => 'Provide easy access to all apps in the header.', 'description' => 'Provide easy access to all apps in the header.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Julius Härtl', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -171,14 +171,14 @@ e/zxnB1EmeI2X5D2xceJDLB7Fy5W0EGrLixRIdFaSUommWFUm9E2hSIaNlziSBdc G2dF9Gtu4GiQ5fuaJknaxlgXHovfqeZwZJX9o4M+Ug81AqiY7XjdiaCPdh0Tthcx 2OmWZo7UBREWenjKyFZZ/iKoqH5sdenBtpo= -----END CERTIFICATE-----', - ), + ], 1 => - array ( + [ 'id' => 'apporder', 'categories' => - array ( + [ 0 => 'customization', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -187,49 +187,49 @@ G2dF9Gtu4GiQ5fuaJknaxlgXHovfqeZwZJX9o4M+Ug81AqiY7XjdiaCPdh0Tthcx 'created' => '2016-10-01T09:16:47.111889Z', 'lastModified' => '2016-10-12T19:50:16.038821Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.3.3', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/juliushaertl/apporder/releases/download/0.3.3/apporder.tar.gz', 'created' => '2016-10-12T19:14:10.802359Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-12T19:50:16.104357Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', 'rawPlatformVersionSpec' => '>=9 <=11', 'signature' => 'nhlT9lhrmBxIsqh/e3RLm2NDw/U8ZvvoMyYQTLMM3H19DQmVcPYPYC9QWVTsowUzXblVaOXVGylbpKma9yOlOAqJtF3qyXecLl4+tA/Awb6BBhKPgHFdcLDAL5yy1K7/uei3SgEojMlJoI9vEK5I1C5YTh43yNH+//Im6MAuNYFUTlMXK426zdOe6ogpCI5GlYdXopqYANxcpT+WXWET6DDSM5Ev+MYwMcSAY4r8+tvARRU4ZAenRgjkBT6R5z6cD76emRax14tbV6vkjjwRcO+dQtM0tFPbd+5fsNInbauv50VzIMgjA6RnKTOI17gRsSdGlsV4vZn2aIxEPWauu6T/UohMvAE9HMn13vtbpPBSFwJAktj6yHASYGzupNQLprA0+OdyALoLZPpQAKNEXA42a4EVISBKu0EmduHJlUPeqhnIGkkGgVNWS8AWqzP2nFoPdXBgUWateiMcBTHxgEKDac5YmNc9lsXpzf1OxBaXHBhGYKuXPwIfyH3jTWb1OdwixJEuRe9dl63T9qOTRre8QWns/bMqKLibGfMtFhVB21ARJayBuX70eVvabG/2N7Y5t1zUlFygIKu51tvo3AVCRDdRrFWDvkAjxzIz5FIdALVZ+DReFYu/r4WF/w3V9rInFuEDSwb/OH4r8sQycs07tSlMyA74Y3FpjKTBxso=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://bitgrid.net/~jus/apporder-nc.gif', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'AppOrder', 'summary' => 'Sort apps in the menu with drag and drop', 'description' => ' @@ -252,18 +252,18 @@ personal order by changing the following parameter in your config/config.php: Users will now get redirected to the first app of the default order or to the first app of the user order. ', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Julius Härtl', 'mail' => 'jus@bitgrid.net', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -292,14 +292,14 @@ CSKtBro2jcnxzI3BvHdQcx4RAGo8sUzaqKBmsy+JmAqpCSk8f1zHR94x4Akp7n44 Tu+WGOL2Ee5U4k4XFdzeSLODWby08iU+Gx3bXTR6WIvXCYeIVsCPKK/luvfGkiSR CpW1GUIA1cyulT4uyHf9g6BMdYVOsFQ= -----END CERTIFICATE-----', - ), + ], 2 => - array ( + [ 'id' => 'twofactor_totp', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -308,28 +308,28 @@ CpW1GUIA1cyulT4uyHf9g6BMdYVOsFQ= 'created' => '2016-10-08T14:13:54.356716Z', 'lastModified' => '2016-10-12T14:38:56.186269Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.4.1', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0 <7.1.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/ChristophWurst/twofactor_totp/releases/download/0.4.1/twofactor_totp.tar.gz', 'created' => '2016-10-12T14:38:56.174612Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-12T14:38:56.248223Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4 <=7.0', @@ -346,32 +346,32 @@ h7ro5ls+d3OQ8i3i4vdZm821Ytxdu/DQBHiVoOBarvFWwWAv2zd2VAvpTmk6J5yv Ml2RKcPeutMHHSLiGIN/h7fM5aSs49wGgGZmfz28fHVd7/U0HFSMYmkT/GMq5tMP Iyc+QZAN4qbX8G0k/QSTkK/L4lOT2hQiQqiSqmWItMk=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( - ), + [ + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Two Factor TOTP Provider', 'summary' => 'A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)', 'description' => 'A Two-Factor-Auth Provider for TOTP (e.g. Google Authenticator)', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Christoph Wurst', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -400,16 +400,16 @@ dIu2MkhxAZk9FZfnFkjTaAXcBHafJce7H/IEjHDEoIkFp5KnAQLHsJb4n8JeXmi9 VMgQ6yUWNuzOQMZpMIV7RMOUZHvxiX/ZWUFzXNYX0GYub6p4O2uh3LJE+xXyDf77 RBO7PLY3m4TXCeKesxZlkoGke+lnq7B8tkADdPI= -----END CERTIFICATE-----', - ), + ], 3 => - array ( + [ 'id' => 'contacts', 'categories' => - array ( + [ 0 => 'office', 1 => 'organization', 2 => 'social', - ), + ], 'userDocs' => 'https://docs.nextcloud.com/server/11/user_manual/pim/contacts.html', 'adminDocs' => 'https://docs.nextcloud.com/server/11/admin_manual/configuration_server/occ_command.html?highlight=occ%20commands#dav-label', 'developerDocs' => 'https://github.com/nextcloud/contacts#building-the-app', @@ -418,28 +418,28 @@ RBO7PLY3m4TXCeKesxZlkoGke+lnq7B8tkADdPI= 'created' => '2016-10-30T14:00:58.922766Z', 'lastModified' => '2016-11-22T22:08:01.904319Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.5.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/contacts/releases/download/v1.5.0/contacts.tar.gz', 'created' => '2016-11-22T22:08:01.861942Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-22T22:08:02.306939Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -456,48 +456,48 @@ H3aH8GljatAFjrwItw1JzR0THt0ukkOK+bw/pfCslk10sjHMitmz/GXa4qMS91DZ BKLUd0dSfQUQzkfwcojImbzJRvca4/DYe3mfG7+RCH0tDL6t72dKL9joB++u5R1u VZPgkToexlXcKWpiDB8H2/SEShKr4udAOjR5de9CYWM=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/screenshots/master/apps/Contacts/contacts.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Contacts', 'summary' => 'The new and improved app for your Contacts.', 'description' => 'The new and improved app for your Contacts.', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Alexander Weidinger', 'mail' => '', 'homepage' => '', - ), + ], 1 => - array ( + [ 'name' => 'Jan-Christoph Borchardt', 'mail' => '', 'homepage' => '', - ), + ], 2 => - array ( + [ 'name' => 'Hendrik Leppelsack', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -526,14 +526,14 @@ iuPit2pjkw3nWz0JRHneRXz/BNoAWBnJiV7JMF2xwBAHN4ghTM8NSJzrGTurmpMI Gld7yCP47xNPaAZEC66odcClvNtJ2Clgp8739jD6uJJCqcKDejeef0VU1PG7AXId 52bVrGMxJwOuL1393vKxGH0PHDzcB1M= -----END CERTIFICATE-----', - ), + ], 4 => - array ( + [ 'id' => 'mail', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => 'https://github.com/nextcloud/mail#readme', 'developerDocs' => '', @@ -542,28 +542,28 @@ Gld7yCP47xNPaAZEC66odcClvNtJ2Clgp8739jD6uJJCqcKDejeef0VU1PG7AXId 'created' => '2016-10-19T19:41:41.710285Z', 'lastModified' => '2016-10-19T19:57:33.689238Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.6.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0 <7.1.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/mail/releases/download/v0.6.0/mail.tar.gz', 'created' => '2016-10-19T19:57:33.676730Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-19T19:57:33.834580Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4 <=7.0', @@ -580,9 +580,9 @@ D4c6b+qYn68kx3CLaPPiz+tFAZQZQdj7+Kx/lohso8yTnVSiGYrMj4IvvCbpsQjg WF3WSqF/K/tTnPYTWb9NUPSihTbVNv6AXOfTsPEp/ba2YSS5DjvjVjkr5vhR9eg1 ikQ3Cw6lW3vaA4LVCC+hFkMRnI4N0bo5qQavP3PnZPc=', 'translations' => - array ( + [ 'en' => - array ( + [ 'changelog' => '### Added - Alias support [#1523](https://github.com/owncloud/mail/pull/1523) @tahaalibra @@ -616,32 +616,32 @@ ikQ3Cw6lW3vaA4LVCC+hFkMRnI4N0bo5qQavP3PnZPc=', [#1603](https://github.com/owncloud/mail/pull/1603) @ChristophWurst - Update folder counters when reading/deleting messages [#1585](https://github.com/owncloud/mail/pull/1585)', - ), - ), - ), - ), + ], + ], + ], + ], 'screenshots' => - array ( - ), + [ + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Mail', 'summary' => 'Easy to use email client which connects to your mail server via IMAP and SMTP.', 'description' => 'Easy to use email client which connects to your mail server via IMAP and SMTP.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Christoph Wurst, Thomas Müller, Jan-Christoph Borchardt, Steffen Lindner & many more …', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -670,14 +670,14 @@ ZETmzhx0BXDt5enJYs8R2KMYJNIme1easQRYmWKliXogNY09W7ifT9FHtVW1HX+K xRS4JXbapjolkxyGSpP+iYSgItVnYzl6o9KZResR4yDsBv7G/8fpV4GQU9IS3zLD PiZOosVHWJdpUKCw9V4P1prGTQ== -----END CERTIFICATE-----', - ), + ], 5 => - array ( + [ 'id' => 'audioplayer', 'categories' => - array ( + [ 0 => 'multimedia', - ), + ], 'userDocs' => 'https://github.com/rello/audioplayer/wiki#user-documentation', 'adminDocs' => 'https://github.com/rello/audioplayer/wiki#admin-documentation', 'developerDocs' => '', @@ -686,78 +686,78 @@ PiZOosVHWJdpUKCw9V4P1prGTQ== 'created' => '2016-09-16T05:44:24.857567Z', 'lastModified' => '2016-11-17T22:34:34.637028Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.3.1', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/Rello/audioplayer/releases/download/1.3.1/audioplayer-1.3.1.tar.gz', 'created' => '2016-11-17T22:34:34.215350Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-17T22:34:34.867778Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4', 'rawPlatformVersionSpec' => '>=9 <=11', 'signature' => 'p6Zz0IEFrxvw6y/3jHgGWWCxR6qpMzvU2HKfxcIVsK6sJnoRUhWLeAXwZ432fH2a S2llj+IGS9OvW+5VQElrXgPtEjDK1BT00DRJnp5RFCRlUv0LNoedJMzx6B6AHqPP JBufk3cG1O/CO0M0L1ITGSmSOzfKvWTRo3lxVGF792NyBaP/SyZCkH1N1TzBQzUi Ywl3+HiglPcXbHjtJm/arnKorbJWVKoaN93xFuaBapd2ozQSpi0fE0uGRsici+U7 HNa1M5WFE1rzUJoufE0E9246At07rFY1e+TdNEq8IlLgCXg5vGCKkEyuWpWno6aX LfRaIiT9x39UTAwNvuDKS0c+n4uWDYPsGfKhDx9N7CXpUrthfXVEWRzZEXG7as10 6ANvrRPJemSZH8FUSrdJhD7k12qa9R825y7mIG68Li8P71V92EOxFfo9tNXqXwBt VuDGxBqByFVPqSCj5I8hrzJzQl2Xt40g8+8ZcSF96RMg/pM+bwRMTv+mz0V+vQQ4 DWjqnWVPalaJ1PPD5/QFFErtXuNRbyxKZ6BMWxfJlLM9Kz66P75K+8fYaSwz+2KG NxY7I3svzS2K9LGH3fBLUy1t3Hl+c3zGFq/ll1MJrf9NswV4yxt2WmISfM/KDww8 yELkGs2cRzbw2tCvnmYlJJhIqRLkyFAbDzWRH/XdVx4=', 'translations' => - array ( + [ 'en' => - array ( + [ 'changelog' => '2016-11-17 - fix: one-click-play for wav not working - fix: wrong sql statement for PostgreSQL [#90](https://github.com/rello/audioplayer/issues/90)', - ), - ), - ), - ), + ], + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://github.com/rello/screenshots/raw/master/audioplayer_main.png', - ), + ], 1 => - array ( + [ 'url' => 'https://github.com/rello/screenshots/raw/master/audioplayer_lists.png', - ), + ], 2 => - array ( + [ 'url' => 'https://github.com/rello/screenshots/raw/master/audioplayer_share.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Audio Player', 'summary' => 'Audio Player for ownCloud and Nextcloud', 'description' => 'Audio Player for MP3, MP4, Ogg, and Wave with a lot of flexibility for all your needs.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Marcel Scherello', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -786,14 +786,14 @@ zi7mQDFxmAE6FWSMBgKKUb4tqLc5oBap8e12tPEZl/UR6d9iUB2ltvrm3T3vrjjl FNvGFVBn4r5qCiChEoq+rCXHRjPi/eCfbW21XeLFDiLxapcZyc85JIcA7znUYoFe P7Y/ekMscwWhLbF91OaQlcWpRtEMyde/DaI= -----END CERTIFICATE-----', - ), + ], 6 => - array ( + [ 'id' => 'calendar', 'categories' => - array ( + [ 0 => 'organization', - ), + ], 'userDocs' => 'https://docs.nextcloud.com/server/10/user_manual/pim/calendar.html', 'adminDocs' => '', 'developerDocs' => '', @@ -802,28 +802,28 @@ P7Y/ekMscwWhLbF91OaQlcWpRtEMyde/DaI= 'created' => '2016-10-01T12:40:39.060903Z', 'lastModified' => '2016-11-22T20:31:13.029921Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.4.1', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/calendar/releases/download/v1.4.1/calendar.tar.gz', 'created' => '2016-11-22T20:31:13.020268Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-22T20:31:13.087340Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -840,62 +840,62 @@ eFLKrUg3EvnTjvknbBxMB55h9jNJr0SAlkrmyEVm6+CE3BwRWpKB+cJMBuGiwPwv r/ASRiJrkDThbNWAUtX70rUmCqDV6/MujLXViqOc/Q2OHvcXd1oGDccJSQT92/1z 7nonnedyYQIDqUt7u68WL8JRxp7pFsEqKLVuWSgxW3c=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/1.png', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/2.png', - ), + ], 2 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/3.png', - ), + ], 3 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/calendar/master/screenshots/4.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Calendar', 'summary' => 'Calendar GUI for Nextcloud\'s CalDAV server', 'description' => 'The Nextcloud calendar app is a user interface for Nextcloud\'s CalDAV server. It integrates with other apps, allows you to manage calendars and events, display external calendars and invite attendees to your events', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Georg Ehrke', 'mail' => '', 'homepage' => 'https://georg.coffee', - ), + ], 1 => - array ( + [ 'name' => 'Raghu Nayyar', 'mail' => '', 'homepage' => 'http://raghunayyar.com', - ), + ], 2 => - array ( + [ 'name' => 'Thomas Citharel', 'mail' => '', 'homepage' => 'https://tcit.fr', - ), - ), + ], + ], 'ratingRecent' => 0.94444444444444398, 'ratingOverall' => 0.94444444444444398, 'ratingNumRecent' => 9, @@ -924,14 +924,14 @@ D3xxtc17ll3B5IqrMnMHRqmOQ39Sbe56Y7T4agaIz/sUWpseo85D5kt7UAIOR+Mr Q0Bl/QinETk72afGR46Qvc7tC1t9JjQQD3AUbEGuJdGvXjJJ9GREYu01XoODmPdT jXXOI8XIOK6kxXhPHUc3iWu9b4KqGm0= -----END CERTIFICATE-----', - ), + ], 8 => - array ( + [ 'id' => 'ownpad', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => 'https://github.com/otetard/ownpad/blob/master/README.md#mimetype-detection', 'adminDocs' => '', 'developerDocs' => '', @@ -940,28 +940,28 @@ jXXOI8XIOK6kxXhPHUc3iWu9b4KqGm0= 'created' => '2016-09-29T15:58:52.814912Z', 'lastModified' => '2016-11-19T17:37:52.278497Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.5.6', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/otetard/ownpad/releases/download/v0.5.6/ownpad.tar.gz', 'created' => '2016-11-19T17:37:52.234684Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-19T17:37:52.423930Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -978,17 +978,17 @@ o3n0+gw3QYIhLEe75sUhxG6ynVUdW25AKKju1kVj3KJnZTBH1R8t8/zy4DnJG8d4 uRGqyU4BXpZjEC3nVlsC7vCncWWhxl0WZQ/MWKqsfjVAU4I88E518D6NioqMnPEJ iCZ2x+69UCDEQyfCSKajgAYT17r3OhZei8F9KSCH8Vw=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( - ), + [ + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Ownpad', 'summary' => ' Create and open Etherpad and Ethercalc documents. @@ -1000,18 +1000,18 @@ iCZ2x+69UCDEQyfCSKajgAYT17r3OhZei8F9KSCH8Vw=', This application requires to have access to an instance of Etherpad and/or Ethercalc to work properly. ', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Olivier Tétard', 'mail' => 'olivier.tetard@miskin.fr', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1040,14 +1040,14 @@ ifneTw/Ba1d0AXBOq0c0HFyGxMPIlWe4qn5LtxH5t0wyVGeSj4jyv4nvd3ZGuAgY EUa2uYht/z475k4+vf0YhV98iQH07GnmlfD2TDZgmOCQGKlNfJh1v88OZyLLa3dz gRHzGwKbAiJ8T8bbpZ3e2ozXxADr -----END CERTIFICATE-----', - ), + ], 9 => - array ( + [ 'id' => 'announcementcenter', 'categories' => - array ( + [ 0 => 'organization', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -1056,28 +1056,28 @@ gRHzGwKbAiJ8T8bbpZ3e2ozXxADr 'created' => '2016-09-14T10:38:53.939634Z', 'lastModified' => '2016-11-24T11:21:50.324839Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '2.0.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/announcementcenter/releases/download/v2.0.0/announcementcenter-2.0.0.tar.gz', 'created' => '2016-10-06T12:41:56.195206Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-10-06T12:41:56.263124Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1089,36 +1089,36 @@ iWUb/Uv/ODj74wVDWqWxAFKaAG/FestCB3InOOZQqQZLzlAV0U9ziYDGNzBjFqof OfQFKEjtsx+bNLa6CkAaocHGHJXAofX3GQZ9cjBsjZqiTfbXfcVk0kRfz7pwL92L I1McfJYvgMxDQG5bjRpNJw==', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://github.com/nextcloud/announcementcenter/raw/stable10/docs/AnnouncementCenterFrontpage.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Announcement Center', 'summary' => 'An announcement center for Nextcloud', 'description' => 'An announcement center for Nextcloud', - ), - ), + ], + ], 'isFeatured' => true, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Joas Schilling', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.75, 'ratingOverall' => 0.75, 'ratingNumRecent' => 0, @@ -1142,15 +1142,15 @@ sli/yAYQRTVDsXD8A3ACYT7BG31jGxyXtIHzqCci0MhZFdKKayMYkwfjZchIUtGN JJoU8LQoHwGRtp3wutk0GlFzpEQEvSsn/Lsvvot5IfIe46tnzA6MVj5s64s5G8+Q phhXFlzXqO/VxquPdbfYjvU= -----END CERTIFICATE-----', - ), + ], 11 => - array ( + [ 'id' => 'rainloop', 'categories' => - array ( + [ 0 => 'social', 1 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => '', 'developerDocs' => '', @@ -1159,28 +1159,28 @@ phhXFlzXqO/VxquPdbfYjvU= 'created' => '2016-10-20T04:17:37.217555Z', 'lastModified' => '2016-11-18T11:36:04.309739Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '4.26.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '>=5.4.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/pierre-alain-b/rainloop-nextcloud/releases/download/v4.26.0/rainloop-4.26.0.tar.gz', 'created' => '2016-10-20T04:28:21.491747Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-18T11:36:04.619927Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.4', @@ -1197,36 +1197,36 @@ LhIczc32ECi3ZVVgyF8zyT4Y/3MRS05oX3FHvHyt88mjni6bVaO78F7ZRSha8gHh NOAkku7AMXPvUCHaZP2iVCCoAViEso8GeR3O8xh2G42Ai61RLYwx8LB1+23EoJTr mfFuRYNSg+qAKCokXNnh+lDlwu4AkaQo3vtKGPXvU7A=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/pierre-alain-b/rainloop-nextcloud/master/screenshots/2016.10.20-screenshot.jpg', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'RainLoop', 'summary' => 'RainLoop Webmail', 'description' => 'Simple, modern and fast web-based email client.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'RainLoop Team', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1255,15 +1255,15 @@ pzAeVGiABI/e5URpxzz2UayRX7EE+vtpe3B84hzkLqsq0N39ZN6KLfaTyEBGLzqE iLYeXQTV0XSRs8xVt+iyGlj7nPkv2DR0oCqRpWUFWeSBI//niDG5WxS3qg8kacSW fDSYhSN+IjrnIkwNtc8V9t7/GeQB5FE= -----END CERTIFICATE-----', - ), + ], 12 => - array ( + [ 'id' => 'richdocuments', 'categories' => - array ( + [ 0 => 'integration', 1 => 'office', - ), + ], 'userDocs' => 'https://nextcloud.com/collaboraonline/', 'adminDocs' => 'https://nextcloud.com/collaboraonline/', 'developerDocs' => '', @@ -1272,28 +1272,28 @@ fDSYhSN+IjrnIkwNtc8V9t7/GeQB5FE= 'created' => '2016-10-31T08:55:45.631429Z', 'lastModified' => '2016-11-24T12:13:53.905352Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.1.14', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/owncloud/richdocuments/releases/download/1.1.14/richdocuments.tar.gz', 'created' => '2016-11-24T12:10:13.337165Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-24T12:13:53.963638Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1305,48 +1305,48 @@ E1aaRnQfTx488YB8Ubul06LIY0PNCHgGCWPgy817tOVT7JA+V0P0FFonl/PXE0dr WgtxRJmvGaNiFzYq+kQmdKMfayZTm3kdVgP0W52t5wp878K0i4s2KPg5lANvjTz7 DCT+VV2IGIE52o4RpMUGyQ==', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-document.png', - ), + ], 1 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-app.png', - ), + ], 2 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-presentation.png', - ), + ], 3 => - array ( + [ 'url' => 'https://nextcloud.com/wp-content/themes/next/assets/img/features/collabora-spreadsheet.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Collabora Online', 'summary' => 'Edit office documents directly in your browser.', 'description' => 'Collabora Online allows you to to work with all kinds of office documents directly in your browser. This application requires Collabora Cloudsuite to be installed on one of your servers, please read the documentation to learn more about that.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Collabora Productivity based on work of Frank Karlitschek, Victor Dubiniuk', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1370,15 +1370,15 @@ Ru1DXn+LW7TJ4NZ8VtLWvmW/6Kfmi7dQ1V++Kmn0lO5ntRt5altePbStCHC8bhGp myBOrjhrJgLIwvgH26MYZhdiSkFzoE38nMPZdrUmUDxcPCwucWJqgzDPudguFthj WCVZ3TTG/2z3+tWM -----END CERTIFICATE-----', - ), + ], 13 => - array ( + [ 'id' => 'ocr', 'categories' => - array ( + [ 0 => 'files', 1 => 'tools', - ), + ], 'userDocs' => 'https://janis91.github.io/ocr/', 'adminDocs' => 'https://github.com/janis91/ocr/wiki', 'developerDocs' => 'https://github.com/janis91/ocr/wiki', @@ -1387,48 +1387,48 @@ WCVZ3TTG/2z3+tWM 'created' => '2016-09-19T12:07:49.220376Z', 'lastModified' => '2016-11-21T11:22:21.024501Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '1.0.0', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( + [ 0 => - array ( + [ 'id' => 'pgsql', 'versionSpec' => '*', 'rawVersionSpec' => '*', - ), + ], 1 => - array ( + [ 'id' => 'mysql', 'versionSpec' => '*', 'rawVersionSpec' => '*', - ), + ], 2 => - array ( + [ 'id' => 'sqlite', 'versionSpec' => '*', 'rawVersionSpec' => '*', - ), - ), + ], + ], 'shellCommands' => - array ( + [ 0 => 'ocrmypdf', 1 => 'tesseract', - ), + ], 'phpVersionSpec' => '>=5.6.0 <8.0.0', 'platformVersionSpec' => '>=10.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/janis91/ocr/releases/download/v1.0.0/ocr.tar.gz', 'created' => '2016-10-24T06:50:43.283900Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-21T11:22:21.269108Z', 'isNightly' => false, 'rawPhpVersionSpec' => '>=5.6 <=7', @@ -1445,29 +1445,29 @@ D3tJOF7spnK6I3BhVLviou/zs30AIRVBDTU0Orzx78cbInwy6/vyJib2a1olAaHz v05SzlQRnBWM4jYBe0mA/2ds9AO6VrXGrT/iLlHemj6JYoGBM185TGewA7OJyX3a HSlSDqaremmi+aS3onx3AKhXykDxTRkMVarePwTzzFs=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc1.png', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc2.png', - ), + ], 2 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/janis91/ocr/master/screenshots/sc3.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'OCR', 'summary' => 'Character recoginition for your images and pdf files.', 'description' => '# Description @@ -1488,9 +1488,9 @@ The OCR app has some prerequisites: - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 with corresponding language files (e.g. tesseract-ocr-eng) For further information see the homepage or the appropriate documentation.', - ), + ], 'de' => - array ( + [ 'name' => 'OCR', 'summary' => 'Schrifterkennung für Bilder (mit Text) und PDF Dateien.', 'description' => '# Beschreibung @@ -1511,18 +1511,18 @@ Für die OCR App müssen folgende Anforderungen erfüllt sein: - **[tesseract-ocr](https://github.com/tesseract-ocr/tesseract)** >v3.02.02 mit den dazugehörigen Übersetzungs- und Sprachdateien (z. B. tesseract-ocr-deu) Für weiter Informationen besuchen Sie die Homepage oder lesen Sie die zutreffende Dokumentation.', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Janis Koehr', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1551,14 +1551,14 @@ HR7qPCNz4uG2Va7mlUHE3UYUYnlv8JFOV3YdbVL0nxhWwIdzSri5sxFIhdlabpzY yA1z/MCBEyTRo80jxFmL+MpwbsdbUJi7Qxlnd56zb6HHDGrLHXZTh9LXgyVbnhWL kxomWjIXQh4aMHQL4QF7U4EK -----END CERTIFICATE-----', - ), + ], 14 => - array ( + [ 'id' => 'spreedme', 'categories' => - array ( + [ 0 => 'tools', - ), + ], 'userDocs' => 'https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md', 'adminDocs' => 'https://github.com/strukturag/nextcloud-spreedme/blob/master/README.md', 'developerDocs' => '', @@ -1567,28 +1567,28 @@ kxomWjIXQh4aMHQL4QF7U4EK 'created' => '2016-09-27T08:43:07.835196Z', 'lastModified' => '2016-11-21T16:51:23.703819Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.3.4', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://apps.owncloud.com/CONTENT/content-files/174436-spreedme.tar.gz', 'created' => '2016-11-21T16:51:23.689599Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-21T16:51:23.826509Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1605,48 +1605,48 @@ bOks45K5gE1da4QpkYOUQa3GVMNPqPiT3CqjmJ8tjxq7bGpb6v+YoCLACjjPpPZL 8uNawnFwWkicBEYkN/WtBTouWzehOPn38tHXov6SyEyD6lkuxUBZrsGQ2ru+t33U k0kKCbV0GFw43I+3Ji5DiB4TUVNZYVoPG1B7Qve+UfA=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/conference.gif', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/presentation.png', - ), + ], 2 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/import.png', - ), + ], 3 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/strukturag/nextcloud-spreedme/master/screenshots/appstore/users.png', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Spreed.ME', 'summary' => 'Audio-, video- and text chat for your Nextcloud', 'description' => 'Securely communicate with your friends and family using rich audio-, video- and text chat, and much more right from your Nextcloud – in your browser', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'struktur AG', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1675,15 +1675,15 @@ axCNzc7veb2M98hS73w5ZE6vO+C/wz0GTsxuK0AoLitApT5naQnjvxSvSsjFPEGD sUNUEU2Decyp0jxLVnrrpz6Y5UupfBR0V8yAv1t5Od/mCKLc5DxHsDWiKOpsob9U JN+bdzJil2NNftihD4Dm7Ha7OS3O8W0= -----END CERTIFICATE-----', - ), + ], 15 => - array ( + [ 'id' => 'nextant', 'categories' => - array ( + [ 0 => 'files', 1 => 'tools', - ), + ], 'userDocs' => '', 'adminDocs' => 'https://github.com/nextcloud/nextant/wiki', 'developerDocs' => '', @@ -1692,28 +1692,28 @@ JN+bdzJil2NNftihD4Dm7Ha7OS3O8W0= 'created' => '2016-09-14T14:34:35.977699Z', 'lastModified' => '2016-11-22T16:02:57.758477Z', 'releases' => - array ( + [ 0 => - array ( + [ 'version' => '0.6.6', 'phpExtensions' => - array ( - ), + [ + ], 'databases' => - array ( - ), + [ + ], 'shellCommands' => - array ( - ), + [ + ], 'phpVersionSpec' => '*', 'platformVersionSpec' => '>=9.0.0 <12.0.0', 'minIntSize' => 32, 'download' => 'https://github.com/nextcloud/nextant/releases/download/v0.6.6/nextant-0.6.6.tar.gz', 'created' => '2016-11-16T15:11:14.344704Z', 'licenses' => - array ( + [ 0 => 'agpl', - ), + ], 'lastModified' => '2016-11-16T20:39:59.030384Z', 'isNightly' => false, 'rawPhpVersionSpec' => '*', @@ -1730,25 +1730,25 @@ oAKv2GkvWPQ0aiiBtA1i4oXuzvHW/M2wOrK7v7DCpNfILrD/sjxpljxcX082nRCd se+kc/a4iB3BoCNX3E942pBBzew4ya8LkCXdCHUUsuelDf1va1ikTh/G7D84ll9/ 2avNqQnUh3hgOnxFCLI/5VrbqxfSTVdO6O/LTuAmwgw=', 'translations' => - array ( - ), - ), - ), + [ + ], + ], + ], 'screenshots' => - array ( + [ 0 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/displayResult.jpg', - ), + ], 1 => - array ( + [ 'url' => 'https://raw.githubusercontent.com/nextcloud/nextant/master/screenshots/admin.jpg', - ), - ), + ], + ], 'translations' => - array ( + [ 'en' => - array ( + [ 'name' => 'Nextant', 'summary' => 'Navigate through your cloud using Solr', 'description' => ' @@ -1787,18 +1787,18 @@ se+kc/a4iB3BoCNX3E942pBBzew4ya8LkCXdCHUUsuelDf1va1ikTh/G7D84ll9/ ', - ), - ), + ], + ], 'isFeatured' => false, 'authors' => - array ( + [ 0 => - array ( + [ 'name' => 'Maxence Lange', 'mail' => '', 'homepage' => '', - ), - ), + ], + ], 'ratingRecent' => 0.5, 'ratingOverall' => 0.5, 'ratingNumRecent' => 0, @@ -1827,12 +1827,12 @@ my7Z1C7jG9/h57vx0+QBMDCYnTmqLsvMKqo27uHskzAiB7VXLEdSZ2FtMGHkLUQO 0bfhnvTZ2VhMmK83t7ovo71An4ycmsolGD/MA0vNI78VrVISrdI8rRh2WntUnCBU EJL3BaQAQaASSsvFrcozYxrQG4VzEg== -----END CERTIFICATE-----', - ), - ), + ], + ], 'timestamp' => 1234, 'ncversion' => '11.0.0.2', 'ETag' => '"myETag"', - ); + ]; protected function setUp(): void { @@ -1946,14 +1946,14 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== public function testAppstoreDisabled() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($var, $default) { + ->willReturnCallback(function($var, $default) { if ($var === 'appstoreenabled') { return false; } else if ($var === 'version') { return '11.0.0.2'; } return $default; - })); + }); $this->appData ->expects($this->never()) ->method('getFolder'); @@ -1965,14 +1965,14 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg== public function testNoInternet() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($var, $default) { + ->willReturnCallback(function($var, $default) { if ($var === 'has_internet_connection') { return false; } else if ($var === 'version') { return '11.0.0.2'; } return $default; - })); + }); $this->appData ->expects($this->never()) ->method('getFolder'); diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php index 8a82322b61c..22e7a8742ec 100644 --- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php @@ -41,12 +41,12 @@ class CategoryFetcherTest extends FetcherBase { public function testAppstoreDisabled() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($var, $default) { + ->willReturnCallback(function($var, $default) { if ($var === 'appstoreenabled') { return false; } return $default; - })); + }); $this->appData ->expects($this->never()) ->method('getFolder'); @@ -57,12 +57,12 @@ class CategoryFetcherTest extends FetcherBase { public function testNoInternet() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($var, $default) { + ->willReturnCallback(function($var, $default) { if ($var === 'has_internet_connection') { return false; } return $default; - })); + }); $this->appData ->expects($this->never()) ->method('getFolder'); diff --git a/tests/lib/App/CodeChecker/InfoCheckerTest.php b/tests/lib/App/CodeChecker/InfoCheckerTest.php index 531066a54c6..3b5060ae694 100644 --- a/tests/lib/App/CodeChecker/InfoCheckerTest.php +++ b/tests/lib/App/CodeChecker/InfoCheckerTest.php @@ -22,7 +22,6 @@ namespace Test\App\CodeChecker; use OC\App\CodeChecker\InfoChecker; -use OC\App\InfoParser; use Test\TestCase; class InfoCheckerTest extends TestCase { diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php index 943b53eee64..52965d4a72d 100644 --- a/tests/lib/App/DependencyAnalyzerTest.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -32,41 +32,41 @@ class DependencyAnalyzerTest extends TestCase { ->getMock(); $this->platformMock->expects($this->any()) ->method('getPhpVersion') - ->will( $this->returnValue('5.4.3')); + ->willReturn( '5.4.3'); $this->platformMock->expects($this->any()) ->method('getIntSize') - ->will( $this->returnValue('4')); + ->willReturn( '4'); $this->platformMock->expects($this->any()) ->method('getDatabase') - ->will( $this->returnValue('mysql')); + ->willReturn( 'mysql'); $this->platformMock->expects($this->any()) ->method('getOS') - ->will( $this->returnValue('Linux')); + ->willReturn( 'Linux'); $this->platformMock->expects($this->any()) ->method('isCommandKnown') - ->will( $this->returnCallback(function($command) { + ->willReturnCallback( function($command) { return ($command === 'grep'); - })); + }); $this->platformMock->expects($this->any()) ->method('getLibraryVersion') - ->will( $this->returnCallback(function($lib) { + ->willReturnCallback( function($lib) { if ($lib === 'curl') { return "2.3.4"; } return null; - })); + }); $this->platformMock->expects($this->any()) ->method('getOcVersion') - ->will( $this->returnValue('8.0.2')); + ->willReturn( '8.0.2'); $this->l10nMock = $this->getMockBuilder(IL10N::class) ->disableOriginalConstructor() ->getMock(); $this->l10nMock->expects($this->any()) ->method('t') - ->will($this->returnCallback(function($text, $parameters = array()) { + ->willReturnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); - })); + }); $this->analyser = new DependencyAnalyzer($this->platformMock, $this->l10nMock); } @@ -80,11 +80,11 @@ class DependencyAnalyzerTest extends TestCase { * @param string $intSize */ public function testPhpVersion($expectedMissing, $minVersion, $maxVersion, $intSize) { - $app = array( - 'dependencies' => array( - 'php' => array() - ) - ); + $app = [ + 'dependencies' => [ + 'php' => [] + ] + ]; if (!is_null($minVersion)) { $app['dependencies']['php']['@attributes']['min-version'] = $minVersion; } @@ -126,10 +126,10 @@ class DependencyAnalyzerTest extends TestCase { * @param string|null $commands */ public function testCommand($expectedMissing, $commands) { - $app = array( - 'dependencies' => array( - ) - ); + $app = [ + 'dependencies' => [ + ] + ]; if (!is_null($commands)) { $app['dependencies']['command'] = $commands; } @@ -145,10 +145,10 @@ class DependencyAnalyzerTest extends TestCase { * @param $libs */ function testLibs($expectedMissing, $libs) { - $app = array( - 'dependencies' => array( - ) - ); + $app = [ + 'dependencies' => [ + ] + ]; if (!is_null($libs)) { $app['dependencies']['lib'] = $libs; } @@ -165,9 +165,9 @@ class DependencyAnalyzerTest extends TestCase { * @param $oss */ function testOS($expectedMissing, $oss) { - $app = array( - 'dependencies' => array() - ); + $app = [ + 'dependencies' => [] + ]; if (!is_null($oss)) { $app['dependencies']['os'] = $oss; } @@ -184,9 +184,9 @@ class DependencyAnalyzerTest extends TestCase { * @param $oc */ function testOC($expectedMissing, $oc) { - $app = array( - 'dependencies' => array() - ); + $app = [ + 'dependencies' => [] + ]; if (!is_null($oc)) { $app['dependencies'] = $oc; } @@ -429,12 +429,12 @@ class DependencyAnalyzerTest extends TestCase { * @return array */ function providesOS() { - return array( - array(array(), null), - array(array(), array()), - array(array('Following platforms are supported: ANDROID'), 'ANDROID'), - array(array('Following platforms are supported: WINNT'), array('WINNT')) - ); + return [ + [[], null], + [[], []], + [['Following platforms are supported: ANDROID'], 'ANDROID'], + [['Following platforms are supported: WINNT'], ['WINNT']] + ]; } /** @@ -489,28 +489,28 @@ class DependencyAnalyzerTest extends TestCase { * @return array */ function providesDatabases() { - return array( + return [ // non BC - in case on databases are defined -> all are supported - array(array(), null), - array(array(), array()), - array(array('Following databases are supported: mongodb'), 'mongodb'), - array(array('Following databases are supported: sqlite, postgres'), array('sqlite', array('@value' => 'postgres'))), - ); + [[], null], + [[], []], + [['Following databases are supported: mongodb'], 'mongodb'], + [['Following databases are supported: sqlite, postgres'], ['sqlite', ['@value' => 'postgres']]], + ]; } /** * @return array */ function providesPhpVersion() { - return array( - array(array(), null, null, null), - array(array(), '5.4', null, null), - array(array(), null, '5.5', null), - array(array(), '5.4', '5.5', null), - array(array('PHP 5.4.4 or higher is required.'), '5.4.4', null, null), - array(array('PHP with a version lower than 5.4.2 is required.'), null, '5.4.2', null), - array(array('64bit or higher PHP required.'), null, null, 64), - array(array(), '5.4', '5.4', null), - ); + return [ + [[], null, null, null], + [[], '5.4', null, null], + [[], null, '5.5', null], + [[], '5.4', '5.5', null], + [['PHP 5.4.4 or higher is required.'], '5.4.4', null, null], + [['PHP with a version lower than 5.4.2 is required.'], null, '5.4.2', null], + [['64bit or higher PHP required.'], null, null, 64], + [[], '5.4', '5.4', null], + ]; } } diff --git a/tests/lib/App/PlatformRepositoryTest.php b/tests/lib/App/PlatformRepositoryTest.php index 783f8f473ff..555247f7dda 100644 --- a/tests/lib/App/PlatformRepositoryTest.php +++ b/tests/lib/App/PlatformRepositoryTest.php @@ -25,41 +25,41 @@ class PlatformRepositoryTest extends \Test\TestCase { } public function providesVersions() { - return array( - 'none' => array('1.0.0', '1.0.0.0'), - 'none/2' => array('1.2.3.4', '1.2.3.4'), - 'parses state' => array('1.0.0RC1dev', '1.0.0.0-RC1-dev'), - 'CI parsing' => array('1.0.0-rC15-dev', '1.0.0.0-RC15-dev'), - 'delimiters' => array('1.0.0.RC.15-dev', '1.0.0.0-RC15-dev'), - 'RC uppercase' => array('1.0.0-rc1', '1.0.0.0-RC1'), - 'patch replace' => array('1.0.0.pl3-dev', '1.0.0.0-patch3-dev'), - 'forces w.x.y.z' => array('1.0-dev', '1.0.0.0-dev'), - 'forces w.x.y.z/2' => array('0', '0.0.0.0'), - 'parses long' => array('10.4.13-beta', '10.4.13.0-beta'), - 'parses long/2' => array('10.4.13beta2', '10.4.13.0-beta2'), - 'parses long/semver' => array('10.4.13beta.2', '10.4.13.0-beta2'), - 'expand shorthand' => array('10.4.13-b', '10.4.13.0-beta'), - 'expand shorthand2' => array('10.4.13-b5', '10.4.13.0-beta5'), - 'strips leading v' => array('v1.0.0', '1.0.0.0'), - 'strips v/datetime' => array('v20100102', '20100102'), - 'parses dates y-m' => array('2010.01', '2010-01'), - 'parses dates w/ .' => array('2010.01.02', '2010-01-02'), - 'parses dates w/ -' => array('2010-01-02', '2010-01-02'), - 'parses numbers' => array('2010-01-02.5', '2010-01-02-5'), - 'parses dates y.m.Y' => array('2010.1.555', '2010.1.555.0'), - 'parses datetime' => array('20100102-203040', '20100102-203040'), - 'parses dt+number' => array('20100102203040-10', '20100102203040-10'), - 'parses dt+patch' => array('20100102-203040-p1', '20100102-203040-patch1'), - 'parses master' => array('dev-master', '9999999-dev'), - 'parses trunk' => array('dev-trunk', '9999999-dev'), + return [ + 'none' => ['1.0.0', '1.0.0.0'], + 'none/2' => ['1.2.3.4', '1.2.3.4'], + 'parses state' => ['1.0.0RC1dev', '1.0.0.0-RC1-dev'], + 'CI parsing' => ['1.0.0-rC15-dev', '1.0.0.0-RC15-dev'], + 'delimiters' => ['1.0.0.RC.15-dev', '1.0.0.0-RC15-dev'], + 'RC uppercase' => ['1.0.0-rc1', '1.0.0.0-RC1'], + 'patch replace' => ['1.0.0.pl3-dev', '1.0.0.0-patch3-dev'], + 'forces w.x.y.z' => ['1.0-dev', '1.0.0.0-dev'], + 'forces w.x.y.z/2' => ['0', '0.0.0.0'], + 'parses long' => ['10.4.13-beta', '10.4.13.0-beta'], + 'parses long/2' => ['10.4.13beta2', '10.4.13.0-beta2'], + 'parses long/semver' => ['10.4.13beta.2', '10.4.13.0-beta2'], + 'expand shorthand' => ['10.4.13-b', '10.4.13.0-beta'], + 'expand shorthand2' => ['10.4.13-b5', '10.4.13.0-beta5'], + 'strips leading v' => ['v1.0.0', '1.0.0.0'], + 'strips v/datetime' => ['v20100102', '20100102'], + 'parses dates y-m' => ['2010.01', '2010-01'], + 'parses dates w/ .' => ['2010.01.02', '2010-01-02'], + 'parses dates w/ -' => ['2010-01-02', '2010-01-02'], + 'parses numbers' => ['2010-01-02.5', '2010-01-02-5'], + 'parses dates y.m.Y' => ['2010.1.555', '2010.1.555.0'], + 'parses datetime' => ['20100102-203040', '20100102-203040'], + 'parses dt+number' => ['20100102203040-10', '20100102203040-10'], + 'parses dt+patch' => ['20100102-203040-p1', '20100102-203040-patch1'], + 'parses master' => ['dev-master', '9999999-dev'], + 'parses trunk' => ['dev-trunk', '9999999-dev'], // 'parses branches' => array('1.x-dev', '1.9999999.9999999.9999999-dev'), - 'parses arbitrary' => array('dev-feature-foo', 'dev-feature-foo'), - 'parses arbitrary2' => array('DEV-FOOBAR', 'dev-FOOBAR'), - 'parses arbitrary3' => array('dev-feature/foo', 'dev-feature/foo'), - 'ignores aliases' => array('dev-master as 1.0.0', '9999999-dev'), + 'parses arbitrary' => ['dev-feature-foo', 'dev-feature-foo'], + 'parses arbitrary2' => ['DEV-FOOBAR', 'dev-FOOBAR'], + 'parses arbitrary3' => ['dev-feature/foo', 'dev-feature/foo'], + 'ignores aliases' => ['dev-master as 1.0.0', '9999999-dev'], // 'semver metadata' => array('dev-master+foo.bar', '9999999-dev'), // 'semver metadata/2' => array('1.0.0-beta.5+foo', '1.0.0.0-beta5'), // 'semver metadata/3' => array('1.0.0+foo', '1.0.0.0'), // 'metadata w/ alias' => array('1.0.0+foo as 2.0', '1.0.0.0'), - ); + ]; }} diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php index ccc694942a1..fd83b6feae5 100644 --- a/tests/lib/AppFramework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -30,7 +30,7 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\Response; function rrmdir($directory) { - $files = array_diff(scandir($directory), array('.','..')); + $files = array_diff(scandir($directory), ['.','..']); foreach ($files as $file) { if (is_dir($directory . '/' . $file)) { rrmdir($directory . '/' . $file); @@ -59,12 +59,12 @@ class AppTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', array()); + $this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', []); $this->controller = $this->createMock(Controller::class); $this->dispatcher = $this->createMock(Dispatcher::class); $this->io = $this->createMock(Http\IOutput::class); - $this->headers = array('key' => 'value'); + $this->headers = ['key' => 'value']; $this->output = 'hi'; $this->controllerName = 'Controller'; $this->controllerMethod = 'method'; @@ -72,7 +72,7 @@ class AppTest extends \Test\TestCase { $this->container[$this->controllerName] = $this->controller; $this->container['Dispatcher'] = $this->dispatcher; $this->container['OCP\\AppFramework\\Http\\IOutput'] = $this->io; - $this->container['urlParams'] = array(); + $this->container['urlParams'] = []; $this->appPath = __DIR__ . '/../../../apps/namespacetestapp'; $infoXmlPath = $this->appPath . '/appinfo/info.xml'; @@ -93,7 +93,7 @@ class AppTest extends \Test\TestCase { ->method('dispatch') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) - ->will($this->returnValue($return)); + ->willReturn($return); $this->io->expects($this->never()) ->method('setOutput'); @@ -133,7 +133,7 @@ class AppTest extends \Test\TestCase { ->method('dispatch') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) - ->will($this->returnValue($return)); + ->willReturn($return); $this->io->expects($this->once()) ->method('setOutput') ->with($this->equalTo($this->output)); @@ -156,7 +156,7 @@ class AppTest extends \Test\TestCase { ->method('dispatch') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) - ->will($this->returnValue($return)); + ->willReturn($return); $this->io->expects($this->once()) ->method('setHeader') ->with($this->equalTo($statusCode)); @@ -175,7 +175,7 @@ class AppTest extends \Test\TestCase { ->method('dispatch') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) - ->will($this->returnValue($return)); + ->willReturn($return); $mock->expects($this->once()) ->method('callback'); App::main($this->controllerName, $this->controllerMethod, $this->container, []); @@ -190,7 +190,7 @@ class AppTest extends \Test\TestCase { ->method('dispatch') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) - ->will($this->returnValue($return)); + ->willReturn($return); $this->io->expects($this->never()) ->method('setOutput'); @@ -207,7 +207,7 @@ class AppTest extends \Test\TestCase { ->method('dispatch') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) - ->will($this->returnValue($return)); + ->willReturn($return); $this->io->expects($this->never()) ->method('setOutput'); @@ -224,7 +224,7 @@ class AppTest extends \Test\TestCase { ->method('dispatch') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod)) - ->will($this->returnValue($return)); + ->willReturn($return); $this->io->expects($this->never()) ->method('setOutput'); diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php index 8eb76d3cb27..8259ec930fd 100644 --- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php +++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php @@ -23,16 +23,9 @@ namespace Test\AppFramework\Controller; -use OC\AppFramework\Middleware\PublicShare\Exceptions\NeedAuthenticationException; -use OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware; use OCP\AppFramework\AuthPublicShareController; -use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; -use OCP\AppFramework\PublicShareController; -use OCP\Files\NotFoundException; -use OCP\IConfig; use OCP\IRequest; use OCP\ISession; use OCP\IURLGenerator; @@ -136,7 +129,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase { $hashSet = false; $this->session ->method('set') - ->will($this->returnCallback(function($key, $value) use (&$tokenSet, &$hashSet) { + ->willReturnCallback(function($key, $value) use (&$tokenSet, &$hashSet) { if ($key === 'public_link_authenticated_token' && $value === 'token') { $tokenSet = true; return true; @@ -146,7 +139,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase { return true; } return false; - })); + }); $this->urlGenerator->method('linkToRoute') ->willReturn('myLink!'); diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index b1cb1ceab6f..f15d178df28 100644 --- a/tests/lib/AppFramework/Controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -27,7 +27,6 @@ use OC\AppFramework\Http\Request; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\JSONResponse; -use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; class ChildController extends Controller { @@ -41,7 +40,7 @@ class ChildController extends Controller { public function custom($in) { $this->registerResponder('json', function ($response) { - return new JSONResponse(array(strlen($response))); + return new JSONResponse([strlen($response)]); }); return $in; @@ -89,7 +88,7 @@ class ControllerTest extends \Test\TestCase { ->getMock(); $this->app->expects($this->any()) ->method('getAppName') - ->will($this->returnValue('apptemplate_advanced')); + ->willReturn('apptemplate_advanced'); $this->controller = new ChildController($this->app, $request); } @@ -103,9 +102,9 @@ class ControllerTest extends \Test\TestCase { public function testFormat() { - $response = $this->controller->buildResponse(array('hi'), 'json'); + $response = $this->controller->buildResponse(['hi'], 'json'); - $this->assertEquals(array('hi'), $response->getData()); + $this->assertEquals(['hi'], $response->getData()); } @@ -118,10 +117,10 @@ class ControllerTest extends \Test\TestCase { 'Feature-Policy' => "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'", ]; - $response = $this->controller->customDataResponse(array('hi')); + $response = $this->controller->customDataResponse(['hi']); $response = $this->controller->buildResponse($response, 'json'); - $this->assertEquals(array('hi'), $response->getData()); + $this->assertEquals(['hi'], $response->getData()); $this->assertEquals(300, $response->getStatus()); $this->assertEquals($expectedHeaders, $response->getHeaders()); } @@ -131,7 +130,7 @@ class ControllerTest extends \Test\TestCase { $response = $this->controller->custom('hi'); $response = $this->controller->buildResponse($response, 'json'); - $this->assertEquals(array(2), $response->getData()); + $this->assertEquals([2], $response->getData()); } diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php index 318647ca844..388d5fbeef2 100644 --- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php +++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php @@ -23,18 +23,9 @@ namespace Test\AppFramework\Controller; -use OC\AppFramework\Middleware\PublicShare\Exceptions\NeedAuthenticationException; -use OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware; -use OCP\AppFramework\AuthPublicShareController; -use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\NotFoundResponse; -use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\PublicShareController; -use OCP\Files\NotFoundException; -use OCP\IConfig; use OCP\IRequest; use OCP\ISession; -use OCP\IURLGenerator; class PublicShareControllerTest extends \Test\TestCase { diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php index c8ebda55a86..43770eba17a 100644 --- a/tests/lib/AppFramework/Db/EntityTest.php +++ b/tests/lib/AppFramework/Db/EntityTest.php @@ -77,15 +77,15 @@ class EntityTest extends \Test\TestCase { $entity->setId(3); $entity->resetUpdatedFields(); - $this->assertEquals(array(), $entity->getUpdatedFields()); + $this->assertEquals([], $entity->getUpdatedFields()); } public function testFromRow(){ - $row = array( + $row = [ 'pre_name' => 'john', 'email' => 'john@something.com' - ); + ]; $this->entity = TestEntity::fromRow($row); $this->assertEquals($row['pre_name'], $this->entity->getPreName()); @@ -153,7 +153,7 @@ class EntityTest extends \Test\TestCase { public function testFromRowShouldNotAssignEmptyArray(){ - $row = array(); + $row = []; $entity2 = new TestEntity(); $this->entity = TestEntity::fromRow($row); @@ -162,7 +162,7 @@ class EntityTest extends \Test\TestCase { public function testIdGetsConvertedToInt(){ - $row = array('id' => '4'); + $row = ['id' => '4']; $this->entity = TestEntity::fromRow($row); $this->assertSame(4, $this->entity->getId()); @@ -170,7 +170,7 @@ class EntityTest extends \Test\TestCase { public function testSetType(){ - $row = array('testId' => '4'); + $row = ['testId' => '4']; $this->entity = TestEntity::fromRow($row); $this->assertSame(4, $this->entity->getTestId()); @@ -178,10 +178,10 @@ class EntityTest extends \Test\TestCase { public function testFromParams(){ - $params = array( + $params = [ 'testId' => 4, 'email' => 'john@doe' - ); + ]; $entity = TestEntity::fromParams($params); @@ -215,12 +215,12 @@ class EntityTest extends \Test\TestCase { public function testGetFieldTypes() { $entity = new TestEntity(); - $this->assertEquals(array( + $this->assertEquals([ 'id' => 'integer', 'testId' => 'integer', 'trueOrFalse' => 'bool', 'anotherBool' => 'boolean', - ), $entity->getFieldTypes()); + ], $entity->getFieldTypes()); } diff --git a/tests/lib/AppFramework/Db/MapperTest.php b/tests/lib/AppFramework/Db/MapperTest.php index a69980fbb26..79a9a1884e0 100644 --- a/tests/lib/AppFramework/Db/MapperTest.php +++ b/tests/lib/AppFramework/Db/MapperTest.php @@ -73,28 +73,28 @@ class MapperTest extends MapperTestUtility { public function testFindQuery(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('hi') - ); + $params = ['jo']; + $rows = [ + ['hi'] + ]; $this->setMapperResult($sql, $params, $rows); $this->mapper->find($sql, $params); } public function testFindEntity(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('pre_name' => 'hi') - ); + $params = ['jo']; + $rows = [ + ['pre_name' => 'hi'] + ]; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->mapper->findOneEntity($sql, $params); } public function testFindNotFound(){ $sql = 'hi'; - $params = array('jo'); - $rows = array(); + $params = ['jo']; + $rows = []; $this->setMapperResult($sql, $params, $rows); $this->expectException(DoesNotExistException::class); $this->mapper->find($sql, $params); @@ -102,8 +102,8 @@ class MapperTest extends MapperTestUtility { public function testFindEntityNotFound(){ $sql = 'hi'; - $params = array('jo'); - $rows = array(); + $params = ['jo']; + $rows = []; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->expectException(DoesNotExistException::class); $this->mapper->findOneEntity($sql, $params); @@ -111,10 +111,10 @@ class MapperTest extends MapperTestUtility { public function testFindMultiple(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('jo'), array('ho') - ); + $params = ['jo']; + $rows = [ + ['jo'], ['ho'] + ]; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->expectException(MultipleObjectsReturnedException::class); $this->mapper->find($sql, $params); @@ -122,10 +122,10 @@ class MapperTest extends MapperTestUtility { public function testFindEntityMultiple(){ $sql = 'hi'; - $params = array('jo'); - $rows = array( - array('jo'), array('ho') - ); + $params = ['jo']; + $rows = [ + ['jo'], ['ho'] + ]; $this->setMapperResult($sql, $params, $rows, null, null, true); $this->expectException(MultipleObjectsReturnedException::class); $this->mapper->findOneEntity($sql, $params); @@ -134,7 +134,7 @@ class MapperTest extends MapperTestUtility { public function testDelete(){ $sql = 'DELETE FROM `*PREFIX*table` WHERE `id` = ?'; - $params = array(2); + $params = [2]; $this->setMapperResult($sql, $params, [], null, null, true); $entity = new Example(); @@ -148,12 +148,12 @@ class MapperTest extends MapperTestUtility { $this->db->expects($this->once()) ->method('lastInsertId') ->with($this->equalTo('*PREFIX*table')) - ->will($this->returnValue(3)); + ->willReturn(3); $this->mapper = new ExampleMapper($this->db); $sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' . 'VALUES(?,?)'; - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -168,12 +168,12 @@ class MapperTest extends MapperTestUtility { $this->db->expects($this->once()) ->method('lastInsertId') ->with($this->equalTo('*PREFIX*table')) - ->will($this->returnValue(3)); + ->willReturn(3); $this->mapper = new ExampleMapper($this->db); $sql = 'INSERT INTO `*PREFIX*table`(`pre_name`,`email`) ' . 'VALUES(?,?)'; - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -202,7 +202,7 @@ class MapperTest extends MapperTestUtility { '`email` = ? ' . 'WHERE `id` = ?'; - $params = array('john', 'my@email', 1); + $params = ['john', 'my@email', 1]; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -215,7 +215,7 @@ class MapperTest extends MapperTestUtility { public function testUpdateNoId(){ - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setPreName($params[0]); $entity->setEmail($params[1]); @@ -227,7 +227,7 @@ class MapperTest extends MapperTestUtility { public function testUpdateNothingChangedNoQuery(){ - $params = array('john', 'my@email'); + $params = ['john', 'my@email']; $entity = new Example(); $entity->setId(3); $entity->setEmail($params[1]); @@ -241,7 +241,7 @@ class MapperTest extends MapperTestUtility { public function testMapRowToEntity(){ - $entity1 = $this->mapper->mapRow(array('pre_name' => 'test1', 'email' => 'test2')); + $entity1 = $this->mapper->mapRow(['pre_name' => 'test1', 'email' => 'test2']); $entity2 = new Example(); $entity2->setPreName('test1'); $entity2->setEmail('test2'); @@ -251,38 +251,38 @@ class MapperTest extends MapperTestUtility { public function testFindEntities(){ $sql = 'hi'; - $rows = array( - array('pre_name' => 'hi') - ); + $rows = [ + ['pre_name' => 'hi'] + ]; $entity = new Example(); $entity->setPreName('hi'); $entity->resetUpdatedFields(); - $this->setMapperResult($sql, array(), $rows, null, null, true); + $this->setMapperResult($sql, [], $rows, null, null, true); $result = $this->mapper->findAllEntities($sql); - $this->assertEquals(array($entity), $result); + $this->assertEquals([$entity], $result); } public function testFindEntitiesNotFound(){ $sql = 'hi'; - $rows = array(); - $this->setMapperResult($sql, array(), $rows); + $rows = []; + $this->setMapperResult($sql, [], $rows); $result = $this->mapper->findAllEntities($sql); - $this->assertEquals(array(), $result); + $this->assertEquals([], $result); } public function testFindEntitiesMultiple(){ $sql = 'hi'; - $rows = array( - array('pre_name' => 'jo'), array('email' => 'ho') - ); + $rows = [ + ['pre_name' => 'jo'], ['email' => 'ho'] + ]; $entity1 = new Example(); $entity1->setPreName('jo'); $entity1->resetUpdatedFields(); $entity2 = new Example(); $entity2->setEmail('ho'); $entity2->resetUpdatedFields(); - $this->setMapperResult($sql, array(), $rows); + $this->setMapperResult($sql, [], $rows); $result = $this->mapper->findAllEntities($sql); - $this->assertEquals(array($entity1, $entity2), $result); + $this->assertEquals([$entity1, $entity2], $result); } } diff --git a/tests/lib/AppFramework/Db/MapperTestUtility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php index 83156a3932b..11905a9bbbb 100644 --- a/tests/lib/AppFramework/Db/MapperTestUtility.php +++ b/tests/lib/AppFramework/Db/MapperTestUtility.php @@ -89,7 +89,7 @@ abstract class MapperTestUtility extends \Test\TestCase { * of the database query. If not provided, it wont be assumed that fetch * will be called on the result */ - protected function setMapperResult($sql, $arguments=array(), $returnRows=array(), + protected function setMapperResult($sql, $arguments=[], $returnRows=[], $limit=null, $offset=null, $expectClose=false){ if($limit === null && $offset === null) { $this->db->expects($this->at($this->prepareAt)) @@ -124,7 +124,7 @@ abstract class MapperTestUtility extends \Test\TestCase { $this->query->expects($this->any()) ->method('fetch') - ->will($this->returnCallback( + ->willReturnCallback( function() use ($iterators, $fetchAt){ $iterator = $iterators[$fetchAt]; $result = $iterator->next(); @@ -137,7 +137,7 @@ abstract class MapperTestUtility extends \Test\TestCase { return $result; } - )); + ); if ($this->isAssocArray($arguments)) { foreach($arguments as $key => $argument) { @@ -165,9 +165,9 @@ abstract class MapperTestUtility extends \Test\TestCase { $this->query->expects($this->at($this->queryAt)) ->method('execute') - ->will($this->returnCallback(function($sql, $p=null, $o=null, $s=null) { + ->willReturnCallback(function($sql, $p=null, $o=null, $s=null) { - })); + }); $this->queryAt++; diff --git a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php index 6acc21550d1..0c8d125d960 100644 --- a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php @@ -8,7 +8,6 @@ namespace Test\AppFramework\Http; -use OCP\AppFramework\Http; use OCP\AppFramework\Http\ContentSecurityPolicy; /** diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php index b629c6d385e..7af11807d87 100644 --- a/tests/lib/AppFramework/Http/DataResponseTest.php +++ b/tests/lib/AppFramework/Http/DataResponseTest.php @@ -41,15 +41,15 @@ class DataResponseTest extends \Test\TestCase { public function testSetData() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->response->setData($params); - $this->assertEquals(array('hi', 'yo'), $this->response->getData()); + $this->assertEquals(['hi', 'yo'], $this->response->getData()); } public function testConstructorAllowsToSetData() { - $data = array('hi'); + $data = ['hi']; $code = 300; $response = new DataResponse($data, $code); @@ -59,9 +59,9 @@ class DataResponseTest extends \Test\TestCase { public function testConstructorAllowsToSetHeaders() { - $data = array('hi'); + $data = ['hi']; $code = 300; - $headers = array('test' => 'something'); + $headers = ['test' => 'something']; $response = new DataResponse($data, $code, $headers); $expectedHeaders = [ @@ -78,12 +78,12 @@ class DataResponseTest extends \Test\TestCase { public function testChainability() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->response->setData($params) ->setStatus(Http::STATUS_NOT_FOUND); $this->assertEquals(Http::STATUS_NOT_FOUND, $this->response->getStatus()); - $this->assertEquals(array('hi', 'yo'), $this->response->getData()); + $this->assertEquals(['hi', 'yo'], $this->response->getData()); } diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 1c4dc067b5d..b6b43d4a5d3 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -52,9 +52,9 @@ class TestController extends Controller { */ public function exec($int, $bool, $test=4, $test2=1) { $this->registerResponder('text', function($in) { - return new JSONResponse(array('text' => $in)); + return new JSONResponse(['text' => $in]); }); - return array($int, $bool, $test, $test2); + return [$int, $bool, $test, $test2]; } @@ -66,9 +66,9 @@ class TestController extends Controller { * @return DataResponse */ public function execDataResponse($int, $bool, $test=4, $test2=1) { - return new DataResponse(array( - 'text' => array($int, $bool, $test, $test2) - )); + return new DataResponse([ + 'text' => [$int, $bool, $test, $test2] + ]); } } @@ -140,7 +140,7 @@ class DispatcherTest extends \Test\TestCase { * @param string $httpHeaders */ private function setMiddlewareExpectations($out=null, - $httpHeaders=null, $responseHeaders=array(), + $httpHeaders=null, $responseHeaders=[], $ex=false, $catchEx=true) { if($ex) { @@ -156,7 +156,7 @@ class DispatcherTest extends \Test\TestCase { ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod), $this->equalTo($exception)) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); } else { $this->middlewareDispatcher->expects($this->once()) ->method('afterException') @@ -173,51 +173,51 @@ class DispatcherTest extends \Test\TestCase { $this->equalTo($this->controllerMethod)); $this->controller->expects($this->once()) ->method($this->controllerMethod) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); } $this->response->expects($this->once()) ->method('render') - ->will($this->returnValue($out)); + ->willReturn($out); $this->response->expects($this->once()) ->method('getStatus') - ->will($this->returnValue(Http::STATUS_OK)); + ->willReturn(Http::STATUS_OK); $this->response->expects($this->once()) ->method('getLastModified') - ->will($this->returnValue($this->lastModified)); + ->willReturn($this->lastModified); $this->response->expects($this->once()) ->method('getETag') - ->will($this->returnValue($this->etag)); + ->willReturn($this->etag); $this->response->expects($this->once()) ->method('getHeaders') - ->will($this->returnValue($responseHeaders)); + ->willReturn($responseHeaders); $this->http->expects($this->once()) ->method('getStatusHeader') ->with($this->equalTo(Http::STATUS_OK), $this->equalTo($this->lastModified), $this->equalTo($this->etag)) - ->will($this->returnValue($httpHeaders)); + ->willReturn($httpHeaders); $this->middlewareDispatcher->expects($this->once()) ->method('afterController') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod), $this->equalTo($this->response)) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $this->middlewareDispatcher->expects($this->once()) ->method('afterController') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod), $this->equalTo($this->response)) - ->will($this->returnValue($this->response)); + ->willReturn($this->response); $this->middlewareDispatcher->expects($this->once()) ->method('beforeOutput') ->with($this->equalTo($this->controller), $this->equalTo($this->controllerMethod), $this->equalTo($out)) - ->will($this->returnValue($out)); + ->willReturn($out); } @@ -226,7 +226,7 @@ class DispatcherTest extends \Test\TestCase { $response = $this->dispatcher->dispatch($this->controller, $this->controllerMethod); $this->assertNull($response[0]); - $this->assertEquals(array(), $response[1]); + $this->assertEquals([], $response[1]); $this->assertNull($response[2]); } @@ -234,7 +234,7 @@ class DispatcherTest extends \Test\TestCase { public function testHeadersAndOutputAreReturned(){ $out = 'yo'; $httpHeaders = 'Http'; - $responseHeaders = array('hell' => 'yeah'); + $responseHeaders = ['hell' => 'yeah']; $this->setMiddlewareExpectations($out, $httpHeaders, $responseHeaders); $response = $this->dispatcher->dispatch($this->controller, @@ -249,7 +249,7 @@ class DispatcherTest extends \Test\TestCase { public function testExceptionCallsAfterException() { $out = 'yo'; $httpHeaders = 'Http'; - $responseHeaders = array('hell' => 'yeah'); + $responseHeaders = ['hell' => 'yeah']; $this->setMiddlewareExpectations($out, $httpHeaders, $responseHeaders, true); $response = $this->dispatcher->dispatch($this->controller, @@ -281,14 +281,14 @@ class DispatcherTest extends \Test\TestCase { ->method('beforeController'); $this->middlewareDispatcher->expects($this->once()) ->method('afterController') - ->will($this->returnCallback(function($a, $b, $in) { + ->willReturnCallback(function($a, $b, $in) { return $in; - })); + }); $this->middlewareDispatcher->expects($this->once()) ->method('beforeOutput') - ->will($this->returnCallback(function($a, $b, $in) { + ->willReturnCallback(function($a, $b, $in) { return $in; - })); + }); } diff --git a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php index c19caad23c7..121bb904d18 100644 --- a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php @@ -8,7 +8,6 @@ namespace Test\AppFramework\Http; -use OCP\AppFramework\Http; use OCP\AppFramework\Http\EmptyContentSecurityPolicy; /** diff --git a/tests/lib/AppFramework/Http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php index 79c03ce1ab0..14097a2a581 100644 --- a/tests/lib/AppFramework/Http/HttpTest.php +++ b/tests/lib/AppFramework/Http/HttpTest.php @@ -37,7 +37,7 @@ class HttpTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->server = array(); + $this->server = []; $this->http = new Http($this->server); } @@ -56,7 +56,7 @@ class HttpTest extends \Test\TestCase { public function testEtagMatchReturnsNotModified() { - $http = new Http(array('HTTP_IF_NONE_MATCH' => 'hi')); + $http = new Http(['HTTP_IF_NONE_MATCH' => 'hi']); $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); $this->assertEquals('HTTP/1.1 304 Not Modified', $header); @@ -64,7 +64,7 @@ class HttpTest extends \Test\TestCase { public function testQuotedEtagMatchReturnsNotModified() { - $http = new Http(array('HTTP_IF_NONE_MATCH' => '"hi"')); + $http = new Http(['HTTP_IF_NONE_MATCH' => '"hi"']); $header = $http->getStatusHeader(Http::STATUS_OK, null, 'hi'); $this->assertEquals('HTTP/1.1 304 Not Modified', $header); @@ -76,8 +76,8 @@ class HttpTest extends \Test\TestCase { $dateTime->setTimestamp('12'); $http = new Http( - array( - 'HTTP_IF_MODIFIED_SINCE' => 'Thu, 01 Jan 1970 00:00:12 +0000') + [ + 'HTTP_IF_MODIFIED_SINCE' => 'Thu, 01 Jan 1970 00:00:12 +0000'] ); $header = $http->getStatusHeader(Http::STATUS_OK, $dateTime); @@ -87,7 +87,7 @@ class HttpTest extends \Test\TestCase { public function testTempRedirectBecomesFoundInHttp10() { - $http = new Http(array(), 'HTTP/1.0'); + $http = new Http([], 'HTTP/1.0'); $header = $http->getStatusHeader(Http::STATUS_TEMPORARY_REDIRECT); $this->assertEquals('HTTP/1.0 302 Found', $header); diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php index 95d2e2a0a4c..2a0978db62a 100644 --- a/tests/lib/AppFramework/Http/JSONResponseTest.php +++ b/tests/lib/AppFramework/Http/JSONResponseTest.php @@ -49,15 +49,15 @@ class JSONResponseTest extends \Test\TestCase { public function testSetData() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->json->setData($params); - $this->assertEquals(array('hi', 'yo'), $this->json->getData()); + $this->assertEquals(['hi', 'yo'], $this->json->getData()); } public function testSetRender() { - $params = array('test' => 'hi'); + $params = ['test' => 'hi']; $this->json->setData($params); $expected = '{"test":"hi"}'; @@ -100,7 +100,7 @@ class JSONResponseTest extends \Test\TestCase { } public function testConstructorAllowsToSetData() { - $data = array('hi'); + $data = ['hi']; $code = 300; $response = new JSONResponse($data, $code); @@ -110,12 +110,12 @@ class JSONResponseTest extends \Test\TestCase { } public function testChainability() { - $params = array('hi', 'yo'); + $params = ['hi', 'yo']; $this->json->setData($params) ->setStatus(Http::STATUS_NOT_FOUND); $this->assertEquals(Http::STATUS_NOT_FOUND, $this->json->getStatus()); - $this->assertEquals(array('hi', 'yo'), $this->json->getData()); + $this->assertEquals(['hi', 'yo'], $this->json->getData()); } } diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php index 8f6dffd4e91..97951ea4b9f 100644 --- a/tests/lib/AppFramework/Http/RequestStream.php +++ b/tests/lib/AppFramework/Http/RequestStream.php @@ -77,7 +77,7 @@ class RequestStream { public function stream_stat() { $size = strlen($GLOBALS[$this->varname]); $time = time(); - $data = array( + $data = [ 'dev' => 0, 'ino' => 0, 'mode' => 0777, @@ -91,7 +91,7 @@ class RequestStream { 'ctime' => $time, 'blksize' => -1, 'blocks' => -1, - ); + ]; return array_values($data) + $data; //return false; } diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index be019050e1b..8f7c26cc952 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -51,10 +51,10 @@ class RequestTest extends \Test\TestCase { } public function testRequestAccessors() { - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET', - ); + ]; $request = new Request( $vars, @@ -82,12 +82,12 @@ class RequestTest extends \Test\TestCase { // urlParams has precedence over POST which has precedence over GET public function testPrecedence() { - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), - 'post' => array('name' => 'Jane Doe', 'nickname' => 'Janey'), - 'urlParams' => array('user' => 'jw', 'name' => 'Johnny Weissmüller'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], + 'post' => ['name' => 'Jane Doe', 'nickname' => 'Janey'], + 'urlParams' => ['user' => 'jw', 'name' => 'Johnny Weissmüller'], 'method' => 'GET' - ); + ]; $request = new Request( $vars, @@ -107,10 +107,10 @@ class RequestTest extends \Test\TestCase { public function testImmutableArrayAccess() { $this->expectException(\RuntimeException::class); - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET' - ); + ]; $request = new Request( $vars, @@ -127,10 +127,10 @@ class RequestTest extends \Test\TestCase { public function testImmutableMagicAccess() { $this->expectException(\RuntimeException::class); - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET' - ); + ]; $request = new Request( $vars, @@ -147,10 +147,10 @@ class RequestTest extends \Test\TestCase { public function testGetTheMethodRight() { $this->expectException(\LogicException::class); - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET', - ); + ]; $request = new Request( $vars, @@ -164,10 +164,10 @@ class RequestTest extends \Test\TestCase { } public function testTheMethodIsRight() { - $vars = array( - 'get' => array('name' => 'John Q. Public', 'nickname' => 'Joey'), + $vars = [ + 'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'], 'method' => 'GET', - ); + ]; $request = new Request( $vars, @@ -186,10 +186,10 @@ class RequestTest extends \Test\TestCase { public function testJsonPost() { global $data; $data = '{"name": "John Q. Public", "nickname": "Joey"}'; - $vars = array( + $vars = [ 'method' => 'POST', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8') - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'] + ]; $request = new Request( $vars, @@ -210,10 +210,10 @@ class RequestTest extends \Test\TestCase { public function testNotJsonPost() { global $data; $data = 'this is not valid json'; - $vars = array( + $vars = [ 'method' => 'POST', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8') - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'] + ]; $request = new Request( $vars, @@ -230,12 +230,12 @@ class RequestTest extends \Test\TestCase { public function testPatch() { global $data; - $data = http_build_query(array('name' => 'John Q. Public', 'nickname' => 'Joey'), '', '&'); + $data = http_build_query(['name' => 'John Q. Public', 'nickname' => 'Joey'], '', '&'); - $vars = array( + $vars = [ 'method' => 'PATCH', - 'server' => array('CONTENT_TYPE' => 'application/x-www-form-urlencoded'), - ); + 'server' => ['CONTENT_TYPE' => 'application/x-www-form-urlencoded'], + ]; $request = new Request( $vars, @@ -257,10 +257,10 @@ class RequestTest extends \Test\TestCase { // PUT content $data = '{"name": "John Q. Public", "nickname": "Joey"}'; - $vars = array( + $vars = [ 'method' => 'PUT', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8'), - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'], + ]; $request = new Request( $vars, @@ -278,10 +278,10 @@ class RequestTest extends \Test\TestCase { // PATCH content $data = '{"name": "John Q. Public", "nickname": null}'; - $vars = array( + $vars = [ 'method' => 'PATCH', - 'server' => array('CONTENT_TYPE' => 'application/json; utf-8'), - ); + 'server' => ['CONTENT_TYPE' => 'application/json; utf-8'], + ]; $request = new Request( $vars, @@ -302,14 +302,14 @@ class RequestTest extends \Test\TestCase { global $data; $data = file_get_contents(__DIR__ . '/../../../data/testimage.png'); - $vars = array( + $vars = [ 'put' => $data, 'method' => 'PUT', 'server' => [ 'CONTENT_TYPE' => 'image/png', 'CONTENT_LENGTH' => (string)strlen($data) ], - ); + ]; $request = new Request( $vars, @@ -335,11 +335,11 @@ class RequestTest extends \Test\TestCase { public function testSetUrlParameters() { - $vars = array( - 'post' => array(), + $vars = [ + 'post' => [], 'method' => 'POST', - 'urlParams' => array('id' => '2'), - ); + 'urlParams' => ['id' => '2'], + ]; $request = new Request( $vars, @@ -349,7 +349,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $newParams = array('id' => '3', 'test' => 'test2'); + $newParams = ['id' => '3', 'test' => 'test2']; $request->setUrlParameters($newParams); $this->assertSame('test2', $request->getParam('test')); $this->assertEquals('3', $request->getParam('id')); @@ -378,7 +378,7 @@ class RequestTest extends \Test\TestCase { $this->secureRandom->expects($this->once()) ->method('generate') ->with('20') - ->will($this->returnValue('GeneratedByOwnCloudItself')); + ->willReturn('GeneratedByOwnCloudItself'); $request = new Request( [], @@ -409,7 +409,7 @@ class RequestTest extends \Test\TestCase { ->expects($this->once()) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue([])); + ->willReturn([]); $request = new Request( [ @@ -433,12 +433,12 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue(['10.0.0.2'])); + ->willReturn(['10.0.0.2']); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('forwarded_for_headers') - ->will($this->returnValue([])); + ->willReturn([]); $request = new Request( [ @@ -462,12 +462,12 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue(['10.0.0.2'])); + ->willReturn(['10.0.0.2']); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('forwarded_for_headers') - ->will($this->returnValue(['HTTP_X_FORWARDED'])); + ->willReturn(['HTTP_X_FORWARDED']); $request = new Request( [ @@ -491,12 +491,12 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348'])); + ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('forwarded_for_headers') - ->will($this->returnValue(['HTTP_X_FORWARDED'])); + ->willReturn(['HTTP_X_FORWARDED']); $request = new Request( [ @@ -520,16 +520,16 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue(['10.0.0.2'])); + ->willReturn(['10.0.0.2']); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('forwarded_for_headers') - ->will($this->returnValue([ + ->willReturn([ 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED' - ])); + ]); $request = new Request( [ @@ -553,16 +553,16 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue(['2001:db8:85a3:8d3:1319:8a2e:370:7348'])); + ->willReturn(['2001:db8:85a3:8d3:1319:8a2e:370:7348']); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('forwarded_for_headers') - ->will($this->returnValue([ + ->willReturn([ 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED' - ])); + ]); $request = new Request( [ @@ -586,12 +586,12 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue(['192.168.2.0/24'])); + ->willReturn(['192.168.2.0/24']); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('forwarded_for_headers') - ->will($this->returnValue(['HTTP_X_FORWARDED_FOR'])); + ->willReturn(['HTTP_X_FORWARDED_FOR']); $request = new Request( [ @@ -615,7 +615,7 @@ class RequestTest extends \Test\TestCase { ->expects($this->once()) ->method('getSystemValue') ->with('trusted_proxies') - ->will($this->returnValue(['192.168.2.0/24'])); + ->willReturn(['192.168.2.0/24']); $request = new Request( [ @@ -690,17 +690,17 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('overwriteprotocol') - ->will($this->returnValue('customProtocol')); + ->willReturn('customProtocol'); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('overwritecondaddr') - ->will($this->returnValue('')); + ->willReturn(''); $this->config ->expects($this->at(2)) ->method('getSystemValue') ->with('overwriteprotocol') - ->will($this->returnValue('customProtocol')); + ->willReturn('customProtocol'); $request = new Request( [], @@ -716,13 +716,13 @@ class RequestTest extends \Test\TestCase { public function testGetServerProtocolWithProtoValid() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; } return $default; - })); + }); $requestHttps = new Request( [ @@ -757,9 +757,9 @@ class RequestTest extends \Test\TestCase { public function testGetServerProtocolWithHttpsServerValueOn() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { return $default; - })); + }); $request = new Request( [ @@ -778,9 +778,9 @@ class RequestTest extends \Test\TestCase { public function testGetServerProtocolWithHttpsServerValueOff() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { return $default; - })); + }); $request = new Request( [ @@ -799,9 +799,9 @@ class RequestTest extends \Test\TestCase { public function testGetServerProtocolWithHttpsServerValueEmpty() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { return $default; - })); + }); $request = new Request( [ @@ -820,9 +820,9 @@ class RequestTest extends \Test\TestCase { public function testGetServerProtocolDefault() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { return $default; - })); + }); $request = new Request( [], @@ -837,13 +837,13 @@ class RequestTest extends \Test\TestCase { public function testGetServerProtocolBehindLoadBalancers() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; } return $default; - })); + }); $request = new Request( [ @@ -1059,13 +1059,13 @@ class RequestTest extends \Test\TestCase { public function testInsecureServerHostHttpFromForwardedHeaderSingle() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; } return $default; - })); + }); $request = new Request( [ @@ -1088,13 +1088,13 @@ class RequestTest extends \Test\TestCase { public function testInsecureServerHostHttpFromForwardedHeaderStacked() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; } return $default; - })); + }); $request = new Request( [ @@ -1117,7 +1117,7 @@ class RequestTest extends \Test\TestCase { public function testGetServerHostWithOverwriteHost() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'overwritecondaddr') { return ''; } else if ($key === 'overwritehost') { @@ -1125,7 +1125,7 @@ class RequestTest extends \Test\TestCase { } return $default; - })); + }); $request = new Request( [], @@ -1141,7 +1141,7 @@ class RequestTest extends \Test\TestCase { public function testGetServerHostWithTrustedDomain() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; } else if ($key === 'trusted_domains') { @@ -1149,7 +1149,7 @@ class RequestTest extends \Test\TestCase { } return $default; - })); + }); $request = new Request( [ @@ -1170,7 +1170,7 @@ class RequestTest extends \Test\TestCase { public function testGetServerHostWithUntrustedDomain() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; } else if ($key === 'trusted_domains') { @@ -1178,7 +1178,7 @@ class RequestTest extends \Test\TestCase { } return $default; - })); + }); $request = new Request( [ @@ -1199,12 +1199,12 @@ class RequestTest extends \Test\TestCase { public function testGetServerHostWithNoTrustedDomain() { $this->config ->method('getSystemValue') - ->will($this->returnCallback(function($key, $default) { + ->willReturnCallback(function($key, $default) { if ($key === 'trusted_proxies') { return ['1.2.3.4']; } return $default; - })); + }); $request = new Request( [ @@ -1273,7 +1273,7 @@ class RequestTest extends \Test\TestCase { ->expects($this->once()) ->method('getSystemValue') ->with('overwritehost') - ->will($this->returnValue('')); + ->willReturn(''); $request = new Request( [], $this->secureRandom, @@ -1290,17 +1290,17 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('overwritehost') - ->will($this->returnValue('www.owncloud.org')); + ->willReturn('www.owncloud.org'); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('overwritecondaddr') - ->will($this->returnValue('')); + ->willReturn(''); $this->config ->expects($this->at(2)) ->method('getSystemValue') ->with('overwritehost') - ->will($this->returnValue('www.owncloud.org')); + ->willReturn('www.owncloud.org'); $request = new Request( [], @@ -1485,7 +1485,7 @@ class RequestTest extends \Test\TestCase { ->expects($this->once()) ->method('getSystemValue') ->with('overwritewebroot') - ->will($this->returnValue('')); + ->willReturn(''); $request = new Request( [ @@ -1517,12 +1517,12 @@ class RequestTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getSystemValue') ->with('overwritewebroot') - ->will($this->returnValue($overwriteWebRoot)); + ->willReturn($overwriteWebRoot); $this->config ->expects($this->at(1)) ->method('getSystemValue') ->with('overwritecondaddr') - ->will($this->returnValue($overwriteCondAddr)); + ->willReturn($overwriteCondAddr); $request = $this->getMockBuilder('\OC\AppFramework\Http\Request') ->setMethods(['getScriptName']) @@ -1542,7 +1542,7 @@ class RequestTest extends \Test\TestCase { $request ->expects($this->once()) ->method('getScriptName') - ->will($this->returnValue('/scriptname.php')); + ->willReturn('/scriptname.php'); $this->assertSame($expectedUri, $request->getRequestUri()); } diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index 3d76d24496d..86a909b7688 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -49,11 +49,11 @@ class ResponseTest extends \Test\TestCase { public function testSetHeaders() { - $expected = array( + $expected = [ 'Last-Modified' => 1, 'ETag' => 3, 'Something-Else' => 'hi' - ); + ]; $this->childResponse->setHeaders($expected); $headers = $this->childResponse->getHeaders(); @@ -105,31 +105,31 @@ class ResponseTest extends \Test\TestCase { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->addCookie('bar', 'foo', new \DateTime('1970-01-01')); - $expectedResponse = array( - 'foo' => array( + $expectedResponse = [ + 'foo' => [ 'value' => 'bar', 'expireDate' => null, - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'foo', 'expireDate' => new \DateTime('1970-01-01') - ) - ); + ] + ]; $this->assertEquals($expectedResponse, $this->childResponse->getCookies()); } function testSetCookies() { - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'value' => 'bar', 'expireDate' => null, - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'foo', 'expireDate' => new \DateTime('1970-01-01') - ) - ); + ] + ]; $this->childResponse->setCookies($expected); $cookies = $this->childResponse->getCookies(); @@ -141,12 +141,12 @@ class ResponseTest extends \Test\TestCase { function testInvalidateCookie() { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->invalidateCookie('foo'); - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'value' => 'expired', 'expireDate' => new \DateTime('1971-01-01') - ) - ); + ] + ]; $cookies = $this->childResponse->getCookies(); @@ -157,30 +157,30 @@ class ResponseTest extends \Test\TestCase { function testInvalidateCookies() { $this->childResponse->addCookie('foo', 'bar'); $this->childResponse->addCookie('bar', 'foo'); - $expected = array( - 'foo' => array( + $expected = [ + 'foo' => [ 'value' => 'bar', 'expireDate' => null - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'foo', 'expireDate' => null - ) - ); + ] + ]; $cookies = $this->childResponse->getCookies(); $this->assertEquals($expected, $cookies); - $this->childResponse->invalidateCookies(array('foo', 'bar')); - $expected = array( - 'foo' => array( + $this->childResponse->invalidateCookies(['foo', 'bar']); + $expected = [ + 'foo' => [ 'value' => 'expired', 'expireDate' => new \DateTime('1971-01-01') - ), - 'bar' => array( + ], + 'bar' => [ 'value' => 'expired', 'expireDate' => new \DateTime('1971-01-01') - ) - ); + ] + ]; $cookies = $this->childResponse->getCookies(); $this->assertEquals($expected, $cookies); diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php index ef7132013b6..b66d9c5ed1d 100644 --- a/tests/lib/AppFramework/Http/StreamResponseTest.php +++ b/tests/lib/AppFramework/Http/StreamResponseTest.php @@ -44,7 +44,7 @@ class StreamResponseTest extends \Test\TestCase { $path = __FILE__; $this->output->expects($this->once()) ->method('getHttpResponseCode') - ->will($this->returnValue(Http::STATUS_NOT_MODIFIED)); + ->willReturn(Http::STATUS_NOT_MODIFIED); $this->output->expects($this->never()) ->method('setReadfile'); $response = new StreamResponse($path); @@ -56,11 +56,11 @@ class StreamResponseTest extends \Test\TestCase { $path = __FILE__; $this->output->expects($this->once()) ->method('getHttpResponseCode') - ->will($this->returnValue(Http::STATUS_OK)); + ->willReturn(Http::STATUS_OK); $this->output->expects($this->once()) ->method('setReadfile') ->with($this->equalTo($path)) - ->will($this->returnValue(true)); + ->willReturn(true); $response = new StreamResponse($path); $response->callback($this->output); @@ -70,7 +70,7 @@ class StreamResponseTest extends \Test\TestCase { $path = __FILE__ . 'test'; $this->output->expects($this->once()) ->method('getHttpResponseCode') - ->will($this->returnValue(Http::STATUS_OK)); + ->willReturn(Http::STATUS_OK); $this->output->expects($this->never()) ->method('setReadfile'); $this->output->expects($this->once()) @@ -85,10 +85,10 @@ class StreamResponseTest extends \Test\TestCase { $path = __FILE__; $this->output->expects($this->once()) ->method('getHttpResponseCode') - ->will($this->returnValue(Http::STATUS_OK)); + ->willReturn(Http::STATUS_OK); $this->output->expects($this->once()) ->method('setReadfile') - ->will($this->returnValue(false)); + ->willReturn(false); $this->output->expects($this->once()) ->method('setHttpResponseCode') ->with($this->equalTo(Http::STATUS_BAD_REQUEST)); diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php index 6672b4d0c1e..af5b428cf86 100644 --- a/tests/lib/AppFramework/Http/TemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php @@ -41,26 +41,26 @@ class TemplateResponseTest extends \Test\TestCase { public function testSetParamsConstructor(){ - $params = array('hi' => 'yo'); + $params = ['hi' => 'yo']; $this->tpl = new TemplateResponse('app', 'home', $params); - $this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams()); + $this->assertEquals(['hi' => 'yo'], $this->tpl->getParams()); } public function testSetRenderAsConstructor(){ $renderAs = 'myrender'; - $this->tpl = new TemplateResponse('app', 'home', array(), $renderAs); + $this->tpl = new TemplateResponse('app', 'home', [], $renderAs); $this->assertEquals($renderAs, $this->tpl->getRenderAs()); } public function testSetParams(){ - $params = array('hi' => 'yo'); + $params = ['hi' => 'yo']; $this->tpl->setParams($params); - $this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams()); + $this->assertEquals(['hi' => 'yo'], $this->tpl->getParams()); } @@ -75,12 +75,12 @@ class TemplateResponseTest extends \Test\TestCase { } public function testChainability() { - $params = array('hi' => 'yo'); + $params = ['hi' => 'yo']; $this->tpl->setParams($params) ->setStatus(Http::STATUS_NOT_FOUND); $this->assertEquals(Http::STATUS_NOT_FOUND, $this->tpl->getStatus()); - $this->assertEquals(array('hi' => 'yo'), $this->tpl->getParams()); + $this->assertEquals(['hi' => 'yo'], $this->tpl->getParams()); } } diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php index 965637cb4c4..69dd6d16226 100644 --- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php @@ -25,7 +25,6 @@ namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\MiddlewareDispatcher; -use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Middleware; use OCP\IConfig; @@ -158,7 +157,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase { ->getMock(); $m2->expects($this->once()) ->method('afterException') - ->will($this->returnValue($response)); + ->willReturn($response); $this->dispatcher->registerMiddleware($m1); $this->dispatcher->registerMiddleware($m2); @@ -282,7 +281,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase { $m3->expects($this->never()) ->method('afterController'); $m3->method('beforeOutput') - ->will($this->returnArgument(2)); + ->willReturnArgument(2); $this->dispatcher->registerMiddleware($m3); diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index f6ce5c27b22..55c874ccdb5 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -26,7 +26,6 @@ use OC\AppFramework\Utility\ControllerMethodReflector; use OC\Security\Bruteforce\Throttler; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; -use OCP\Http\Client\IResponse; use OCP\IRequest; use Test\TestCase; diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index 1c12a4aa153..691553a13d8 100644 --- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -140,7 +140,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $this->session->expects($this->never()) ->method('logClientIn') ->with($this->equalTo('user'), $this->equalTo('pass')) - ->will($this->returnValue(true)); + ->willReturn(true); $this->reflector->reflect($this, __FUNCTION__); $middleware->beforeController($this->controller, __FUNCTION__); @@ -163,7 +163,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $this->session->expects($this->once()) ->method('logClientIn') ->with($this->equalTo('user'), $this->equalTo('pass')) - ->will($this->returnValue(true)); + ->willReturn(true); $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); @@ -215,7 +215,7 @@ class CORSMiddlewareTest extends \Test\TestCase { $this->session->expects($this->once()) ->method('logClientIn') ->with($this->equalTo('user'), $this->equalTo('pass')) - ->will($this->returnValue(false)); + ->willReturn(false); $this->reflector->reflect($this, __FUNCTION__); $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler); diff --git a/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php index e136d783616..62be8037cfc 100644 --- a/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php @@ -25,12 +25,9 @@ declare(strict_types=1); namespace Test\AppFramework\Middleware\Security; use OC\AppFramework\Middleware\Security\FeaturePolicyMiddleware; -use OC\Security\CSP\ContentSecurityPolicy; -use OC\Security\CSRF\CsrfToken; use OC\Security\FeaturePolicy\FeaturePolicy; use OC\Security\FeaturePolicy\FeaturePolicyManager; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\EmptyContentSecurityPolicy; use OCP\AppFramework\Http\EmptyFeaturePolicy; use OCP\AppFramework\Http\Response; use PHPUnit\Framework\MockObject\MockObject; diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index ae0e6ff484d..85e1ac4e205 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -32,17 +32,10 @@ use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; use OC\Appframework\Middleware\Security\Exceptions\StrictCookieMissingException; use OC\AppFramework\Middleware\Security\SecurityMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; -use OC\Security\CSP\ContentSecurityPolicy; -use OC\Security\CSP\ContentSecurityPolicyManager; -use OC\Security\CSP\ContentSecurityPolicyNonceManager; -use OC\Security\CSRF\CsrfToken; -use OC\Security\CSRF\CsrfTokenManager; use OCP\App\IAppManager; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\EmptyContentSecurityPolicy; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\RedirectResponse; -use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IL10N; @@ -218,7 +211,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { public function testNoChecks(){ $this->request->expects($this->never()) ->method('passesCSRFCheck') - ->will($this->returnValue(false)); + ->willReturn(false); $sec = $this->getMiddleware(false, false, false); @@ -262,10 +255,10 @@ class SecurityMiddlewareTest extends \Test\TestCase { $this->request->expects($this->once()) ->method('passesCSRFCheck') - ->will($this->returnValue(false)); + ->willReturn(false); $this->request->expects($this->once()) ->method('passesStrictCookieCheck') - ->will($this->returnValue(true)); + ->willReturn(true); $this->reader->reflect(__CLASS__, __FUNCTION__); $this->middleware->beforeController($this->controller, __FUNCTION__); } @@ -278,7 +271,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { public function testNoCsrfCheck(){ $this->request->expects($this->never()) ->method('passesCSRFCheck') - ->will($this->returnValue(false)); + ->willReturn(false); $this->reader->reflect(__CLASS__, __FUNCTION__); $this->middleware->beforeController($this->controller, __FUNCTION__); @@ -290,10 +283,10 @@ class SecurityMiddlewareTest extends \Test\TestCase { public function testPassesCsrfCheck(){ $this->request->expects($this->once()) ->method('passesCSRFCheck') - ->will($this->returnValue(true)); + ->willReturn(true); $this->request->expects($this->once()) ->method('passesStrictCookieCheck') - ->will($this->returnValue(true)); + ->willReturn(true); $this->reader->reflect(__CLASS__, __FUNCTION__); $this->middleware->beforeController($this->controller, __FUNCTION__); @@ -307,10 +300,10 @@ class SecurityMiddlewareTest extends \Test\TestCase { $this->request->expects($this->once()) ->method('passesCSRFCheck') - ->will($this->returnValue(false)); + ->willReturn(false); $this->request->expects($this->once()) ->method('passesStrictCookieCheck') - ->will($this->returnValue(true)); + ->willReturn(true); $this->reader->reflect(__CLASS__, __FUNCTION__); $this->middleware->beforeController($this->controller, __FUNCTION__); @@ -327,7 +320,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->method('passesCSRFCheck'); $this->request->expects($this->once()) ->method('passesStrictCookieCheck') - ->will($this->returnValue(false)); + ->willReturn(false); $this->reader->reflect(__CLASS__, __FUNCTION__); $this->middleware->beforeController($this->controller, __FUNCTION__); @@ -341,7 +334,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { public function testNoStrictCookieRequiredCheck() { $this->request->expects($this->never()) ->method('passesStrictCookieCheck') - ->will($this->returnValue(false)); + ->willReturn(false); $this->reader->reflect(__CLASS__, __FUNCTION__); $this->middleware->beforeController($this->controller, __FUNCTION__); @@ -393,7 +386,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { public function testCsrfOcsController(Controller $controller, bool $hasOcsApiHeader, bool $hasBearerAuth, bool $exception) { $this->request ->method('getHeader') - ->will(self::returnCallback(function ($header) use ($hasOcsApiHeader, $hasBearerAuth) { + ->willReturnCallback(function ($header) use ($hasOcsApiHeader, $hasBearerAuth) { if ($header === 'OCS-APIREQUEST' && $hasOcsApiHeader) { return 'true'; } @@ -401,7 +394,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { return 'Bearer TOKEN!'; } return ''; - })); + }); $this->request->expects($this->once()) ->method('passesStrictCookieCheck') ->willReturn(true); @@ -511,7 +504,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { 'redirect_url' => 'nextcloud/index.php/apps/specialapp', ] ) - ->will($this->returnValue('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp')); + ->willReturn('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'); $this->logger ->expects($this->once()) ->method('logException'); diff --git a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php index db2a9d5b625..940112311c3 100644 --- a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php @@ -11,12 +11,10 @@ namespace Test\AppFramework\Middleware; -use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\SessionMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\Response; -use OCP\IConfig; class SessionMiddlewareTest extends \Test\TestCase { diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 1b7ab054a0f..95f8996dbdb 100644 --- a/tests/lib/AppFramework/Routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -15,9 +15,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRoute() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'GET', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -33,9 +33,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithMissingVerb() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'GET', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -51,9 +51,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithLowercaseVerb() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open'); } @@ -69,11 +69,11 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithRequirements() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => array('something')) - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => ['something']] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array('something')); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', ['something']); } public function testSimpleOCSRouteWithRequirements() { @@ -87,11 +87,11 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithDefaults() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', array(), 'defaults' => array('param' => 'foobar')) - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', [], 'defaults' => ['param' => 'foobar']] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array(), array('param' => 'foobar')); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', [], ['param' => 'foobar']); } @@ -106,11 +106,11 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithPostfix() { - $routes = array('routes' => array( - array('name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something') - )); + $routes = ['routes' => [ + ['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something'] + ]]; - $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', array(), array(), '_something'); + $this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/folders/{folderId}/open', 'FoldersController', 'open', [], [], '_something'); } public function testSimpleOCSRouteWithPostfix() { @@ -127,9 +127,9 @@ class RoutingTest extends \Test\TestCase { $this->expectException(\UnexpectedValueException::class); - $routes = array('routes' => array( - array('name' => 'folders_open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'folders_open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; // router mock $router = $this->getMockBuilder('\OC\Route\Router') @@ -167,9 +167,9 @@ class RoutingTest extends \Test\TestCase public function testSimpleRouteWithUnderScoreNames() { - $routes = array('routes' => array( - array('name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete') - )); + $routes = ['routes' => [ + ['name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete'] + ]]; $this->assertSimpleRoute($routes, 'admin_folders.open_current', 'DELETE', '/folders/{folderId}/open', 'AdminFoldersController', 'openCurrent'); } @@ -205,14 +205,14 @@ class RoutingTest extends \Test\TestCase public function testResource() { - $routes = array('resources' => array('account' => array('url' => '/accounts'))); + $routes = ['resources' => ['account' => ['url' => '/accounts']]]; $this->assertResource($routes, 'account', '/accounts', 'AccountController', 'id'); } public function testResourceWithUnderScoreName() { - $routes = array('resources' => array('admin_accounts' => array('url' => '/admin/accounts'))); + $routes = ['resources' => ['admin_accounts' => ['url' => '/admin/accounts']]]; $this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'id'); } @@ -224,7 +224,7 @@ class RoutingTest extends \Test\TestCase * @param string $controllerName * @param string $actionName */ - private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=array(), array $defaults=array(), $postfix='') + private function assertSimpleRoute($routes, $name, $verb, $url, $controllerName, $actionName, array $requirements=[], array $defaults=[], $postfix='') { if ($postfix) { $name .= $postfix; @@ -245,7 +245,7 @@ class RoutingTest extends \Test\TestCase ->expects($this->once()) ->method('create') ->with($this->equalTo('app1.' . $name), $this->equalTo($url)) - ->will($this->returnValue($route)); + ->willReturn($route); // load route configuration $config = new RouteConfig($container, $router, $routes); @@ -270,8 +270,8 @@ class RoutingTest extends \Test\TestCase $url, $controllerName, $actionName, - array $requirements=array(), - array $defaults=array(), + array $requirements=[], + array $defaults=[], $postfix='') { if ($postfix) { @@ -293,7 +293,7 @@ class RoutingTest extends \Test\TestCase ->expects($this->once()) ->method('create') ->with($this->equalTo('ocs.app1.' . $name), $this->equalTo($url)) - ->will($this->returnValue($route)); + ->willReturn($route); // load route configuration $config = new RouteConfig($container, $router, $routes); @@ -391,31 +391,31 @@ class RoutingTest extends \Test\TestCase ->expects($this->at(0)) ->method('create') ->with($this->equalTo('app1.' . $resourceName . '.index'), $this->equalTo($url)) - ->will($this->returnValue($indexRoute)); + ->willReturn($indexRoute); $router ->expects($this->at(1)) ->method('create') ->with($this->equalTo('app1.' . $resourceName . '.show'), $this->equalTo($urlWithParam)) - ->will($this->returnValue($showRoute)); + ->willReturn($showRoute); $router ->expects($this->at(2)) ->method('create') ->with($this->equalTo('app1.' . $resourceName . '.create'), $this->equalTo($url)) - ->will($this->returnValue($createRoute)); + ->willReturn($createRoute); $router ->expects($this->at(3)) ->method('create') ->with($this->equalTo('app1.' . $resourceName . '.update'), $this->equalTo($urlWithParam)) - ->will($this->returnValue($updateRoute)); + ->willReturn($updateRoute); $router ->expects($this->at(4)) ->method('create') ->with($this->equalTo('app1.' . $resourceName . '.destroy'), $this->equalTo($urlWithParam)) - ->will($this->returnValue($destroyRoute)); + ->willReturn($destroyRoute); // load route configuration $config = new RouteConfig($container, $router, $yaml); @@ -437,8 +437,8 @@ class RoutingTest extends \Test\TestCase $verb, $controllerName, $actionName, - array $requirements=array(), - array $defaults=array() + array $requirements=[], + array $defaults=[] ) { $route = $this->getMockBuilder('\OC\Route\Route') ->setMethods(['method', 'action', 'requirements', 'defaults']) @@ -448,20 +448,20 @@ class RoutingTest extends \Test\TestCase ->expects($this->exactly(1)) ->method('method') ->with($this->equalTo($verb)) - ->will($this->returnValue($route)); + ->willReturn($route); $route ->expects($this->exactly(1)) ->method('action') ->with($this->equalTo(new RouteActionHandler($container, $controllerName, $actionName))) - ->will($this->returnValue($route)); + ->willReturn($route); if(count($requirements) > 0) { $route ->expects($this->exactly(1)) ->method('requirements') ->with($this->equalTo($requirements)) - ->will($this->returnValue($route)); + ->willReturn($route); } if (count($defaults) > 0) { @@ -469,7 +469,7 @@ class RoutingTest extends \Test\TestCase ->expects($this->exactly(1)) ->method('defaults') ->with($this->equalTo($defaults)) - ->will($this->returnValue($route)); + ->willReturn($route); } return $route; diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index fe1fc5bfa1a..5a3c3f2a007 100644 --- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -193,7 +193,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { 'arguments' ); - $this->assertEquals(array('arg' => null, 'arg2' => 'hi'), $reader->getParameters()); + $this->assertEquals(['arg' => null, 'arg2' => 'hi'], $reader->getParameters()); } @@ -205,7 +205,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { 'arguments2' ); - $this->assertEquals(array('arg' => null), $reader->getParameters()); + $this->assertEquals(['arg' => null], $reader->getParameters()); } diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php index 412db90849b..75084e7f0f3 100644 --- a/tests/lib/AppTest.php +++ b/tests/lib/AppTest.php @@ -28,245 +28,245 @@ class AppTest extends \Test\TestCase { const TEST_GROUP2 = 'group2'; public function appVersionsProvider() { - return array( + return [ // exact match - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '6.0', 'requiremax' => '6.0', - ), + ], true - ), + ], // in-between match - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - ), + ], true - ), + ], // app too old - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '5.0', - ), + ], false - ), + ], // app too new - array( + [ '5.0.0.0', - array( + [ 'requiremin' => '6.0', 'requiremax' => '6.0', - ), + ], false - ), + ], // only min specified - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '6.0', - ), + ], true - ), + ], // only min specified fail - array( + [ '5.0.0.0', - array( + [ 'requiremin' => '6.0', - ), + ], false - ), + ], // only min specified legacy - array( + [ '6.0.0.0', - array( + [ 'require' => '6.0', - ), + ], true - ), + ], // only min specified legacy fail - array( + [ '4.0.0.0', - array( + [ 'require' => '6.0', - ), + ], false - ), + ], // only max specified - array( + [ '5.0.0.0', - array( + [ 'requiremax' => '6.0', - ), + ], true - ), + ], // only max specified fail - array( + [ '7.0.0.0', - array( + [ 'requiremax' => '6.0', - ), + ], false - ), + ], // variations of versions // single OC number - array( + [ '4', - array( + [ 'require' => '4.0', - ), + ], true - ), + ], // multiple OC number - array( + [ '4.3.1', - array( + [ 'require' => '4.3', - ), + ], true - ), + ], // single app number - array( + [ '4', - array( + [ 'require' => '4', - ), + ], true - ), + ], // single app number fail - array( + [ '4.3', - array( + [ 'require' => '5', - ), + ], false - ), + ], // complex - array( + [ '5.0.0', - array( + [ 'require' => '4.5.1', - ), + ], true - ), + ], // complex fail - array( + [ '4.3.1', - array( + [ 'require' => '4.3.2', - ), + ], false - ), + ], // two numbers - array( + [ '4.3.1', - array( + [ 'require' => '4.4', - ), + ], false - ), + ], // one number fail - array( + [ '4.3.1', - array( + [ 'require' => '5', - ), + ], false - ), + ], // pre-alpha app - array( + [ '5.0.3', - array( + [ 'require' => '4.93', - ), + ], true - ), + ], // pre-alpha OC - array( + [ '6.90.0.2', - array( + [ 'require' => '6.90', - ), + ], true - ), + ], // pre-alpha OC max - array( + [ '6.90.0.2', - array( + [ 'requiremax' => '7', - ), + ], true - ), + ], // expect same major number match - array( + [ '5.0.3', - array( + [ 'require' => '5', - ), + ], true - ), + ], // expect same major number match - array( + [ '5.0.3', - array( + [ 'requiremax' => '5', - ), + ], true - ), + ], // dependencies versions before require* - array( + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '7.0', 'max-version' => '7.0', - ), - ), - ), - ), + ], + ], + ], + ], false - ), - array( + ], + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '7.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '5.0', 'max-version' => '5.0', - ), - ), - ), - ), + ], + ], + ], + ], false - ), - array( + ], + [ '6.0.0.0', - array( + [ 'requiremin' => '5.0', 'requiremax' => '5.0', - 'dependencies' => array( - 'owncloud' => array( - '@attributes' => array( + 'dependencies' => [ + 'owncloud' => [ + '@attributes' => [ 'min-version' => '5.0', 'max-version' => '7.0', - ), - ), - ), - ), + ], + ], + ], + ], true - ), + ], [ '9.2.0.0', [ @@ -301,7 +301,7 @@ class AppTest extends \Test\TestCase { ], true ], - ); + ]; } /** @@ -329,11 +329,11 @@ class AppTest extends \Test\TestCase { * Providers for the app config values */ public function appConfigValuesProvider() { - return array( + return [ // logged in user1 - array( + [ self::TEST_USER1, - array( + [ 'files', 'app1', 'app3', @@ -349,13 +349,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // logged in user2 - array( + [ self::TEST_USER2, - array( + [ 'files', 'app1', 'app3', @@ -371,13 +371,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // logged in user3 - array( + [ self::TEST_USER3, - array( + [ 'files', 'app1', 'app3', @@ -394,13 +394,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false - ), + ], // no user, returns all apps - array( + [ null, - array( + [ 'files', 'app1', 'app3', @@ -417,13 +417,13 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], false, - ), + ], // user given, but ask for all - array( + [ self::TEST_USER1, - array( + [ 'files', 'app1', 'app3', @@ -440,10 +440,10 @@ class AppTest extends \Test\TestCase { 'twofactor_backupcodes', 'viewer', 'workflowengine', - ), + ], true, - ), - ); + ], + ]; } /** @@ -469,16 +469,16 @@ class AppTest extends \Test\TestCase { $this->setupAppConfigMock()->expects($this->once()) ->method('getValues') - ->will($this->returnValue( - array( + ->willReturn( + [ 'app3' => 'yes', 'app2' => 'no', 'app1' => 'yes', 'appforgroup1' => '["group1"]', 'appforgroup2' => '["group2"]', 'appforgroup12' => '["group2","group1"]', - ) - ) + ] + ); $apps = \OC_App::getEnabledApps(false, $forceAll); @@ -508,20 +508,20 @@ class AppTest extends \Test\TestCase { $this->setupAppConfigMock()->expects($this->once()) ->method('getValues') - ->will($this->returnValue( - array( + ->willReturn( + [ 'app3' => 'yes', 'app2' => 'no', - ) - ) + ] + ); $apps = \OC_App::getEnabledApps(); - $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'), $apps); + $this->assertEquals(['files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'], $apps); // mock should not be called again here $apps = \OC_App::getEnabledApps(); - $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'), $apps); + $this->assertEquals(['files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'viewer', 'workflowengine'], $apps); $this->restoreAppConfig(); \OC_User::setUserId(null); diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php index bdfe65d4304..8ecedb189ce 100644 --- a/tests/lib/Archive/TestBase.php +++ b/tests/lib/Archive/TestBase.php @@ -29,7 +29,7 @@ abstract class TestBase extends \Test\TestCase { public function testGetFiles() { $this->instance=$this->getExisting(); $allFiles=$this->instance->getFiles(); - $expected=array('lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt'); + $expected=['lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt']; $this->assertEquals(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files'); foreach($expected as $file) { $this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive'); @@ -38,14 +38,14 @@ abstract class TestBase extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('non/existing/file')); $rootContent=$this->instance->getFolder(''); - $expected=array('lorem.txt','logo-wide.png', 'dir/'); + $expected=['lorem.txt','logo-wide.png', 'dir/']; $this->assertEquals(3, count($rootContent)); foreach($expected as $file) { $this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive'); } $dirContent=$this->instance->getFolder('dir/'); - $expected=array('lorem.txt'); + $expected=['lorem.txt']; $this->assertEquals(1, count($dirContent)); foreach($expected as $file) { $this->assertContains($file, $dirContent, 'cant find '. $file . ' in archive'); diff --git a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php index 47d1d53a74c..4f203b368c0 100644 --- a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php +++ b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php @@ -32,7 +32,6 @@ use OCP\Activity\IManager as IActivityManager; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\ILogger; -use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; diff --git a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php index 0d3b7acfa2d..9c14c2a3fb2 100644 --- a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php +++ b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php @@ -27,7 +27,6 @@ namespace Test\Authentication\Login; use lib\Authentication\Login\ALoginCommandTest; use OC\Authentication\Login\ClearLostPasswordTokensCommand; -use OC\Authentication\Login\LoginData; use OCP\IConfig; use PHPUnit\Framework\MockObject\MockObject; diff --git a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php index 3b18c97a612..f051147609c 100644 --- a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php +++ b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php @@ -25,8 +25,10 @@ declare(strict_types=1); namespace lib\Authentication\Login; +use Hoa\Iterator\Mock; use OC\Authentication\Login\LoggedInCheckCommand; use OC\Core\Controller\LoginController; +use OCP\EventDispatcher\IEventDispatcher; use OCP\ILogger; use PHPUnit\Framework\MockObject\MockObject; @@ -35,13 +37,18 @@ class LoggedInCheckCommandTest extends ALoginCommandTest { /** @var ILogger|MockObject */ private $logger; + /** @var IEventDispatcher|MockObject */ + private $dispatcher; + protected function setUp(): void { parent::setUp(); $this->logger = $this->createMock(ILogger::class); + $this->dispatcher = $this->createMock(IEventDispatcher::class); $this->cmd = new LoggedInCheckCommand( - $this->logger + $this->logger, + $this->dispatcher ); } diff --git a/tests/lib/Authentication/Login/UidLoginCommandTest.php b/tests/lib/Authentication/Login/UidLoginCommandTest.php index c4dd3f10381..1d477921677 100644 --- a/tests/lib/Authentication/Login/UidLoginCommandTest.php +++ b/tests/lib/Authentication/Login/UidLoginCommandTest.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace lib\Authentication\Login; -use OC\Authentication\Login\UidCheckCommand; use OC\Authentication\Login\UidLoginCommand; use OC\User\Manager; use PHPUnit\Framework\MockObject\MockObject; diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php index b4e5e097847..a1287680317 100644 --- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php @@ -64,7 +64,7 @@ class DefaultTokenProviderTest extends TestCase { $this->time = 1313131; $this->timeFactory->expects($this->any()) ->method('getTime') - ->will($this->returnValue($this->time)); + ->willReturn($this->time); $this->tokenProvider = new DefaultTokenProvider($this->mapper, $this->crypto, $this->config, $this->logger, $this->timeFactory); @@ -96,11 +96,11 @@ class DefaultTokenProviderTest extends TestCase { $this->config->expects($this->any()) ->method('getSystemValue') ->with('secret') - ->will($this->returnValue('1f4h9s')); + ->willReturn('1f4h9s'); $this->crypto->expects($this->once()) ->method('encrypt') ->with($password, $token . '1f4h9s') - ->will($this->returnValue('encryptedpassword')); + ->willReturn('encryptedpassword'); $this->mapper->expects($this->once()) ->method('insert') ->with($this->equalTo($toInsert)); @@ -136,7 +136,7 @@ class DefaultTokenProviderTest extends TestCase { $this->mapper->expects($this->once()) ->method('getTokenByUser') ->with('uid') - ->will($this->returnValue(['token'])); + ->willReturn(['token']); $this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid')); } @@ -148,11 +148,11 @@ class DefaultTokenProviderTest extends TestCase { $this->config->expects($this->once()) ->method('getSystemValue') ->with('secret') - ->will($this->returnValue('1f4h9s')); + ->willReturn('1f4h9s'); $this->crypto->expects($this->once()) ->method('decrypt') ->with('someencryptedvalue', $token . '1f4h9s') - ->will($this->returnValue('passme')); + ->willReturn('passme'); $actual = $this->tokenProvider->getPassword($tk, $token); @@ -188,7 +188,7 @@ class DefaultTokenProviderTest extends TestCase { $this->config->expects($this->once()) ->method('getSystemValue') ->with('secret') - ->will($this->returnValue('1f4h9s')); + ->willReturn('1f4h9s'); $this->crypto->expects($this->once()) ->method('decrypt') ->with('someencryptedvalue', $token . '1f4h9s') @@ -208,11 +208,11 @@ class DefaultTokenProviderTest extends TestCase { $this->config->expects($this->once()) ->method('getSystemValue') ->with('secret') - ->will($this->returnValue('ocsecret')); + ->willReturn('ocsecret'); $this->crypto->expects($this->once()) ->method('encrypt') ->with($password, $tokenId . 'ocsecret') - ->will($this->returnValue('encryptedpassword')); + ->willReturn('encryptedpassword'); $this->mapper->expects($this->once()) ->method('update') ->with($token); @@ -256,10 +256,10 @@ class DefaultTokenProviderTest extends TestCase { $defaultRememberMeLifetime = 60 * 60 * 24 * 15; $this->config->expects($this->exactly(2)) ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['session_lifetime', $defaultSessionLifetime, 150], ['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300], - ])); + ]); $this->mapper->expects($this->at(0)) ->method('invalidateOld') ->with($this->time - 150); diff --git a/tests/lib/Authentication/Token/ManagerTest.php b/tests/lib/Authentication/Token/ManagerTest.php index 6f64424364e..8cac7d5be5c 100644 --- a/tests/lib/Authentication/Token/ManagerTest.php +++ b/tests/lib/Authentication/Token/ManagerTest.php @@ -29,7 +29,6 @@ use OC\Authentication\Exceptions\InvalidTokenException; use OC\Authentication\Exceptions\PasswordlessTokenException; use OC\Authentication\Token\DefaultToken; use OC\Authentication\Token\DefaultTokenProvider; -use OC\Authentication\Token\ExpiredTokenException; use OC\Authentication\Token\IToken; use OC\Authentication\Token\Manager; use OC\Authentication\Token\PublicKeyToken; diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php index 3fa7a92bb9b..c9dc3d6ef4a 100644 --- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php +++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php @@ -61,12 +61,12 @@ class PublicKeyTokenProviderTest extends TestCase { $this->crypto = \OC::$server->getCrypto(); $this->config = $this->createMock(IConfig::class); $this->config->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['session_lifetime', 60 * 60 * 24, 150], ['remember_login_cookie_lifetime', 60 * 60 * 24 * 15, 300], ['secret', '', '1f4h9s'], ['openssl', [], []], - ])); + ]); $this->logger = $this->createMock(ILogger::class); $this->timeFactory = $this->createMock(ITimeFactory::class); $this->time = 1313131; @@ -124,7 +124,7 @@ class PublicKeyTokenProviderTest extends TestCase { $this->mapper->expects($this->once()) ->method('getTokenByUser') ->with('uid') - ->will($this->returnValue(['token'])); + ->willReturn(['token']); $this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid')); } @@ -239,10 +239,10 @@ class PublicKeyTokenProviderTest extends TestCase { $defaultRememberMeLifetime = 60 * 60 * 24 * 15; $this->config->expects($this->exactly(2)) ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['session_lifetime', $defaultSessionLifetime, 150], ['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300], - ])); + ]); $this->mapper->expects($this->at(0)) ->method('invalidateOld') ->with($this->time - 150); diff --git a/tests/lib/Authentication/Token/RemoteWipeTest.php b/tests/lib/Authentication/Token/RemoteWipeTest.php index 2ca49d36159..2d887a0a870 100644 --- a/tests/lib/Authentication/Token/RemoteWipeTest.php +++ b/tests/lib/Authentication/Token/RemoteWipeTest.php @@ -67,30 +67,20 @@ class RemoteWipeTest extends TestCase { public function testMarkNonWipableTokenForWipe(): void { $token = $this->createMock(IToken::class); - $this->tokenProvider->expects($this->once()) - ->method('getTokenById') - ->with(123) - ->willReturn($token); - - $result = $this->remoteWipe->markTokenForWipe(123); - + $result = $this->remoteWipe->markTokenForWipe($token); $this->assertFalse($result); } public function testMarkTokenForWipe(): void { $token = $this->createMock(IWipeableToken::class); - $this->tokenProvider->expects($this->once()) - ->method('getTokenById') - ->with(123) - ->willReturn($token); $token->expects($this->once()) ->method('wipe'); + $this->tokenProvider->expects($this->once()) ->method('updateToken') ->with($token); - $result = $this->remoteWipe->markTokenForWipe(123); - + $result = $this->remoteWipe->markTokenForWipe($token); $this->assertTrue($result); } diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index 63d0e993f3b..95eff5f08a9 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -22,7 +22,6 @@ namespace Test\Authentication\TwoFactorAuth; -use Exception; use OC; use OC\Authentication\Token\IProvider as TokenProvider; use OC\Authentication\TwoFactorAuth\Manager; @@ -126,7 +125,7 @@ class ManagerTest extends TestCase { private function prepareNoProviders() { $this->providerLoader->method('getProviders') ->with($this->user) - ->will($this->returnValue([])); + ->willReturn([]); } private function prepareProviders() { @@ -366,11 +365,11 @@ class ManagerTest extends TestCase { $this->fakeProvider->expects($this->once()) ->method('verifyChallenge') ->with($this->user, $challenge) - ->will($this->returnValue(true)); + ->willReturn(true); $this->session->expects($this->once()) ->method('get') ->with('two_factor_remember_login') - ->will($this->returnValue(false)); + ->willReturn(false); $this->session->expects($this->at(1)) ->method('remove') ->with('two_factor_auth_uid'); @@ -449,7 +448,7 @@ class ManagerTest extends TestCase { $this->fakeProvider->expects($this->once()) ->method('verifyChallenge') ->with($this->user, $challenge) - ->will($this->returnValue(false)); + ->willReturn(false); $this->session->expects($this->never()) ->method('remove'); $this->activityManager->expects($this->once()) @@ -496,7 +495,7 @@ class ManagerTest extends TestCase { $this->session->expects($this->at(1)) ->method('exists') ->with('two_factor_auth_uid') - ->will($this->returnValue(false)); + ->willReturn(false); $this->session->expects($this->at(2)) ->method('exists') ->with(Manager::SESSION_UID_DONE) @@ -557,7 +556,7 @@ class ManagerTest extends TestCase { $this->session->expects($this->never()) ->method('exists') ->with('two_factor_auth_uid') - ->will($this->returnValue(true)); + ->willReturn(true); $this->session->expects($this->never()) ->method('remove') ->with('two_factor_auth_uid'); @@ -567,7 +566,7 @@ class ManagerTest extends TestCase { public function testPrepareTwoFactorLogin() { $this->user->method('getUID') - ->will($this->returnValue('ferdinand')); + ->willReturn('ferdinand'); $this->session->expects($this->at(0)) ->method('set') @@ -597,7 +596,7 @@ class ManagerTest extends TestCase { public function testPrepareTwoFactorLoginDontRemember() { $this->user->method('getUID') - ->will($this->returnValue('ferdinand')); + ->willReturn('ferdinand'); $this->session->expects($this->at(0)) ->method('set') @@ -630,14 +629,14 @@ class ManagerTest extends TestCase { ->willReturn('user'); $this->session->method('exists') - ->will($this->returnCallback(function ($var) { + ->willReturnCallback(function ($var) { if ($var === Manager::SESSION_UID_KEY) { return false; } else if ($var === 'app_password') { return false; } return true; - })); + }); $this->session->expects($this->once()) ->method('get') ->with(Manager::SESSION_UID_DONE) diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php index f3762976837..046c541f4d5 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace lib\Authentication\TwoFactorAuth; -use Exception; use OC\Authentication\TwoFactorAuth\ProviderLoader; use OCP\App\IAppManager; use OCP\Authentication\TwoFactorAuth\IProvider; @@ -63,14 +62,14 @@ class ProviderLoaderTest extends TestCase { ->willReturn(['mail', 'twofactor_totp']); $this->appManager ->method('getAppInfo') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail', false, null, []], ['twofactor_totp', false, null, [ 'two-factor-providers' => [ '\\OCA\\MyFaulty2faApp\\DoesNotExist', ], ]], - ])); + ]); $this->loader->getProviders($this->user); } diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php index 43e325b0941..b93c4112af5 100644 --- a/tests/lib/Avatar/UserAvatarTest.php +++ b/tests/lib/Avatar/UserAvatarTest.php @@ -57,20 +57,20 @@ class UserAvatarTest extends \Test\TestCase { ->willReturn($file); $this->folder->method('getFile') - ->will($this->returnCallback(function($path) { + ->willReturnCallback(function($path) { if ($path === 'avatar.64.png') { throw new NotFoundException(); } - })); + }); $this->folder->method('fileExists') - ->will($this->returnCallback(function($path) { + ->willReturnCallback(function($path) { if ($path === 'generated') { return true; } return false; - })); + }); - $data = NULL; + $data = null; $file->method('putContent') ->with($this->callback(function ($d) use (&$data) { $data = $d; @@ -85,10 +85,10 @@ class UserAvatarTest extends \Test\TestCase { public function testGetAvatarSizeMatch() { $this->folder->method('fileExists') - ->will($this->returnValueMap([ + ->willReturnMap([ ['avatar.jpg', true], ['avatar.128.jpg', true], - ])); + ]); $expected = new \OC_Image(); $expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); @@ -102,9 +102,9 @@ class UserAvatarTest extends \Test\TestCase { public function testGetAvatarSizeMinusOne() { $this->folder->method('fileExists') - ->will($this->returnValueMap([ + ->willReturnMap([ ['avatar.jpg', true], - ])); + ]); $expected = new \OC_Image(); $expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); @@ -118,10 +118,10 @@ class UserAvatarTest extends \Test\TestCase { public function testGetAvatarNoSizeMatch() { $this->folder->method('fileExists') - ->will($this->returnValueMap([ + ->willReturnMap([ ['avatar.png', true], ['avatar.32.png', false], - ])); + ]); $expected = new \OC_Image(); $expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png'); @@ -133,7 +133,7 @@ class UserAvatarTest extends \Test\TestCase { $file->method('getContent')->willReturn($expected->data()); $this->folder->method('getFile') - ->will($this->returnCallback( + ->willReturnCallback( function($path) use ($file) { if ($path === 'avatar.png') { return $file; @@ -141,7 +141,7 @@ class UserAvatarTest extends \Test\TestCase { throw new \OCP\Files\NotFoundException; } } - )); + ); $newFile = $this->createMock(File::class); $newFile->expects($this->once()) @@ -164,19 +164,19 @@ class UserAvatarTest extends \Test\TestCase { public function testExiststJPG() { $this->folder->method('fileExists') - ->will($this->returnValueMap([ + ->willReturnMap([ ['avatar.jpg', true], ['avatar.png', false], - ])); + ]); $this->assertTrue($this->avatar->exists()); } public function testExistsPNG() { $this->folder->method('fileExists') - ->will($this->returnValueMap([ + ->willReturnMap([ ['avatar.jpg', false], ['avatar.png', true], - ])); + ]); $this->assertTrue($this->avatar->exists()); } @@ -282,7 +282,7 @@ class UserAvatarTest extends \Test\TestCase { { /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */ $l = $this->createMock(IL10N::class); - $l->method('t')->will($this->returnArgument(0)); + $l->method('t')->willReturnArgument(0); return new \OC\Avatar\UserAvatar( $this->folder, diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php index fe8ca5aefe2..4b8de82b368 100644 --- a/tests/lib/BackgroundJob/DummyJobList.php +++ b/tests/lib/BackgroundJob/DummyJobList.php @@ -18,7 +18,7 @@ class DummyJobList extends \OC\BackgroundJob\JobList { /** * @var IJob[] */ - private $jobs = array(); + private $jobs = []; private $last = 0; diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php index 7e099b23d06..3013afdfa1d 100644 --- a/tests/lib/BackgroundJob/JobListTest.php +++ b/tests/lib/BackgroundJob/JobListTest.php @@ -64,16 +64,16 @@ class JobListTest extends TestCase { } public function argumentProvider() { - return array( - array(null), - array(false), - array('foobar'), - array(12), - array(array( + return [ + [null], + [false], + ['foobar'], + [12], + [[ 'asd' => 5, 'foo' => 'bar' - )) - ); + ]] + ]; } /** @@ -150,7 +150,7 @@ class JobListTest extends TestCase { $this->config->expects($this->once()) ->method('getAppValue') ->with('backgroundjob', 'lastjob', 0) - ->will($this->returnValue(15)); + ->willReturn(15); $this->assertEquals(15, $this->instance->getLastJob()); } diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php index 450bdf607b3..df7a72a7491 100644 --- a/tests/lib/Cache/FileCacheTest.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -61,8 +61,8 @@ class FileCacheTest extends TestCache { //set up temporary storage $this->storage = \OC\Files\Filesystem::getStorage('/'); \OC\Files\Filesystem::clearMounts(); - $storage = new \OC\Files\Storage\Temporary(array()); - \OC\Files\Filesystem::mount($storage,array(),'/'); + $storage = new \OC\Files\Storage\Temporary([]); + \OC\Files\Filesystem::mount($storage,[],'/'); $datadir = str_replace('local::', '', $storage->getId()); $config = \OC::$server->getConfig(); $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT.'/data/cache'); @@ -106,7 +106,7 @@ class FileCacheTest extends TestCache { // Restore the original mount point \OC\Files\Filesystem::clearMounts(); - \OC\Files\Filesystem::mount($this->storage, array(), '/'); + \OC\Files\Filesystem::mount($this->storage, [], '/'); parent::tearDown(); } @@ -117,7 +117,7 @@ class FileCacheTest extends TestCache { ->setConstructorArgs([['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]]) ->getMock(); - \OC\Files\Filesystem::mount($mockStorage, array(), '/test/cache'); + \OC\Files\Filesystem::mount($mockStorage, [], '/test/cache'); return $mockStorage; } @@ -127,11 +127,11 @@ class FileCacheTest extends TestCache { $mockStorage->expects($this->atLeastOnce()) ->method('filemtime') - ->will($this->returnValue(100)); + ->willReturn(100); $mockStorage->expects($this->once()) ->method('unlink') ->with('key1') - ->will($this->returnValue(true)); + ->willReturn(true); $this->instance->set('key1', 'value1'); $this->instance->gc(); @@ -142,7 +142,7 @@ class FileCacheTest extends TestCache { $mockStorage->expects($this->atLeastOnce()) ->method('filemtime') - ->will($this->returnValue(time() + 3600)); + ->willReturn(time() + 3600); $mockStorage->expects($this->never()) ->method('unlink') ->with('key1'); @@ -165,7 +165,7 @@ class FileCacheTest extends TestCache { $mockStorage->expects($this->atLeastOnce()) ->method('filemtime') - ->will($this->returnValue(100)); + ->willReturn(100); $mockStorage->expects($this->atLeastOnce()) ->method('unlink') ->will($this->onConsecutiveCalls( diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php index fa459203dac..5f98188799b 100644 --- a/tests/lib/Calendar/ManagerTest.php +++ b/tests/lib/Calendar/ManagerTest.php @@ -44,19 +44,19 @@ class ManagerTest extends TestCase { public function testSearch($search1, $search2, $expected) { /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); - $calendar1->method('getKey')->will($this->returnValue('simple:1')); + $calendar1->method('getKey')->willReturn('simple:1'); $calendar1->expects($this->once()) ->method('search') ->with('', [], [], null, null) - ->will($this->returnValue($search1)); + ->willReturn($search1); /** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); - $calendar2->method('getKey')->will($this->returnValue('simple:2')); + $calendar2->method('getKey')->willReturn('simple:2'); $calendar2->expects($this->once()) ->method('search') ->with('', [], [], null, null) - ->will($this->returnValue($search2)); + ->willReturn($search2); $this->manager->registerCalendar($calendar1); $this->manager->registerCalendar($calendar2); @@ -71,21 +71,21 @@ class ManagerTest extends TestCase { public function testSearchOptions($search1, $search2, $expected) { /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); - $calendar1->method('getKey')->will($this->returnValue('simple:1')); + $calendar1->method('getKey')->willReturn('simple:1'); $calendar1->expects($this->once()) ->method('search') ->with('searchTerm', ['SUMMARY', 'DESCRIPTION'], ['timerange' => ['start' => null, 'end' => null]], 5, 20) - ->will($this->returnValue($search1)); + ->willReturn($search1); /** @var ICalendar | PHPUnit_Framework_MockObject_MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); - $calendar2->method('getKey')->will($this->returnValue('simple:2')); + $calendar2->method('getKey')->willReturn('simple:2'); $calendar2->expects($this->once()) ->method('search') ->with('searchTerm', ['SUMMARY', 'DESCRIPTION'], ['timerange' => ['start' => null, 'end' => null]], 5, 20) - ->will($this->returnValue($search2)); + ->willReturn($search2); $this->manager->registerCalendar($calendar1); $this->manager->registerCalendar($calendar2); @@ -152,11 +152,11 @@ class ManagerTest extends TestCase { public function testRegisterUnregister() { /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); - $calendar1->method('getKey')->will($this->returnValue('key1')); + $calendar1->method('getKey')->willReturn('key1'); /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); - $calendar2->method('getKey')->will($this->returnValue('key2')); + $calendar2->method('getKey')->willReturn('key2'); $this->manager->registerCalendar($calendar1); $this->manager->registerCalendar($calendar2); @@ -176,11 +176,11 @@ class ManagerTest extends TestCase { public function testGetCalendars() { /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar1 */ $calendar1 = $this->createMock(ICalendar::class); - $calendar1->method('getKey')->will($this->returnValue('key1')); + $calendar1->method('getKey')->willReturn('key1'); /** @var ICalendar | \PHPUnit_Framework_MockObject_MockObject $calendar2 */ $calendar2 = $this->createMock(ICalendar::class); - $calendar2->method('getKey')->will($this->returnValue('key2')); + $calendar2->method('getKey')->willReturn('key2'); $this->manager->registerCalendar($calendar1); $this->manager->registerCalendar($calendar2); diff --git a/tests/lib/Calendar/Resource/ManagerTest.php b/tests/lib/Calendar/Resource/ManagerTest.php index 71679a86a8c..30b0e16c948 100644 --- a/tests/lib/Calendar/Resource/ManagerTest.php +++ b/tests/lib/Calendar/Resource/ManagerTest.php @@ -45,18 +45,18 @@ class ManagerTest extends TestCase { public function testRegisterUnregisterBackend() { $backend1 = $this->createMock(IBackend::class); - $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + $backend1->method('getBackendIdentifier')->willReturn('backend_1'); $this->server->expects($this->at(0)) ->method('query') ->with('calendar_resource_backend1') - ->will($this->returnValue($backend1)); + ->willReturn($backend1); $backend2 = $this->createMock(IBackend::class); - $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + $backend2->method('getBackendIdentifier')->willReturn('backend_2'); $this->server->expects($this->at(1)) ->method('query') ->with('calendar_resource_backend2') - ->will($this->returnValue($backend2)); + ->willReturn($backend2); $this->manager->registerBackend('calendar_resource_backend1'); $this->manager->registerBackend('calendar_resource_backend2'); @@ -74,18 +74,18 @@ class ManagerTest extends TestCase { public function testGetBackend() { $backend1 = $this->createMock(IBackend::class); - $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + $backend1->method('getBackendIdentifier')->willReturn('backend_1'); $this->server->expects($this->at(0)) ->method('query') ->with('calendar_resource_backend1') - ->will($this->returnValue($backend1)); + ->willReturn($backend1); $backend2 = $this->createMock(IBackend::class); - $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + $backend2->method('getBackendIdentifier')->willReturn('backend_2'); $this->server->expects($this->at(1)) ->method('query') ->with('calendar_resource_backend2') - ->will($this->returnValue($backend2)); + ->willReturn($backend2); $this->manager->registerBackend('calendar_resource_backend1'); $this->manager->registerBackend('calendar_resource_backend2'); @@ -96,18 +96,18 @@ class ManagerTest extends TestCase { public function testClear() { $backend1 = $this->createMock(IBackend::class); - $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + $backend1->method('getBackendIdentifier')->willReturn('backend_1'); $this->server->expects($this->at(0)) ->method('query') ->with('calendar_resource_backend1') - ->will($this->returnValue($backend1)); + ->willReturn($backend1); $backend2 = $this->createMock(IBackend::class); - $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + $backend2->method('getBackendIdentifier')->willReturn('backend_2'); $this->server->expects($this->at(1)) ->method('query') ->with('calendar_resource_backend2') - ->will($this->returnValue($backend2)); + ->willReturn($backend2); $this->manager->registerBackend('calendar_resource_backend1'); $this->manager->registerBackend('calendar_resource_backend2'); diff --git a/tests/lib/Calendar/Room/ManagerTest.php b/tests/lib/Calendar/Room/ManagerTest.php index 56f05544e29..b01d16945ad 100644 --- a/tests/lib/Calendar/Room/ManagerTest.php +++ b/tests/lib/Calendar/Room/ManagerTest.php @@ -45,18 +45,18 @@ class ManagerTest extends TestCase { public function testRegisterUnregisterBackend() { $backend1 = $this->createMock(IBackend::class); - $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + $backend1->method('getBackendIdentifier')->willReturn('backend_1'); $this->server->expects($this->at(0)) ->method('query') ->with('calendar_room_backend1') - ->will($this->returnValue($backend1)); + ->willReturn($backend1); $backend2 = $this->createMock(IBackend::class); - $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + $backend2->method('getBackendIdentifier')->willReturn('backend_2'); $this->server->expects($this->at(1)) ->method('query') ->with('calendar_room_backend2') - ->will($this->returnValue($backend2)); + ->willReturn($backend2); $this->manager->registerBackend('calendar_room_backend1'); $this->manager->registerBackend('calendar_room_backend2'); @@ -74,18 +74,18 @@ class ManagerTest extends TestCase { public function testGetBackend() { $backend1 = $this->createMock(IBackend::class); - $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + $backend1->method('getBackendIdentifier')->willReturn('backend_1'); $this->server->expects($this->at(0)) ->method('query') ->with('calendar_room_backend1') - ->will($this->returnValue($backend1)); + ->willReturn($backend1); $backend2 = $this->createMock(IBackend::class); - $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + $backend2->method('getBackendIdentifier')->willReturn('backend_2'); $this->server->expects($this->at(1)) ->method('query') ->with('calendar_room_backend2') - ->will($this->returnValue($backend2)); + ->willReturn($backend2); $this->manager->registerBackend('calendar_room_backend1'); $this->manager->registerBackend('calendar_room_backend2'); @@ -96,18 +96,18 @@ class ManagerTest extends TestCase { public function testClear() { $backend1 = $this->createMock(IBackend::class); - $backend1->method('getBackendIdentifier')->will($this->returnValue('backend_1')); + $backend1->method('getBackendIdentifier')->willReturn('backend_1'); $this->server->expects($this->at(0)) ->method('query') ->with('calendar_room_backend1') - ->will($this->returnValue($backend1)); + ->willReturn($backend1); $backend2 = $this->createMock(IBackend::class); - $backend2->method('getBackendIdentifier')->will($this->returnValue('backend_2')); + $backend2->method('getBackendIdentifier')->willReturn('backend_2'); $this->server->expects($this->at(1)) ->method('query') ->with('calendar_room_backend2') - ->will($this->returnValue($backend2)); + ->willReturn($backend2); $this->manager->registerBackend('calendar_room_backend1'); $this->manager->registerBackend('calendar_room_backend2'); diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 4ac2cc124ee..59338b74de9 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -410,20 +410,20 @@ class RemotePluginTest extends TestCase { } public function dataTestSplitUserRemoteError() { - return array( + return [ // Invalid path - array('user@'), + ['user@'], // Invalid user - array('@server'), - array('us/er@server'), - array('us:er@server'), + ['@server'], + ['us/er@server'], + ['us:er@server'], // Invalid splitting - array('user'), - array(''), - array('us/erserver'), - array('us:erserver'), - ); + ['user'], + [''], + ['us/erserver'], + ['us:erserver'], + ]; } } diff --git a/tests/lib/Collaboration/Collaborators/SearchResultTest.php b/tests/lib/Collaboration/Collaborators/SearchResultTest.php index 43672345226..3d09a9b632d 100644 --- a/tests/lib/Collaboration/Collaborators/SearchResultTest.php +++ b/tests/lib/Collaboration/Collaborators/SearchResultTest.php @@ -27,10 +27,8 @@ namespace Test\Collaboration\Collaborators; use OC\Collaboration\Collaborators\Search; use OC\Collaboration\Collaborators\SearchResult; use OCP\Collaboration\Collaborators\ISearch; -use OCP\Collaboration\Collaborators\ISearchPlugin; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\IContainer; -use OCP\Share; use Test\TestCase; class SearchResultTest extends TestCase { diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php index 6fa86a2e855..594d17168d6 100644 --- a/tests/lib/Command/Integrity/SignAppTest.php +++ b/tests/lib/Command/Integrity/SignAppTest.php @@ -59,17 +59,17 @@ class SignAppTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('path') - ->will($this->returnValue(null)); + ->willReturn(null); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('PrivateKey')); + ->willReturn('PrivateKey'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('Certificate')); + ->willReturn('Certificate'); $outputInterface ->expects($this->at(0)) @@ -87,17 +87,17 @@ class SignAppTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('path') - ->will($this->returnValue('AppId')); + ->willReturn('AppId'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue(null)); + ->willReturn(null); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('Certificate')); + ->willReturn('Certificate'); $outputInterface ->expects($this->at(0)) @@ -115,17 +115,17 @@ class SignAppTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('path') - ->will($this->returnValue('AppId')); + ->willReturn('AppId'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('certificate') - ->will($this->returnValue(null)); + ->willReturn(null); $outputInterface ->expects($this->at(0)) @@ -143,23 +143,23 @@ class SignAppTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('path') - ->will($this->returnValue('AppId')); + ->willReturn('AppId'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) ->method('file_get_contents') ->with('privateKey') - ->will($this->returnValue(false)); + ->willReturn(false); $outputInterface ->expects($this->at(0)) @@ -177,28 +177,28 @@ class SignAppTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('path') - ->will($this->returnValue('AppId')); + ->willReturn('AppId'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) ->method('file_get_contents') ->with('privateKey') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/core.key')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/core.key'); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with('certificate') - ->will($this->returnValue(false)); + ->willReturn(false); $outputInterface ->expects($this->at(0)) @@ -216,17 +216,17 @@ class SignAppTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('path') - ->will($this->returnValue('AppId')); + ->willReturn('AppId'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) @@ -260,17 +260,17 @@ class SignAppTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('path') - ->will($this->returnValue('AppId')); + ->willReturn('AppId'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php index 9bab016ec8f..36376ef0e7d 100644 --- a/tests/lib/Command/Integrity/SignCoreTest.php +++ b/tests/lib/Command/Integrity/SignCoreTest.php @@ -54,12 +54,12 @@ class SignCoreTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue(null)); + ->willReturn(null); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('Certificate')); + ->willReturn('Certificate'); $outputInterface ->expects($this->at(0)) @@ -77,12 +77,12 @@ class SignCoreTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('certificate') - ->will($this->returnValue(null)); + ->willReturn(null); $outputInterface ->expects($this->at(0)) @@ -100,23 +100,23 @@ class SignCoreTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('path') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) ->method('file_get_contents') ->with('privateKey') - ->will($this->returnValue(false)); + ->willReturn(false); $outputInterface ->expects($this->at(0)) @@ -134,17 +134,17 @@ class SignCoreTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('path') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) @@ -155,7 +155,7 @@ class SignCoreTest extends TestCase { ->expects($this->at(1)) ->method('file_get_contents') ->with('certificate') - ->will($this->returnValue(false)); + ->willReturn(false); $outputInterface ->expects($this->at(0)) @@ -173,17 +173,17 @@ class SignCoreTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('path') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) @@ -217,17 +217,17 @@ class SignCoreTest extends TestCase { ->expects($this->at(0)) ->method('getOption') ->with('privateKey') - ->will($this->returnValue('privateKey')); + ->willReturn('privateKey'); $inputInterface ->expects($this->at(1)) ->method('getOption') ->with('certificate') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $inputInterface ->expects($this->at(2)) ->method('getOption') ->with('path') - ->will($this->returnValue('certificate')); + ->willReturn('certificate'); $this->fileAccessHelper ->expects($this->at(0)) diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php index 93cafc0f933..1700af797fe 100644 --- a/tests/lib/Comments/ManagerTest.php +++ b/tests/lib/Comments/ManagerTest.php @@ -339,7 +339,7 @@ class ManagerTest extends TestCase { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('comment_test')); + ->willReturn('comment_test'); $manager = $this->getManager(); @@ -679,7 +679,7 @@ class ManagerTest extends TestCase { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('alice')); + ->willReturn('alice'); $dateTimeSet = new \DateTime(); @@ -696,7 +696,7 @@ class ManagerTest extends TestCase { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('alice')); + ->willReturn('alice'); $dateTimeSet = new \DateTime('yesterday'); @@ -716,7 +716,7 @@ class ManagerTest extends TestCase { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('alice')); + ->willReturn('alice'); $dateTimeSet = new \DateTime(); @@ -734,7 +734,7 @@ class ManagerTest extends TestCase { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('alice')); + ->willReturn('alice'); $dateTimeSet = new \DateTime(); diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php index 109f7471e96..58144b2c26a 100644 --- a/tests/lib/ConfigTest.php +++ b/tests/lib/ConfigTest.php @@ -12,7 +12,7 @@ class ConfigTest extends TestCase { const TESTCONTENT = '<?php $CONFIG=array("foo"=>"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);'; /** @var array */ - private $initialConfig = array('foo' => 'bar', 'beers' => array('Appenzeller', 'Guinness', 'Kölsch'), 'alcohol_free' => false); + private $initialConfig = ['foo' => 'bar', 'beers' => ['Appenzeller', 'Guinness', 'Kölsch'], 'alcohol_free' => false]; /** @var string */ private $configFile; /** @var \OC\Config */ @@ -35,7 +35,7 @@ class ConfigTest extends TestCase { } public function testGetKeys() { - $expectedConfig = array('foo', 'beers', 'alcohol_free'); + $expectedConfig = ['foo', 'beers', 'alcohol_free']; $this->assertSame($expectedConfig, $this->config->getKeys()); } @@ -44,8 +44,8 @@ class ConfigTest extends TestCase { $this->assertSame(null, $this->config->getValue('bar')); $this->assertSame('moo', $this->config->getValue('bar', 'moo')); $this->assertSame(false, $this->config->getValue('alcohol_free', 'someBogusValue')); - $this->assertSame(array('Appenzeller', 'Guinness', 'Kölsch'), $this->config->getValue('beers', 'someBogusValue')); - $this->assertSame(array('Appenzeller', 'Guinness', 'Kölsch'), $this->config->getValue('beers')); + $this->assertSame(['Appenzeller', 'Guinness', 'Kölsch'], $this->config->getValue('beers', 'someBogusValue')); + $this->assertSame(['Appenzeller', 'Guinness', 'Kölsch'], $this->config->getValue('beers')); } public function testGetValueReturnsEnvironmentValueIfSet() { @@ -81,9 +81,9 @@ class ConfigTest extends TestCase { $this->assertEquals($expected, $content); $this->config->setValue('bar', 'red'); - $this->config->setValue('apps', array('files', 'gallery')); + $this->config->setValue('apps', ['files', 'gallery']); $expectedConfig['bar'] = 'red'; - $expectedConfig['apps'] = array('files', 'gallery'); + $expectedConfig['apps'] = ['files', 'gallery']; $this->assertAttributeEquals($expectedConfig, 'cache', $this->config); $content = file_get_contents($this->configFile); @@ -150,7 +150,7 @@ class ConfigTest extends TestCase { $this->assertEquals(self::TESTCONTENT, file_get_contents($this->configFile)); // Write a new value to the config - $this->config->setValue('CoolWebsites', array('demo.owncloud.org', 'owncloud.org', 'owncloud.com')); + $this->config->setValue('CoolWebsites', ['demo.owncloud.org', 'owncloud.org', 'owncloud.com']); $expected = "<?php\n\$CONFIG = array (\n 'foo' => 'bar',\n 'beers' => \n array (\n 0 => 'Appenzeller',\n " . " 1 => 'Guinness',\n 2 => 'Kölsch',\n ),\n 'alcohol_free' => false,\n 'php53' => 'totallyOutdated',\n 'CoolWebsites' => \n array (\n " . " 0 => 'demo.owncloud.org',\n 1 => 'owncloud.org',\n 2 => 'owncloud.com',\n ),\n);\n"; diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php index 10584812c41..31c52ea80e1 100644 --- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php +++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php @@ -24,7 +24,6 @@ namespace Tests\Contacts\ContactsMenu; -use Exception; use OC\App\AppManager; use OC\Contacts\ContactsMenu\ActionProviderStore; use OC\Contacts\ContactsMenu\Providers\EMailProvider; @@ -80,10 +79,10 @@ class ActionProviderStoreTest extends TestCase { ]); $this->serverContainer->expects($this->exactly(2)) ->method('query') - ->will($this->returnValueMap([ + ->willReturnMap([ [EMailProvider::class, true, $provider1], ['OCA\Contacts\Provider1', true, $provider2] - ])); + ]); $providers = $this->actionProviderStore->getProviders($user); @@ -105,9 +104,9 @@ class ActionProviderStoreTest extends TestCase { ->willReturn([/* Empty info.xml */]); $this->serverContainer->expects($this->once()) ->method('query') - ->will($this->returnValueMap([ + ->willReturnMap([ [EMailProvider::class, true, $provider1], - ])); + ]); $providers = $this->actionProviderStore->getProviders($user); diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php index 9e8b75fbf4d..5437ca3fbaf 100644 --- a/tests/lib/ContactsManagerTest.php +++ b/tests/lib/ContactsManagerTest.php @@ -15,48 +15,48 @@ class ContactsManagerTest extends \Test\TestCase { } public function searchProvider(){ - $search1 = array( - 0 => array( - 'N' => array(0 => '', 1 => 'Jan', 2 => 'Jansen', 3 => '', 4 => '',), + $search1 = [ + 0 => [ + 'N' => [0 => '', 1 => 'Jan', 2 => 'Jansen', 3 => '', 4 => '',], 'UID' => '04ada7f5-01f9-4309-9c82-6b555b2170ed', 'FN' => 'Jan Jansen', 'id' => '1', 'addressbook-key' => 'simple:1', - ), - 0 => array( - 'N' => array(0 => '', 1 => 'Tom', 2 => 'Peeters', 3 => '', 4 => '',), + ], + 0 => [ + 'N' => [0 => '', 1 => 'Tom', 2 => 'Peeters', 3 => '', 4 => '',], 'UID' => '04ada7f5-01f9-4309-9c82-2345-2345--6b555b2170ed', 'FN' => 'Tom Peeters', 'id' => '2', 'addressbook-key' => 'simple:1', - ), - ); + ], + ]; - $search2 = array( - 0 => array( - 'N' => array(0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',), + $search2 = [ + 0 => [ + 'N' => [0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',], 'UID' => '04ada234h5jh357f5-01f9-4309-9c82-6b555b2170ed', 'FN' => 'Jan Rompuy', 'id' => '1', 'addressbook-key' => 'simple:2', - ), - 0 => array( - 'N' => array(0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',), + ], + 0 => [ + 'N' => [0 => '', 1 => 'fg', 2 => '', 3 => '', 4 => '',], 'UID' => '04ada7f5-01f9-4309-345kj345j9c82-2345-2345--6b555b2170ed', 'FN' => 'Tim Peeters', 'id' => '2', 'addressbook-key' => 'simple:2', - ), - ); + ], + ]; $expectedResult = array_merge($search1, $search2); - return array( - array( + return [ + [ $search1, $search2, $expectedResult - ) - ); + ] + ]; } /** @@ -164,7 +164,7 @@ class ContactsManagerTest extends \Test\TestCase { ->willReturn('returnMe'); $this->cm->registerAddressBook($addressbook); - $result = $this->cm->createOrUpdate(array(), $addressbook->getKey()); + $result = $this->cm->createOrUpdate([], $addressbook->getKey()); $this->assertEquals($result, 'returnMe'); } @@ -182,7 +182,7 @@ class ContactsManagerTest extends \Test\TestCase { ->method('createOrUpdate'); $this->cm->registerAddressBook($addressbook); - $result = $this->cm->createOrUpdate(array(), $addressbook->getKey()); + $result = $this->cm->createOrUpdate([], $addressbook->getKey()); $this->assertEquals($result, null); } @@ -197,7 +197,7 @@ class ContactsManagerTest extends \Test\TestCase { ->method('createOrUpdate'); $this->cm->registerAddressBook($addressbook); - $result = $this->cm->createOrUpdate(array(), 'noaddressbook'); + $result = $this->cm->createOrUpdate([], 'noaddressbook'); $this->assertEquals($result, null); } @@ -227,10 +227,10 @@ class ContactsManagerTest extends \Test\TestCase { // setup return for method calls $addressbook->expects($this->any()) ->method('getKey') - ->will($this->returnValue('SIMPLE_ADDRESS_BOOK')); + ->willReturn('SIMPLE_ADDRESS_BOOK'); $addressbook->expects($this->any()) ->method('getDisplayName') - ->will($this->returnValue('A very simple Addressbook')); + ->willReturn('A very simple Addressbook'); // register the address book $this->cm->registerAddressBook($addressbook); diff --git a/tests/lib/DB/LegacyDBTest.php b/tests/lib/DB/LegacyDBTest.php index 200afac3f9a..cd4befdbe52 100644 --- a/tests/lib/DB/LegacyDBTest.php +++ b/tests/lib/DB/LegacyDBTest.php @@ -16,7 +16,7 @@ use OC_DB; * @group DB */ class LegacyDBTest extends \Test\TestCase { - protected $backupGlobals = FALSE; + protected $backupGlobals = false; protected static $schema_file; protected $test_prefix; @@ -85,15 +85,15 @@ class LegacyDBTest extends \Test\TestCase { public function testQuotes() { $query = OC_DB::prepare('SELECT `fullname` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_1')); + $result = $query->execute(['uri_1']); $this->assertTrue((bool)$result); $row = $result->fetchRow(); $this->assertFalse($row); $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)'); - $result = $query->execute(array('fullname test', 'uri_1')); + $result = $query->execute(['fullname test', 'uri_1']); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_1')); + $result = $query->execute(['uri_1']); $this->assertTrue((bool)$result); $row = $result->fetchRow(); $this->assertArrayHasKey('fullname', $row); @@ -107,29 +107,29 @@ class LegacyDBTest extends \Test\TestCase { */ public function testNOW() { $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (NOW(),?)'); - $result = $query->execute(array('uri_2')); + $result = $query->execute(['uri_2']); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_2')); + $result = $query->execute(['uri_2']); $this->assertTrue((bool)$result); } public function testUNIX_TIMESTAMP() { $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (UNIX_TIMESTAMP(),?)'); - $result = $query->execute(array('uri_3')); + $result = $query->execute(['uri_3']); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?'); - $result = $query->execute(array('uri_3')); + $result = $query->execute(['uri_3']); $this->assertTrue((bool)$result); } public function testLastInsertId() { $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)'); - $result1 = OC_DB::executeAudited($query, array('insertid 1','uri_1')); + $result1 = OC_DB::executeAudited($query, ['insertid 1','uri_1']); $id1 = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*'.$this->table2); // we don't know the id we should expect, so insert another row - $result2 = OC_DB::executeAudited($query, array('insertid 2','uri_2')); + $result2 = OC_DB::executeAudited($query, ['insertid 2','uri_2']); $id2 = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*'.$this->table2); // now we can check if the two ids are in correct order $this->assertGreaterThan($id1, $id2); @@ -140,7 +140,7 @@ class LegacyDBTest extends \Test\TestCase { $expected = "Ћö雙喜\xE2\x80\xA2"; $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $result = $query->execute(array($expected, 'uri_1', 'This is a vCard')); + $result = $query->execute([$expected, 'uri_1', 'This is a vCard']); $this->assertEquals(1, $result); $actual = OC_DB::prepare("SELECT `fullname` FROM `$table`")->execute()->fetchOne(); @@ -156,7 +156,7 @@ class LegacyDBTest extends \Test\TestCase { $rowname = 'decimaltest'; $query = OC_DB::prepare('INSERT INTO `' . $table . '` (`' . $rowname . '`) VALUES (?)'); - $result = $query->execute(array($insert)); + $result = $query->execute([$insert]); $this->assertEquals(1, $result); $query = OC_DB::prepare('SELECT `' . $rowname . '` FROM `' . $table . '`'); $result = $query->execute(); @@ -205,35 +205,35 @@ class LegacyDBTest extends \Test\TestCase { // updating to. MySQL reports 1 here when the PDO::MYSQL_ATTR_FOUND_ROWS // flag is not specified. $query = OC_DB::prepare("UPDATE `*PREFIX*{$this->table2}` SET `uri` = ?"); - $this->assertSame(2, $query->execute(array('uri1'))); + $this->assertSame(2, $query->execute(['uri1'])); } protected function insertCardData($fullname, $uri) { $query = OC_DB::prepare("INSERT INTO `*PREFIX*{$this->table2}` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $this->assertSame(1, $query->execute(array($fullname, $uri, $this->getUniqueID()))); + $this->assertSame(1, $query->execute([$fullname, $uri, $this->getUniqueID()])); } protected function updateCardData($fullname, $uri) { $query = OC_DB::prepare("UPDATE `*PREFIX*{$this->table2}` SET `uri` = ? WHERE `fullname` = ?"); - return $query->execute(array($uri, $fullname)); + return $query->execute([$uri, $fullname]); } public function testILIKE() { $table = "*PREFIX*{$this->table2}"; $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $query->execute(array('fooBAR', 'foo', 'bar')); + $query->execute(['fooBAR', 'foo', 'bar']); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('foobar')); + $result = $query->execute(['foobar']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('foobar')); + $result = $query->execute(['foobar']); $this->assertCount(1, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('foo')); + $result = $query->execute(['foo']); $this->assertCount(0, $result->fetchAll()); } @@ -241,30 +241,30 @@ class LegacyDBTest extends \Test\TestCase { $table = "*PREFIX*{$this->table2}"; $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); - $query->execute(array('FooBAR', 'foo', 'bar')); + $query->execute(['FooBAR', 'foo', 'bar']); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('%bar')); + $result = $query->execute(['%bar']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('foo%')); + $result = $query->execute(['foo%']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); - $result = $query->execute(array('%ba%')); + $result = $query->execute(['%ba%']); $this->assertCount(0, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('%bar')); + $result = $query->execute(['%bar']); $this->assertCount(1, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('foo%')); + $result = $query->execute(['foo%']); $this->assertCount(1, $result->fetchAll()); $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); - $result = $query->execute(array('%ba%')); + $result = $query->execute(['%ba%']); $this->assertCount(1, $result->fetchAll()); } @@ -279,7 +279,7 @@ class LegacyDBTest extends \Test\TestCase { if ($throwsOnMysqlWithoutUTF8MB4 && $config->getSystemValue('dbtype', 'sqlite') === 'mysql' && $config->getSystemValue('mysql.utf8mb4', false) === false) { $this->markTestSkipped('MySQL requires UTF8mb4 to store value: ' . $expected); } - $result = $query->execute(array($expected)); + $result = $query->execute([$expected]); $this->assertEquals(1, $result); $actual = OC_DB::prepare("SELECT `textfield` FROM `$table`")->execute()->fetchOne(); diff --git a/tests/lib/DB/MDB2SchemaManagerTest.php b/tests/lib/DB/MDB2SchemaManagerTest.php index 8c9290c56b4..d83131a685f 100644 --- a/tests/lib/DB/MDB2SchemaManagerTest.php +++ b/tests/lib/DB/MDB2SchemaManagerTest.php @@ -40,10 +40,10 @@ class MDB2SchemaManagerTest extends \Test\TestCase { $manager = new \OC\DB\MDB2SchemaManager($connection); $manager->createDbFromStructure(__DIR__ . '/ts-autoincrement-before.xml'); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc')); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('abc')); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123')); - $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123')); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['abc']); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['abc']); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['123']); + $connection->executeUpdate('insert into `*PREFIX*table` values (?)', ['123']); $manager->updateDbFromStructure(__DIR__ . '/ts-autoincrement-after.xml'); $this->addToAssertionCount(1); diff --git a/tests/lib/DB/MDB2SchemaReaderTest.php b/tests/lib/DB/MDB2SchemaReaderTest.php index 3b44f15f756..2f987adb290 100644 --- a/tests/lib/DB/MDB2SchemaReaderTest.php +++ b/tests/lib/DB/MDB2SchemaReaderTest.php @@ -38,10 +38,10 @@ class MDB2SchemaReaderTest extends TestCase { ->getMock(); $config->expects($this->any()) ->method('getSystemValue') - ->will($this->returnValueMap(array( - array('dbname', 'owncloud', 'testDB'), - array('dbtableprefix', 'oc_', 'test_') - ))); + ->willReturnMap([ + ['dbname', 'owncloud', 'testDB'], + ['dbtableprefix', 'oc_', 'test_'] + ]); return $config; } @@ -85,10 +85,10 @@ class MDB2SchemaReaderTest extends TestCase { $this->assertEquals(2, $table->getColumn('decimalfield_precision_scale')->getScale()); $this->assertCount(2, $table->getIndexes()); - $this->assertEquals(array('integerfield'), $table->getIndex('primary')->getUnquotedColumns()); + $this->assertEquals(['integerfield'], $table->getIndex('primary')->getUnquotedColumns()); $this->assertTrue($table->getIndex('primary')->isPrimary()); $this->assertTrue($table->getIndex('primary')->isUnique()); - $this->assertEquals(array('booleanfield'), $table->getIndex('index_boolean')->getUnquotedColumns()); + $this->assertEquals(['booleanfield'], $table->getIndex('index_boolean')->getUnquotedColumns()); $this->assertFalse($table->getIndex('index_boolean')->isPrimary()); $this->assertFalse($table->getIndex('index_boolean')->isUnique()); } diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index e5cc28654e4..a438d0189df 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -77,19 +77,19 @@ class MigratorTest extends \Test\TestCase { * @return \Doctrine\DBAL\Schema\Schema[] */ private function getDuplicateKeySchemas() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $table->addIndex(array('id'), $this->tableName . '_id'); + $table->addIndex(['id'], $this->tableName . '_id'); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $table->addUniqueIndex(array('id'), $this->tableName . '_id'); + $table->addUniqueIndex(['id'], $this->tableName . '_id'); - return array($startSchema, $endSchema); + return [$startSchema, $endSchema]; } private function getSchemaConfig() { @@ -113,9 +113,9 @@ class MigratorTest extends \Test\TestCase { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $this->fail('checkMigrate should have failed'); @@ -126,9 +126,9 @@ class MigratorTest extends \Test\TestCase { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 3, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); @@ -145,9 +145,9 @@ class MigratorTest extends \Test\TestCase { $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); - $this->connection->insert($this->tableName, array('id' => 3, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); + $this->connection->insert($this->tableName, ['id' => 3, 'name' => 'qwerty']); $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); @@ -163,10 +163,10 @@ class MigratorTest extends \Test\TestCase { $migrator->migrate($endSchema); - $this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo')); - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar')); + $this->connection->insert($this->tableName, ['id' => 1, 'name' => 'foo']); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'bar']); try { - $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty')); + $this->connection->insert($this->tableName, ['id' => 2, 'name' => 'qwerty']); $this->fail('Expected duplicate key insert to fail'); } catch (DBALException $e) { $this->addToAssertionCount(1); @@ -174,16 +174,16 @@ class MigratorTest extends \Test\TestCase { } public function testAddingPrimaryKeyWithAutoIncrement() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); $table->addColumn('id', 'integer'); $table->addColumn('name', 'string'); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); + $table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('name', 'string'); - $table->setPrimaryKey(array('id')); + $table->setPrimaryKey(['id']); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); @@ -195,17 +195,17 @@ class MigratorTest extends \Test\TestCase { } public function testReservedKeywords() { - $startSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $startSchema = new Schema([], [], $this->getSchemaConfig()); $table = $startSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); - $table->addColumn('user', 'string', array('length' => 255)); - $table->setPrimaryKey(array('id')); + $table->addColumn('id', 'integer', ['autoincrement' => true]); + $table->addColumn('user', 'string', ['length' => 255]); + $table->setPrimaryKey(['id']); - $endSchema = new Schema(array(), array(), $this->getSchemaConfig()); + $endSchema = new Schema([], [], $this->getSchemaConfig()); $table = $endSchema->createTable($this->tableName); - $table->addColumn('id', 'integer', array('autoincrement' => true)); - $table->addColumn('user', 'string', array('length' => 64)); - $table->setPrimaryKey(array('id')); + $table->addColumn('id', 'integer', ['autoincrement' => true]); + $table->addColumn('user', 'string', ['length' => 64]); + $table->setPrimaryKey(['id']); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); @@ -227,7 +227,7 @@ class MigratorTest extends \Test\TestCase { $tableFk = $startSchema->createTable($this->tableNameTmp); $tableFk->addColumn('fk_id', 'integer'); $tableFk->addColumn('name', 'string'); - $tableFk->addForeignKeyConstraint($this->tableName, array('fk_id'), array('id'), array(), $fkName); + $tableFk->addForeignKeyConstraint($this->tableName, ['fk_id'], ['id'], [], $fkName); $migrator = $this->manager->getMigrator(); $migrator->migrate($startSchema); diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php index 6cd8b572fcd..1470f3b6bf4 100644 --- a/tests/lib/DateTimeFormatterTest.php +++ b/tests/lib/DateTimeFormatterTest.php @@ -44,35 +44,35 @@ class DateTimeFormatterTest extends TestCase { public function formatTimeSpanData() { $time = 1416916800; // Use a fixed timestamp so we don't switch days/years with the getTimestampAgo $deL10N = \OC::$server->getL10N('lib', 'de'); - return array( - array('seconds ago', $time, $time), - array('in a few seconds', $time + 5 , $time), - array('1 minute ago', $this->getTimestampAgo($time, 30, 1), $time), - array('15 minutes ago', $this->getTimestampAgo($time, 30, 15), $time), - array('in 15 minutes', $time, $this->getTimestampAgo($time, 30, 15)), - array('1 hour ago', $this->getTimestampAgo($time, 30, 15, 1), $time), - array('3 hours ago', $this->getTimestampAgo($time, 30, 15, 3), $time), - array('in 3 hours', $time, $this->getTimestampAgo($time, 30, 15, 3)), - array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4), $time), - - array('seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('1 minute ago', new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('3 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('59 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('1 hour ago', new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('3 hours ago', new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('2 days ago', new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - - array($deL10N->t('seconds ago'), new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n minute ago', '%n minutes ago', 1), new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n minute ago', '%n minutes ago', 3), new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n hour ago', '%n hours ago', 1), new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n hour ago', '%n hours ago', 3), new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - - ); + return [ + ['seconds ago', $time, $time], + ['in a few seconds', $time + 5 , $time], + ['1 minute ago', $this->getTimestampAgo($time, 30, 1), $time], + ['15 minutes ago', $this->getTimestampAgo($time, 30, 15), $time], + ['in 15 minutes', $time, $this->getTimestampAgo($time, 30, 15)], + ['1 hour ago', $this->getTimestampAgo($time, 30, 15, 1), $time], + ['3 hours ago', $this->getTimestampAgo($time, 30, 15, 3), $time], + ['in 3 hours', $time, $this->getTimestampAgo($time, 30, 15, 3)], + ['4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4), $time], + + ['seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['1 minute ago', new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['3 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['59 minutes ago', new \DateTime('Wed, 02 Oct 2013 23:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['1 hour ago', new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['3 hours ago', new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['2 days ago', new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + + [$deL10N->t('seconds ago'), new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n minute ago', '%n minutes ago', 1), new \DateTime('Wed, 02 Oct 2013 23:58:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n minute ago', '%n minutes ago', 3), new \DateTime('Wed, 02 Oct 2013 23:56:30 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n hour ago', '%n hours ago', 1), new \DateTime('Wed, 02 Oct 2013 22:59:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n hour ago', '%n hours ago', 3), new \DateTime('Wed, 02 Oct 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 20:39:59 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + + ]; } /** @@ -85,60 +85,60 @@ class DateTimeFormatterTest extends TestCase { public function formatDateSpanData() { $time = 1416916800; // Use a fixed timestamp so we don't switch days/years with the getTimestampAgo $deL10N = \OC::$server->getL10N('lib', 'de'); - return array( + return [ // Normal testing - array('today', $this->getTimestampAgo($time, 30, 15), $time), - array('yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time), - array('tomorrow', $time, $this->getTimestampAgo($time, 0, 0, 0, 1)), - array('4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time), - array('in 4 days', $time, $this->getTimestampAgo($time, 0, 0, 0, 4)), - array('5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time), - array('next month', $time, $this->getTimestampAgo($time, 0, 0, 0, 32)), - array('in 5 months', $time, $this->getTimestampAgo($time, 0, 0, 0, 155)), - array('2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time), - array('next year', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('in 2 years', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 2)), + ['today', $this->getTimestampAgo($time, 30, 15), $time], + ['yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time], + ['tomorrow', $time, $this->getTimestampAgo($time, 0, 0, 0, 1)], + ['4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time], + ['in 4 days', $time, $this->getTimestampAgo($time, 0, 0, 0, 4)], + ['5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time], + ['next month', $time, $this->getTimestampAgo($time, 0, 0, 0, 32)], + ['in 5 months', $time, $this->getTimestampAgo($time, 0, 0, 0, 155)], + ['2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time], + ['next year', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['in 2 years', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 2)], // Test with compare timestamp - array('today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('yesterday', $this->getTimestampAgo($time, 30, 15, 3, 1, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('5 months ago', $this->getTimestampAgo($time, 30, 15, 3, 155, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), - array('2 years ago', $this->getTimestampAgo($time, 30, 15, 3, 35, 3), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), + ['today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['yesterday', $this->getTimestampAgo($time, 30, 15, 3, 1, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['5 months ago', $this->getTimestampAgo($time, 30, 15, 3, 155, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], + ['2 years ago', $this->getTimestampAgo($time, 30, 15, 3, 35, 3), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)], // Test translations - array($deL10N->t('today'), new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N), - array($deL10N->t('yesterday'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), - array($deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N), - array($deL10N->n('%n month ago', '%n months ago', 9), new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), - array($deL10N->n('%n year ago', '%n years ago', 2), new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N), + [$deL10N->t('today'), new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000'), $deL10N], + [$deL10N->t('yesterday'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N], + [$deL10N->n('%n day ago', '%n days ago', 2), new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), $deL10N], + [$deL10N->n('%n month ago', '%n months ago', 9), new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N], + [$deL10N->n('%n year ago', '%n years ago', 2), new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000'), $deL10N], // Test time - array('today', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('today', new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('today', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), + ['today', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['today', new \DateTime('Wed, 02 Oct 2013 12:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['today', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], // Test some special yesterdays - array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), - array('yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), - array('yesterday', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), - array('yesterday', new \DateTime('Mon, 31 Dec 2012 00:00:00 +0000'), new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000')), + ['yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')], + ['yesterday', new \DateTime('Tue, 01 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')], + ['yesterday', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')], + ['yesterday', new \DateTime('Mon, 31 Dec 2012 00:00:00 +0000'), new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000')], // Test last month - array('2 days ago', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')), - array('last month', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 31 Oct 2013 00:00:00 +0000')), - array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')), - array('last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Thu, 31 Oct 2013 00:00:00 +0000')), + ['2 days ago', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000')], + ['last month', new \DateTime('Mon, 30 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 31 Oct 2013 00:00:00 +0000')], + ['last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Tue, 01 Oct 2013 00:00:00 +0000')], + ['last month', new \DateTime('Sun, 01 Sep 2013 00:00:00 +0000'), new \DateTime('Thu, 31 Oct 2013 00:00:00 +0000')], // Test last year - array('9 months ago', new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('11 months ago', new \DateTime('Thu, 03 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('last year', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('last year', new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - array('2 years ago', new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')), - ); + ['9 months ago', new \DateTime('Tue, 31 Dec 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['11 months ago', new \DateTime('Thu, 03 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['last year', new \DateTime('Wed, 02 Oct 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['last year', new \DateTime('Tue, 01 Jan 2013 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ['2 years ago', new \DateTime('Sun, 01 Jan 2012 00:00:00 +0000'), new \DateTime('Thu, 02 Oct 2014 00:00:00 +0000')], + ]; } /** @@ -149,9 +149,9 @@ class DateTimeFormatterTest extends TestCase { } public function formatDateData() { - return array( - array(1102831200, 'December 12, 2004'), - ); + return [ + [1102831200, 'December 12, 2004'], + ]; } /** @@ -162,10 +162,10 @@ class DateTimeFormatterTest extends TestCase { } public function formatDateTimeData() { - return array( - array(1350129205, null, 'October 13, 2012 at 11:53:25 AM GMT+0'), - array(1350129205, new \DateTimeZone('Europe/Berlin'), 'October 13, 2012 at 1:53:25 PM GMT+2'), - ); + return [ + [1350129205, null, 'October 13, 2012 at 11:53:25 AM GMT+0'], + [1350129205, new \DateTimeZone('Europe/Berlin'), 'October 13, 2012 at 1:53:25 PM GMT+2'], + ]; } /** diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index 737a41425e1..004292eb47f 100644 --- a/tests/lib/DirectEditing/ManagerTest.php +++ b/tests/lib/DirectEditing/ManagerTest.php @@ -12,7 +12,6 @@ use OCP\DirectEditing\IEditor; use OCP\DirectEditing\IToken; use OCP\Files\Folder; use OCP\Files\IRootFolder; -use OCP\Files\NotFoundException; use OCP\IDBConnection; use OCP\IL10N; use OCP\IUserSession; diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php index e2c76db7ed9..3365b1fedca 100644 --- a/tests/lib/Encryption/DecryptAllTest.php +++ b/tests/lib/Encryption/DecryptAllTest.php @@ -33,7 +33,6 @@ use OCP\UserInterface; use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Test\TestCase; diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php index 31936a4176b..7e21fe881fc 100644 --- a/tests/lib/Encryption/Keys/StorageTest.php +++ b/tests/lib/Encryption/Keys/StorageTest.php @@ -63,7 +63,7 @@ class StorageTest extends TestCase { public function testSetFileKey() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -143,7 +143,7 @@ class StorageTest extends TestCase { public function testSetFileKeySystemWide() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturn(true); @@ -164,7 +164,7 @@ class StorageTest extends TestCase { public function testGetFileKeySystemWide() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -272,7 +272,7 @@ class StorageTest extends TestCase { public function testDeleteFileKeySystemWide() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -296,7 +296,7 @@ class StorageTest extends TestCase { public function testDeleteFileKey() { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->willReturn(array('user1', '/files/foo.txt')); + ->willReturn(['user1', '/files/foo.txt']); $this->util->expects($this->any()) ->method('stripPartialFileExtension') ->willReturnArgument(0); @@ -335,7 +335,7 @@ class StorageTest extends TestCase { ->willReturn(true); $this->util->expects($this->any()) ->method('getUidAndFilename') - ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); + ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { @@ -366,7 +366,7 @@ class StorageTest extends TestCase { ->willReturn(true); $this->util->expects($this->any()) ->method('getUidAndFilename') - ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); + ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturnCallback(function($path, $owner) use ($systemWideMountSource, $systemWideMountTarget) { @@ -385,37 +385,37 @@ class StorageTest extends TestCase { $path = $args[0]; $parts = explode('/', $path); - return array($parts[1], '/' . implode('/', array_slice($parts, 2))); + return [$parts[1], '/' . implode('/', array_slice($parts, 2))]; } public function dataProviderCopyRename() { - return array( - array('/user1/files/source.txt', '/user1/files/target.txt', false, false, - '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user1/files/foo/source.txt', '/user1/files/target.txt', false, false, - '/user1/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user1/files/source.txt', '/user1/files/foo/target.txt', false, false, - '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'), - array('/user1/files/source.txt', '/user1/files/foo/target.txt', true, true, - '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'), - array('/user1/files/source.txt', '/user1/files/target.txt', false, true, - '/user1/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'), - array('/user1/files/source.txt', '/user1/files/target.txt', true, false, - '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - - array('/user2/files/source.txt', '/user1/files/target.txt', false, false, - '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user2/files/foo/source.txt', '/user1/files/target.txt', false, false, - '/user2/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - array('/user2/files/source.txt', '/user1/files/foo/target.txt', false, false, - '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'), - array('/user2/files/source.txt', '/user1/files/foo/target.txt', true, true, - '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'), - array('/user2/files/source.txt', '/user1/files/target.txt', false, true, - '/user2/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'), - array('/user2/files/source.txt', '/user1/files/target.txt', true, false, - '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'), - ); + return [ + ['/user1/files/source.txt', '/user1/files/target.txt', false, false, + '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user1/files/foo/source.txt', '/user1/files/target.txt', false, false, + '/user1/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user1/files/source.txt', '/user1/files/foo/target.txt', false, false, + '/user1/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'], + ['/user1/files/source.txt', '/user1/files/foo/target.txt', true, true, + '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'], + ['/user1/files/source.txt', '/user1/files/target.txt', false, true, + '/user1/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'], + ['/user1/files/source.txt', '/user1/files/target.txt', true, false, + '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + + ['/user2/files/source.txt', '/user1/files/target.txt', false, false, + '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user2/files/foo/source.txt', '/user1/files/target.txt', false, false, + '/user2/files_encryption/keys/files/foo/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ['/user2/files/source.txt', '/user1/files/foo/target.txt', false, false, + '/user2/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/foo/target.txt/'], + ['/user2/files/source.txt', '/user1/files/foo/target.txt', true, true, + '/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/foo/target.txt/'], + ['/user2/files/source.txt', '/user1/files/target.txt', false, true, + '/user2/files_encryption/keys/files/source.txt/', '/files_encryption/keys/files/target.txt/'], + ['/user2/files/source.txt', '/user1/files/target.txt', true, false, + '/files_encryption/keys/files/source.txt/', '/user1/files_encryption/keys/files/target.txt/'], + ]; } /** @@ -432,7 +432,7 @@ class StorageTest extends TestCase { $this->util->expects($this->any()) ->method('getUidAndFilename') - ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); + ->willReturnCallback([$this, 'getUidAndFilenameCallback']); $this->util->expects($this->any()) ->method('isSystemWideMountPoint') ->willReturn($systemWideMountPoint); @@ -460,15 +460,15 @@ class StorageTest extends TestCase { ->willReturn(false); $this->view->expects($this->any()) ->method('mkdir') - ->will($this->returnCallback(array($this, 'mkdirCallback'))); + ->willReturnCallback([$this, 'mkdirCallback']); - $this->mkdirStack = array( + $this->mkdirStack = [ '/user1/files_encryption/keys/foo', '/user1/files_encryption/keys', '/user1/files_encryption', - '/user1'); + '/user1']; - self::invokePrivate($this->storage, 'keySetPreparation', array('/user1/files_encryption/keys/foo')); + self::invokePrivate($this->storage, 'keySetPreparation', ['/user1/files_encryption/keys/foo']); } public function mkdirCallback() { diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php index 28d7ca81163..6328df3dc30 100644 --- a/tests/lib/Encryption/UpdateTest.php +++ b/tests/lib/Encryption/UpdateTest.php @@ -121,10 +121,10 @@ class UpdateTest extends TestCase { * @return array */ public function dataTestUpdate() { - return array( - array('/user/files/foo', true, ['/user/files/foo/file1.txt', '/user/files/foo/file1.txt'], 2), - array('/user/files/test.txt', false, [], 1), - ); + return [ + ['/user/files/foo', true, ['/user/files/foo/file1.txt', '/user/files/foo/file1.txt'], 2], + ['/user/files/test.txt', false, [], 1], + ]; } /** @@ -168,14 +168,14 @@ class UpdateTest extends TestCase { * @return array */ public function dataTestPostRename() { - return array( - array('/test.txt', '/testNew.txt', true), - array('/test.txt', '/testNew.txt', false), - array('/folder/test.txt', '/testNew.txt', true), - array('/folder/test.txt', '/testNew.txt', false), - array('/folder/test.txt', '/testNew.txt', true), - array('/test.txt', '/folder/testNew.txt', false), - ); + return [ + ['/test.txt', '/testNew.txt', true], + ['/test.txt', '/testNew.txt', false], + ['/folder/test.txt', '/testNew.txt', true], + ['/folder/test.txt', '/testNew.txt', false], + ['/folder/test.txt', '/testNew.txt', true], + ['/test.txt', '/folder/testNew.txt', false], + ]; } @@ -208,10 +208,10 @@ class UpdateTest extends TestCase { * @return array */ public function dataTestPostRestore() { - return array( - array(true), - array(false), - ); + return [ + [true], + [false], + ]; } /** diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php index e503da109a8..0ac474faa0f 100644 --- a/tests/lib/Encryption/UtilTest.php +++ b/tests/lib/Encryption/UtilTest.php @@ -101,7 +101,7 @@ class UtilTest extends TestCase { $this->expectException(\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException::class); - $header = array('header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo'); + $header = ['header1' => 1, 'header2' => 2, 'oc_encryption_module' => 'foo']; $em = $this->createMock(IEncryptionModule::class); $em->expects($this->any())->method('getId')->willReturn('moduleId'); @@ -120,7 +120,7 @@ class UtilTest extends TestCase { $this->userManager ->expects($this->any()) ->method('userExists') - ->will($this->returnCallback(array($this, 'isExcludedCallback'))); + ->willReturnCallback([$this, 'isExcludedCallback']); $this->assertSame($expected, $this->util->isExcluded($path) @@ -128,17 +128,17 @@ class UtilTest extends TestCase { } public function providePathsForTestIsExcluded() { - return array( - array('/files_encryption', '', true), - array('files_encryption/foo.txt', '', true), - array('test/foo.txt', '', false), - array('/user1/files_encryption/foo.txt', '', true), - array('/user1/files/foo.txt', '', false), - array('/keyStorage/user1/files/foo.txt', 'keyStorage', true), - array('/keyStorage/files_encryption', '/keyStorage', true), - array('keyStorage/user1/files_encryption', '/keyStorage/', true), + return [ + ['/files_encryption', '', true], + ['files_encryption/foo.txt', '', true], + ['test/foo.txt', '', false], + ['/user1/files_encryption/foo.txt', '', true], + ['/user1/files/foo.txt', '', false], + ['/keyStorage/user1/files/foo.txt', 'keyStorage', true], + ['/keyStorage/files_encryption', '/keyStorage', true], + ['keyStorage/user1/files_encryption', '/keyStorage/', true], - ); + ]; } public function isExcludedCallback() { @@ -160,15 +160,15 @@ class UtilTest extends TestCase { } public function dataTestIsFile() { - return array( - array('/user/files/test.txt', true), - array('/user/files', true), - array('/user/files_versions/test.txt', false), - array('/user/foo/files/test.txt', false), - array('/files/foo/files/test.txt', false), - array('/user', false), - array('/user/test.txt', false), - ); + return [ + ['/user/files/test.txt', true], + ['/user/files', true], + ['/user/files_versions/test.txt', false], + ['/user/foo/files/test.txt', false], + ['/files/foo/files/test.txt', false], + ['/user', false], + ['/user/test.txt', false], + ]; } /** @@ -183,12 +183,12 @@ class UtilTest extends TestCase { } public function dataTestStripPartialFileExtension() { - return array( - array('/foo/test.txt', '/foo/test.txt'), - array('/foo/test.txt.part', '/foo/test.txt'), - array('/foo/test.txt.ocTransferId7567846853.part', '/foo/test.txt'), - array('/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'), - ); + return [ + ['/foo/test.txt', '/foo/test.txt'], + ['/foo/test.txt.part', '/foo/test.txt'], + ['/foo/test.txt.ocTransferId7567846853.part', '/foo/test.txt'], + ['/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'], + ]; } } diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php index aece7f146f6..179b5c12123 100644 --- a/tests/lib/ErrorHandlerTest.php +++ b/tests/lib/ErrorHandlerTest.php @@ -29,13 +29,13 @@ class ErrorHandlerTest extends \Test\TestCase { * @return array */ function passwordProvider() { - return array( - array('user', 'password'), - array('user@owncloud.org', 'password'), - array('user', 'pass@word'), - array('us:er', 'password'), - array('user', 'pass:word'), - ); + return [ + ['user', 'password'], + ['user@owncloud.org', 'password'], + ['user', 'pass@word'], + ['us:er', 'password'], + ['user', 'pass:word'], + ]; } diff --git a/tests/lib/FileChunkingTest.php b/tests/lib/FileChunkingTest.php index 75a6913d4ad..7cbabe697a4 100644 --- a/tests/lib/FileChunkingTest.php +++ b/tests/lib/FileChunkingTest.php @@ -61,10 +61,10 @@ class FileChunkingTest extends \Test\TestCase { $cache->expects($this->atLeastOnce()) ->method('hasKey') - ->will($this->returnCallback(function ($key) use ($present) { + ->willReturnCallback(function ($key) use ($present) { $data = explode('-', $key); return in_array($data[3], $present); - })); + }); $fileChunking->method('getCache')->willReturn($cache); diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php index b2816c03094..40d87214aad 100644 --- a/tests/lib/Files/Cache/CacheTest.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -55,8 +55,8 @@ class CacheTest extends \Test\TestCase { public function testSimple() { $file1 = 'foo'; $file2 = 'foo/bar'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $data2 = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $data2 = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $this->assertFalse($this->cache->inCache($file1)); $this->assertEquals($this->cache->get($file1), null); @@ -84,7 +84,7 @@ class CacheTest extends \Test\TestCase { $this->assertEquals($id1, $this->cache->getParentId($file2)); $newSize = 1050; - $newId2 = $this->cache->put($file2, array('size' => $newSize)); + $newId2 = $this->cache->put($file2, ['size' => $newSize]); $cacheData2 = $this->cache->get($file2); $this->assertEquals($newId2, $id2); $this->assertEquals($cacheData2['size'], $newSize); @@ -101,14 +101,14 @@ class CacheTest extends \Test\TestCase { public function testPartial() { $file1 = 'foo'; - $this->cache->put($file1, array('size' => 10)); - $this->assertEquals(array('size' => 10), $this->cache->get($file1)); + $this->cache->put($file1, ['size' => 10]); + $this->assertEquals(['size' => 10], $this->cache->get($file1)); - $this->cache->put($file1, array('mtime' => 15)); - $this->assertEquals(array('size' => 10, 'mtime' => 15), $this->cache->get($file1)); + $this->cache->put($file1, ['mtime' => 15]); + $this->assertEquals(['size' => 10, 'mtime' => 15], $this->cache->get($file1)); - $this->cache->put($file1, array('size' => 12)); - $this->assertEquals(array('size' => 12, 'mtime' => 15), $this->cache->get($file1)); + $this->cache->put($file1, ['size' => 12]); + $this->assertEquals(['size' => 12, 'mtime' => 15], $this->cache->get($file1)); } /** @@ -124,10 +124,10 @@ class CacheTest extends \Test\TestCase { } $file2 = $folder . '/bar'; $file3 = $folder . '/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); - $fileData = array(); - $fileData['bar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; + $fileData = []; + $fileData['bar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($folder, $data1); $this->cache->put($file2, $fileData['bar']); @@ -143,12 +143,12 @@ class CacheTest extends \Test\TestCase { } $file4 = $folder . '/unkownSize'; - $fileData['unkownSize'] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(-1, $this->cache->calculateFolderSize($folder)); - $fileData['unkownSize'] = array('size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(1025, $this->cache->calculateFolderSize($folder)); @@ -164,8 +164,8 @@ class CacheTest extends \Test\TestCase { } public function testRemoveRecursive() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); - $fileData = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'text/plain'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; + $fileData = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'text/plain']; $folders = ['folder', 'folder/subfolder', 'folder/sub2', 'folder/sub2/sub3']; $files = ['folder/foo.txt', 'folder/bar.txt', 'folder/subfolder/asd.txt', 'folder/sub2/qwerty.txt', 'folder/sub2/sub3/foo.txt']; @@ -184,27 +184,27 @@ class CacheTest extends \Test\TestCase { public function folderDataProvider() { - return array( - array('folder'), + return [ + ['folder'], // that was too easy, try something harder - array('☺, WHITE SMILING FACE, UTF-8 hex E298BA'), + ['☺, WHITE SMILING FACE, UTF-8 hex E298BA'], // what about 4 byte utf-8 - array('😐, NEUTRAL_FACE, UTF-8 hex F09F9890'), + ['😐, NEUTRAL_FACE, UTF-8 hex F09F9890'], // now the crazy stuff - array(', UNASSIGNED PRIVATE USE, UTF-8 hex EF9890'), + [', UNASSIGNED PRIVATE USE, UTF-8 hex EF9890'], // and my favorite - array('w͢͢͝h͡o͢͡ ̸͢k̵͟n̴͘ǫw̸̛s͘ ̀́w͘͢ḩ̵a҉̡͢t ̧̕h́o̵r͏̵rors̡ ̶͡͠lį̶e͟͟ ̶͝in͢ ͏t̕h̷̡͟e ͟͟d̛a͜r̕͡k̢̨ ͡h̴e͏a̷̢̡rt́͏ ̴̷͠ò̵̶f̸ u̧͘ní̛͜c͢͏o̷͏d̸͢e̡͝') - ); + ['w͢͢͝h͡o͢͡ ̸͢k̵͟n̴͘ǫw̸̛s͘ ̀́w͘͢ḩ̵a҉̡͢t ̧̕h́o̵r͏̵rors̡ ̶͡͠lį̶e͟͟ ̶͝in͢ ͏t̕h̷̡͟e ͟͟d̛a͜r̕͡k̢̨ ͡h̴e͏a̷̢̡rt́͏ ̴̷͠ò̵̶f̸ u̧͘ní̛͜c͢͏o̷͏d̸͢e̡͝'] + ]; } public function testEncryptedFolder() { $file1 = 'folder'; $file2 = 'folder/bar'; $file3 = 'folder/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); - $fileData = array(); - $fileData['bar'] = array('size' => 1000, 'encrypted' => 1, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'encrypted' => 1, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; + $fileData = []; + $fileData['bar'] = ['size' => 1000, 'encrypted' => 1, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'encrypted' => 1, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file1, $data1); $this->cache->put($file2, $fileData['bar']); @@ -217,12 +217,12 @@ class CacheTest extends \Test\TestCase { } $file4 = 'folder/unkownSize'; - $fileData['unkownSize'] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(-1, $this->cache->calculateFolderSize($file1)); - $fileData['unkownSize'] = array('size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file'); + $fileData['unkownSize'] = ['size' => 5, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file4, $fileData['unkownSize']); $this->assertEquals(1025, $this->cache->calculateFolderSize($file1)); @@ -243,10 +243,10 @@ class CacheTest extends \Test\TestCase { public function testRootFolderSizeForNonHomeStorage() { $dir1 = 'knownsize'; $dir2 = 'unknownsize'; - $fileData = array(); - $fileData[''] = array('size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir2] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory'); + $fileData = []; + $fileData[''] = ['size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir1] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir2] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory']; $this->cache->put('', $fileData['']); $this->cache->put($dir1, $fileData[$dir1]); @@ -269,11 +269,11 @@ class CacheTest extends \Test\TestCase { function testStatus() { $this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->getStatus('foo')); - $this->cache->put('foo', array('size' => -1)); + $this->cache->put('foo', ['size' => -1]); $this->assertEquals(\OC\Files\Cache\Cache::PARTIAL, $this->cache->getStatus('foo')); - $this->cache->put('foo', array('size' => -1, 'mtime' => 20, 'mimetype' => 'foo/file')); + $this->cache->put('foo', ['size' => -1, 'mtime' => 20, 'mimetype' => 'foo/file']); $this->assertEquals(\OC\Files\Cache\Cache::SHALLOW, $this->cache->getStatus('foo')); - $this->cache->put('foo', array('size' => 10)); + $this->cache->put('foo', ['size' => 10]); $this->assertEquals(\OC\Files\Cache\Cache::COMPLETE, $this->cache->getStatus('foo')); } @@ -292,7 +292,7 @@ class CacheTest extends \Test\TestCase { public function testPutWithAllKindOfQuotes($fileName) { $this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->get($fileName)); - $this->cache->put($fileName, array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file', 'etag' => $fileName)); + $this->cache->put($fileName, ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file', 'etag' => $fileName]); $cacheEntry = $this->cache->get($fileName); $this->assertEquals($fileName, $cacheEntry['etag']); @@ -303,10 +303,10 @@ class CacheTest extends \Test\TestCase { $file1 = 'folder'; $file2 = 'folder/foobar'; $file3 = 'folder/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $fileData = array(); - $fileData['foobar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $fileData = []; + $fileData['foobar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file1, $data1); $this->cache->put($file2, $fileData['foobar']); @@ -339,12 +339,12 @@ class CacheTest extends \Test\TestCase { $file3 = 'folder/foo'; $file4 = 'folder/foo2'; $file5 = 'folder/foo3'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $fileData = array(); - $fileData['foobar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); - $fileData['foo2'] = array('size' => 25, 'mtime' => 28, 'mimetype' => 'foo/file'); - $fileData['foo3'] = array('size' => 88, 'mtime' => 34, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $fileData = []; + $fileData['foobar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; + $fileData['foo2'] = ['size' => 25, 'mtime' => 28, 'mimetype' => 'foo/file']; + $fileData['foo3'] = ['size' => 88, 'mtime' => 34, 'mimetype' => 'foo/file']; $id1 = $this->cache->put($file1, $data1); $id2 = $this->cache->put($file2, $fileData['foobar']); @@ -387,10 +387,10 @@ class CacheTest extends \Test\TestCase { $file1 = 'folder'; $file2 = 'folder/foobar'; $file3 = 'folder/foo'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); - $fileData = array(); - $fileData['foobar'] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); - $fileData['foo'] = array('size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; + $fileData = []; + $fileData['foobar'] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; + $fileData['foo'] = ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file']; $this->cache->put($file1, $data1); $this->cache->put($file2, $fileData['foobar']); @@ -430,8 +430,8 @@ class CacheTest extends \Test\TestCase { * @dataProvider movePathProvider */ function testMove($sourceFolder, $targetFolder, $children) { - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar'); - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar']; + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // create folders foreach ([$sourceFolder, $targetFolder] as $current) { @@ -469,7 +469,7 @@ class CacheTest extends \Test\TestCase { $file2 = 'folder2'; $file3 = 'folder3'; $file4 = 'folder4'; - $data = array('size' => 10, 'mtime' => 50, 'mimetype' => 'foo/bar'); + $data = ['size' => 10, 'mtime' => 50, 'mimetype' => 'foo/bar']; $this->cache->put($file1, $data); $data['size'] = -1; @@ -484,44 +484,44 @@ class CacheTest extends \Test\TestCase { function testNonExisting() { $this->assertFalse($this->cache->get('foo.txt')); $this->assertFalse($this->cache->get(-1)); - $this->assertEquals(array(), $this->cache->getFolderContents('foo')); + $this->assertEquals([], $this->cache->getFolderContents('foo')); } function testGetById() { $storageId = $this->storage->getId(); - $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $id = $this->cache->put('foo', $data); if (strlen($storageId) > 64) { $storageId = md5($storageId); } - $this->assertEquals(array($storageId, 'foo'), \OC\Files\Cache\Cache::getById($id)); + $this->assertEquals([$storageId, 'foo'], \OC\Files\Cache\Cache::getById($id)); } function testStorageMTime() { - $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $this->cache->put('foo', $data); $cachedData = $this->cache->get('foo'); $this->assertEquals($data['mtime'], $cachedData['storage_mtime']); //if no storage_mtime is saved, mtime should be used - $this->cache->put('foo', array('storage_mtime' => 30)); //when setting storage_mtime, mtime is also set + $this->cache->put('foo', ['storage_mtime' => 30]); //when setting storage_mtime, mtime is also set $cachedData = $this->cache->get('foo'); $this->assertEquals(30, $cachedData['storage_mtime']); $this->assertEquals(30, $cachedData['mtime']); - $this->cache->put('foo', array('mtime' => 25)); //setting mtime does not change storage_mtime + $this->cache->put('foo', ['mtime' => 25]); //setting mtime does not change storage_mtime $cachedData = $this->cache->get('foo'); $this->assertEquals(30, $cachedData['storage_mtime']); $this->assertEquals(25, $cachedData['mtime']); } function testLongId() { - $storage = new LongId(array()); + $storage = new LongId([]); $cache = $storage->getCache(); $storageId = $storage->getId(); - $data = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'); + $data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file']; $id = $cache->put('foo', $data); - $this->assertEquals(array(md5($storageId), 'foo'), \OC\Files\Cache\Cache::getById($id)); + $this->assertEquals([md5($storageId), 'foo'], \OC\Files\Cache\Cache::getById($id)); } /** @@ -544,9 +544,9 @@ class CacheTest extends \Test\TestCase { $cacheMock->expects($this->any()) ->method('normalize') - ->will($this->returnArgument(0)); + ->willReturnArgument(0); - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // put root folder $this->assertFalse($cacheMock->get('folder')); @@ -586,7 +586,7 @@ class CacheTest extends \Test\TestCase { // folder name "Schön" with U+0308 (un-normalized) $folderWith0308 = "\x53\x63\x68\x6f\xcc\x88\x6e"; - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // put root folder $this->assertFalse($this->cache->get('folder')); @@ -611,12 +611,12 @@ class CacheTest extends \Test\TestCase { } function bogusPathNamesProvider() { - return array( - array('/bogus.txt', 'bogus.txt'), - array('//bogus.txt', 'bogus.txt'), - array('bogus/', 'bogus'), - array('bogus//', 'bogus'), - ); + return [ + ['/bogus.txt', 'bogus.txt'], + ['//bogus.txt', 'bogus.txt'], + ['bogus/', 'bogus'], + ['bogus//', 'bogus'], + ]; } /** @@ -625,7 +625,7 @@ class CacheTest extends \Test\TestCase { * @dataProvider bogusPathNamesProvider */ public function testBogusPaths($bogusPath, $fixedBogusPath) { - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; // put root folder $this->assertFalse($this->cache->get('')); @@ -647,12 +647,12 @@ class CacheTest extends \Test\TestCase { } public function testNoReuseOfFileId() { - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain']; $this->cache->put('somefile.txt', $data1); $info = $this->cache->get('somefile.txt'); $fileId = $info['fileid']; $this->cache->remove('somefile.txt'); - $data2 = array('size' => 200, 'mtime' => 100, 'mimetype' => 'text/plain'); + $data2 = ['size' => 200, 'mtime' => 100, 'mimetype' => 'text/plain']; $this->cache->put('anotherfile.txt', $data2); $info2 = $this->cache->get('anotherfile.txt'); $fileId2 = $info2['fileid']; @@ -672,7 +672,7 @@ class CacheTest extends \Test\TestCase { * @dataProvider escapingProvider */ public function testEscaping($name) { - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain']; $this->cache->put($name, $data); $this->assertTrue($this->cache->inCache($name)); $retrievedData = $this->cache->get($name); @@ -684,7 +684,7 @@ class CacheTest extends \Test\TestCase { $this->assertTrue($this->cache->inCache($name . 'asd')); $this->cache->remove($name . 'asd'); $this->assertFalse($this->cache->inCache($name . 'asd')); - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->cache->put($name, $folderData); $this->cache->put('other', $folderData); $childs = ['asd', 'bar', 'foo', 'sub/folder']; @@ -788,8 +788,8 @@ class CacheTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); - $this->storage2 = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); + $this->storage2 = new \OC\Files\Storage\Temporary([]); $this->cache = new \OC\Files\Cache\Cache($this->storage); $this->cache2 = new \OC\Files\Cache\Cache($this->storage2); } diff --git a/tests/lib/Files/Cache/HomeCacheTest.php b/tests/lib/Files/Cache/HomeCacheTest.php index 51fc2e5bc9b..aacb91c675e 100644 --- a/tests/lib/Files/Cache/HomeCacheTest.php +++ b/tests/lib/Files/Cache/HomeCacheTest.php @@ -70,7 +70,7 @@ class HomeCacheTest extends \Test\TestCase { parent::setUp(); $this->user = new DummyUser('foo', \OC::$server->getTempManager()->getTemporaryFolder()); - $this->storage = new \OC\Files\Storage\Home(array('user' => $this->user)); + $this->storage = new \OC\Files\Storage\Home(['user' => $this->user]); $this->cache = $this->storage->getCache(); } @@ -82,11 +82,11 @@ class HomeCacheTest extends \Test\TestCase { public function testRootFolderSizeIgnoresUnknownUpdate() { $dir1 = 'files/knownsize'; $dir2 = 'files/unknownsize'; - $fileData = array(); - $fileData[''] = array('size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData['files'] = array('size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir2] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory'); + $fileData = []; + $fileData[''] = ['size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData['files'] = ['size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir1] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir2] = ['size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory']; $this->cache->put('', $fileData['']); $this->cache->put('files', $fileData['files']); @@ -114,10 +114,10 @@ class HomeCacheTest extends \Test\TestCase { public function testRootFolderSizeIsFilesSize() { $dir1 = 'files'; $afile = 'test.txt'; - $fileData = array(); - $fileData[''] = array('size' => 1500, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory'); - $fileData[$afile] = array('size' => 500, 'mtime' => 20); + $fileData = []; + $fileData[''] = ['size' => 1500, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$dir1] = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory']; + $fileData[$afile] = ['size' => 500, 'mtime' => 20]; $this->cache->put('', $fileData['']); $this->cache->put($dir1, $fileData[$dir1]); diff --git a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php index f93b95b5fe7..6e1430d146b 100644 --- a/tests/lib/Files/Cache/MoveFromCacheTraitTest.php +++ b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php @@ -23,8 +23,8 @@ class MoveFromCacheTraitTest extends CacheTest { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); - $this->storage2 = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); + $this->storage2 = new \OC\Files\Storage\Temporary([]); $this->cache = new FallBackCrossCacheMoveCache($this->storage); $this->cache2 = new FallBackCrossCacheMoveCache($this->storage2); } diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php index 6a025410cc3..52f6697cc6d 100644 --- a/tests/lib/Files/Cache/ScannerTest.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -36,7 +36,7 @@ class ScannerTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); $this->scanner = new \OC\Files\Cache\Scanner($this->storage); $this->cache = new \OC\Files\Cache\Cache($this->storage); } @@ -247,7 +247,7 @@ class ScannerTest extends \Test\TestCase { $this->scanner->scan(''); $oldData = $this->cache->get(''); $this->storage->unlink('folder/bar.txt'); - $this->cache->put('folder', array('mtime' => $this->storage->filemtime('folder'), 'storage_mtime' => $this->storage->filemtime('folder'))); + $this->cache->put('folder', ['mtime' => $this->storage->filemtime('folder'), 'storage_mtime' => $this->storage->filemtime('folder')]); $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_SIZE); $newData = $this->cache->get(''); $this->assertIsString($oldData['etag']); @@ -345,7 +345,7 @@ class ScannerTest extends \Test\TestCase { // delete the folder without removing the childs $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'; - \OC_DB::executeAudited($sql, array($oldFolderId)); + \OC_DB::executeAudited($sql, [$oldFolderId]); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); @@ -369,7 +369,7 @@ class ScannerTest extends \Test\TestCase { // delete the folder without removing the childs $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `fileid` = ?'; - \OC_DB::executeAudited($sql, array($oldFolderId)); + \OC_DB::executeAudited($sql, [$oldFolderId]); $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($oldFolderId, $cachedData['parent']); diff --git a/tests/lib/Files/Cache/UpdaterLegacyTest.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php index a3b1a428c28..02cb6d79eb1 100644 --- a/tests/lib/Files/Cache/UpdaterLegacyTest.php +++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php @@ -9,7 +9,6 @@ namespace Test\Files\Cache; use OC\Files\Filesystem as Filesystem; -use OC\Files\Storage\Temporary; use OC\Files\View; /** @@ -40,7 +39,7 @@ class UpdaterLegacyTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); $textData = "dummy file data\n"; $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png'); $this->storage->mkdir('folder'); @@ -63,7 +62,7 @@ class UpdaterLegacyTest extends \Test\TestCase { Filesystem::init(self::$user, '/' . self::$user . '/files'); Filesystem::clearMounts(); - Filesystem::mount($this->storage, array(), '/' . self::$user . '/files'); + Filesystem::mount($this->storage, [], '/' . self::$user . '/files'); \OC_Hook::clear('OC_Filesystem'); } @@ -85,7 +84,7 @@ class UpdaterLegacyTest extends \Test\TestCase { public function testWrite() { $textSize = strlen("dummy file data\n"); $imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png'); - $this->cache->put('foo.txt', array('mtime' => 100, 'storage_mtime' => 150)); + $this->cache->put('foo.txt', ['mtime' => 100, 'storage_mtime' => 150]); $rootCachedData = $this->cache->get(''); $this->assertEquals(3 * $textSize + $imageSize, $rootCachedData['size']); @@ -118,10 +117,10 @@ class UpdaterLegacyTest extends \Test\TestCase { } public function testWriteWithMountPoints() { - $storage2 = new \OC\Files\Storage\Temporary(array()); + $storage2 = new \OC\Files\Storage\Temporary([]); $storage2->getScanner()->scan(''); //initialize etags $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage'); + Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage'); $view = new View('/' . self::$user . '/files'); $folderCachedData = $view->getFileInfo('folder'); $substorageCachedData = $cache2->get(''); @@ -179,9 +178,9 @@ class UpdaterLegacyTest extends \Test\TestCase { } public function testDeleteWithMountPoints() { - $storage2 = new \OC\Files\Storage\Temporary(array()); + $storage2 = new \OC\Files\Storage\Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage'); + Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage'); Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd'); $view = new View('/' . self::$user . '/files'); $this->assertTrue($cache2->inCache('foo.txt')); @@ -235,9 +234,9 @@ class UpdaterLegacyTest extends \Test\TestCase { } public function testRenameWithMountPoints() { - $storage2 = new \OC\Files\Storage\Temporary(array()); + $storage2 = new \OC\Files\Storage\Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage'); + Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage'); Filesystem::file_put_contents('folder/substorage/foo.txt', 'asd'); $view = new View('/' . self::$user . '/files'); $this->assertTrue($cache2->inCache('foo.txt')); diff --git a/tests/lib/Files/Cache/UpdaterTest.php b/tests/lib/Files/Cache/UpdaterTest.php index 8dc5893007b..4c99b24d9d6 100644 --- a/tests/lib/Files/Cache/UpdaterTest.php +++ b/tests/lib/Files/Cache/UpdaterTest.php @@ -10,7 +10,6 @@ namespace Test\Files\Cache; use OC\Files\Filesystem; use OC\Files\Storage\Temporary; -use OC\Files\View; /** * Class UpdaterTest @@ -45,7 +44,7 @@ class UpdaterTest extends \Test\TestCase { $this->loginAsUser(); - $this->storage = new Temporary(array()); + $this->storage = new Temporary([]); $this->updater = $this->storage->getUpdater(); $this->cache = $this->storage->getCache(); } @@ -220,9 +219,9 @@ class UpdaterTest extends \Test\TestCase { } public function testMoveCrossStorage() { - $storage2 = new Temporary(array()); + $storage2 = new Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/bar'); + Filesystem::mount($storage2, [], '/bar'); $this->storage->file_put_contents('foo.txt', 'qwerty'); $this->updater->update('foo.txt'); @@ -251,9 +250,9 @@ class UpdaterTest extends \Test\TestCase { } public function testMoveFolderCrossStorage() { - $storage2 = new Temporary(array()); + $storage2 = new Temporary([]); $cache2 = $storage2->getCache(); - Filesystem::mount($storage2, array(), '/bar'); + Filesystem::mount($storage2, [], '/bar'); $this->storage->mkdir('foo'); $this->storage->mkdir('foo/bar'); $this->storage->file_put_contents('foo/foo.txt', 'qwerty'); diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php index 18f0ebe98a9..2a42a9e603f 100644 --- a/tests/lib/Files/Cache/WatcherTest.php +++ b/tests/lib/Files/Cache/WatcherTest.php @@ -20,7 +20,7 @@ class WatcherTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage[] $storages */ - private $storages = array(); + private $storages = []; protected function setUp(): void { parent::setUp(); @@ -49,7 +49,7 @@ class WatcherTest extends \Test\TestCase { $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); //set the mtime to the past so it can detect an mtime change - $cache->put('', array('storage_mtime' => 10)); + $cache->put('', ['storage_mtime' => 10]); $this->assertTrue($cache->inCache('folder/bar.txt')); $this->assertTrue($cache->inCache('folder/bar2.txt')); @@ -61,7 +61,7 @@ class WatcherTest extends \Test\TestCase { $cachedData = $cache->get('bar.test'); $this->assertEquals(3, $cachedData['size']); - $cache->put('bar.test', array('storage_mtime' => 10)); + $cache->put('bar.test', ['storage_mtime' => 10]); $storage->file_put_contents('bar.test', 'test data'); // make sure that PHP can read the new size correctly @@ -71,7 +71,7 @@ class WatcherTest extends \Test\TestCase { $cachedData = $cache->get('bar.test'); $this->assertEquals(9, $cachedData['size']); - $cache->put('folder', array('storage_mtime' => 10)); + $cache->put('folder', ['storage_mtime' => 10]); $storage->unlink('folder/bar2.txt'); $updater->checkUpdate('folder'); @@ -90,7 +90,7 @@ class WatcherTest extends \Test\TestCase { $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); //set the mtime to the past so it can detect an mtime change - $cache->put('', array('storage_mtime' => 10)); + $cache->put('', ['storage_mtime' => 10]); $storage->unlink('foo.txt'); $storage->rename('folder', 'foo.txt'); @@ -107,7 +107,7 @@ class WatcherTest extends \Test\TestCase { $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $storage->unlink('foo.txt'); $storage->rename('folder', 'foo.txt'); @@ -124,14 +124,14 @@ class WatcherTest extends \Test\TestCase { $updater = $storage->getWatcher(); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_NEVER); $storage->file_put_contents('foo.txt', 'q'); $this->assertFalse($updater->checkUpdate('foo.txt')); - $cache->put('foo.txt', array('storage_mtime' => 20)); + $cache->put('foo.txt', ['storage_mtime' => 20]); $storage->file_put_contents('foo.txt', 'w'); $this->assertFalse($updater->checkUpdate('foo.txt')); } @@ -142,14 +142,14 @@ class WatcherTest extends \Test\TestCase { $updater = $storage->getWatcher(); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE); $storage->file_put_contents('foo.txt', 'q'); $this->assertTrue($updater->checkUpdate('foo.txt')); - $cache->put('foo.txt', array('storage_mtime' => 20)); + $cache->put('foo.txt', ['storage_mtime' => 20]); $storage->file_put_contents('foo.txt', 'w'); $this->assertFalse($updater->checkUpdate('foo.txt')); } @@ -160,14 +160,14 @@ class WatcherTest extends \Test\TestCase { $updater = $storage->getWatcher(); //set the mtime to the past so it can detect an mtime change - $cache->put('foo.txt', array('storage_mtime' => 10)); + $cache->put('foo.txt', ['storage_mtime' => 10]); $updater->setPolicy(\OC\Files\Cache\Watcher::CHECK_ALWAYS); $storage->file_put_contents('foo.txt', 'q'); $this->assertTrue($updater->checkUpdate('foo.txt')); - $cache->put('foo.txt', array('storage_mtime' => 20)); + $cache->put('foo.txt', ['storage_mtime' => 20]); $storage->file_put_contents('foo.txt', 'w'); $this->assertTrue($updater->checkUpdate('foo.txt')); } @@ -177,7 +177,7 @@ class WatcherTest extends \Test\TestCase { * @return \OC\Files\Storage\Storage */ private function getTestStorage($scan = true) { - $storage = new \OC\Files\Storage\Temporary(array()); + $storage = new \OC\Files\Storage\Temporary([]); $textData = "dummy file data\n"; $imgData = file_get_contents(\OC::$SERVERROOT . '/core/img/logo/logo.png'); $storage->mkdir('folder'); diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index 9c1a8c14101..5d7e9f8ec08 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -34,7 +34,7 @@ class CacheJailTest extends CacheTest { function testSearchOutsideJail() { $file1 = 'foo/foobar'; $file2 = 'folder/foobar'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder']; $this->sourceCache->put($file1, $data1); $this->sourceCache->put($file2, $data1); @@ -50,7 +50,7 @@ class CacheJailTest extends CacheTest { $file1 = 'foo/foobar'; $file2 = 'foo/foobar/asd'; $file3 = 'folder/foobar'; - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('foo', $data1); $this->sourceCache->put($file1, $data1); @@ -64,7 +64,7 @@ class CacheJailTest extends CacheTest { } function testGetById() { - $data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $id = $this->sourceCache->put('foo/bar', $data1); // path from jailed foo of foo/bar is bar @@ -83,7 +83,7 @@ class CacheJailTest extends CacheTest { } function testMoveFromJail() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('source', $folderData); $this->sourceCache->put('source/foo', $folderData); @@ -99,7 +99,7 @@ class CacheJailTest extends CacheTest { } function testMoveToJail() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('source', $folderData); $this->sourceCache->put('source/foo', $folderData); @@ -115,7 +115,7 @@ class CacheJailTest extends CacheTest { } function testMoveBetweenJail() { - $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'); + $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory']; $this->sourceCache->put('source', $folderData); $this->sourceCache->put('source/foo', $folderData); diff --git a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php index 9883fc1da27..20c20974c07 100644 --- a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php +++ b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php @@ -36,12 +36,12 @@ class CachePermissionsMaskTest extends CacheTest { } public function maskProvider() { - return array( - array(Constants::PERMISSION_ALL), - array(Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE), - array(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE), - array(Constants::PERMISSION_READ) - ); + return [ + [Constants::PERMISSION_ALL], + [Constants::PERMISSION_ALL - Constants::PERMISSION_SHARE], + [Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE], + [Constants::PERMISSION_READ] + ]; } /** @@ -50,12 +50,12 @@ class CachePermissionsMaskTest extends CacheTest { */ public function testGetMasked($mask) { $cache = $this->getMaskedCached($mask); - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL]; $this->sourceCache->put('foo', $data); $result = $cache->get('foo'); $this->assertEquals($mask, $result['permissions']); - $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE); + $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE]; $this->sourceCache->put('bar', $data); $result = $cache->get('bar'); $this->assertEquals($mask & ~Constants::PERMISSION_DELETE, $result['permissions']); diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php index 2f61f634ffb..6f347a504cb 100644 --- a/tests/lib/Files/Config/UserMountCacheTest.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -77,24 +77,24 @@ class UserMountCacheTest extends TestCase { ->getMock(); $storageCache->expects($this->any()) ->method('getNumericId') - ->will($this->returnValue($storageId)); + ->willReturn($storageId); $cache = $this->getMockBuilder('\OC\Files\Cache\Cache') ->disableOriginalConstructor() ->getMock(); $cache->expects($this->any()) ->method('getId') - ->will($this->returnValue($rootId)); + ->willReturn($rootId); $storage = $this->getMockBuilder('\OC\Files\Storage\Storage') ->disableOriginalConstructor() ->getMock(); $storage->expects($this->any()) ->method('getStorageCache') - ->will($this->returnValue($storageCache)); + ->willReturn($storageCache); $storage->expects($this->any()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); return [$storage, $rootId]; } @@ -401,7 +401,7 @@ class UserMountCacheTest extends TestCase { $mount1->expects($this->any()) ->method('getStorageRootId') - ->will($this->returnValue($folderId)); + ->willReturn($folderId); $this->cache->registerMounts($user1, [$mount1]); @@ -434,7 +434,7 @@ class UserMountCacheTest extends TestCase { $mount1->expects($this->any()) ->method('getStorageRootId') - ->will($this->returnValue($folderId)); + ->willReturn($folderId); $this->cache->registerMounts($user1, [$mount1]); @@ -481,11 +481,11 @@ class UserMountCacheTest extends TestCase { $mount1->expects($this->any()) ->method('getStorageRootId') - ->will($this->returnValue($rootId)); + ->willReturn($rootId); $mount1->expects($this->any()) ->method('getNumericStorageId') - ->will($this->returnValue(2)); + ->willReturn(2); $this->cache->registerMounts($user1, [$mount1]); diff --git a/tests/lib/Files/EtagTest.php b/tests/lib/Files/EtagTest.php index d3b372fe137..39069ce4dfe 100644 --- a/tests/lib/Files/EtagTest.php +++ b/tests/lib/Files/EtagTest.php @@ -10,7 +10,6 @@ namespace Test\Files; use OC\Files\Filesystem; use OCP\EventDispatcher\IEventDispatcher; -use OCP\Share; use OCA\Files_Sharing\AppInfo\Application; /** @@ -67,7 +66,7 @@ class EtagTest extends \Test\TestCase { Filesystem::file_put_contents('/folder/bar.txt', 'fgh'); Filesystem::file_put_contents('/folder/subfolder/qwerty.txt', 'jkl'); - $files = array('/foo.txt', '/folder/bar.txt', '/folder/subfolder', '/folder/subfolder/qwerty.txt'); + $files = ['/foo.txt', '/folder/bar.txt', '/folder/subfolder', '/folder/subfolder/qwerty.txt']; $originalEtags = $this->getEtags($files); $scanner = new \OC\Files\Utils\Scanner($user1, \OC::$server->getDatabaseConnection(), \OC::$server->query(IEventDispatcher::class), \OC::$server->getLogger()); @@ -84,7 +83,7 @@ class EtagTest extends \Test\TestCase { * @param string[] $files */ private function getEtags($files) { - $etags = array(); + $etags = []; foreach ($files as $file) { $info = Filesystem::getFileInfo($file); $etags[$file] = $info['etag']; diff --git a/tests/lib/Files/FileInfoTest.php b/tests/lib/Files/FileInfoTest.php index 0037941b629..fd2b506beb9 100644 --- a/tests/lib/Files/FileInfoTest.php +++ b/tests/lib/Files/FileInfoTest.php @@ -8,11 +8,9 @@ namespace Test\Files; -use OC\AllConfig; use OC\Files\FileInfo; use OC\Files\Storage\Home; use OC\Files\Storage\Temporary; -use OC\User\User; use OCP\IConfig; use OCP\IUser; use Test\TestCase; diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php index 6d0362772ca..d98256501b1 100644 --- a/tests/lib/Files/FilesystemTest.php +++ b/tests/lib/Files/FilesystemTest.php @@ -66,7 +66,7 @@ class FilesystemTest extends \Test\TestCase { /** * @var array tmpDirs */ - private $tmpDirs = array(); + private $tmpDirs = []; /** * @return array @@ -74,7 +74,7 @@ class FilesystemTest extends \Test\TestCase { private function getStorageData() { $dir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->tmpDirs[] = $dir; - return array('datadir' => $dir); + return ['datadir' => $dir]; } protected function setUp(): void { @@ -225,29 +225,29 @@ class FilesystemTest extends \Test\TestCase { } public function isValidPathData() { - return array( - array('/', true), - array('/path', true), - array('/foo/bar', true), - array('/foo//bar/', true), - array('/foo////bar', true), - array('/foo//\///bar', true), - array('/foo/bar/.', true), - array('/foo/bar/./', true), - array('/foo/bar/./.', true), - array('/foo/bar/././', true), - array('/foo/bar/././..bar', true), - array('/foo/bar/././..bar/a', true), - array('/foo/bar/././..', false), - array('/foo/bar/././../', false), - array('/foo/bar/.././', false), - array('/foo/bar/../../', false), - array('/foo/bar/../..\\', false), - array('..', false), - array('../', false), - array('../foo/bar', false), - array('..\foo/bar', false), - ); + return [ + ['/', true], + ['/path', true], + ['/foo/bar', true], + ['/foo//bar/', true], + ['/foo////bar', true], + ['/foo//\///bar', true], + ['/foo/bar/.', true], + ['/foo/bar/./', true], + ['/foo/bar/./.', true], + ['/foo/bar/././', true], + ['/foo/bar/././..bar', true], + ['/foo/bar/././..bar/a', true], + ['/foo/bar/././..', false], + ['/foo/bar/././../', false], + ['/foo/bar/.././', false], + ['/foo/bar/../../', false], + ['/foo/bar/../..\\', false], + ['..', false], + ['../', false], + ['../foo/bar', false], + ['..\foo/bar', false], + ]; } /** @@ -258,18 +258,18 @@ class FilesystemTest extends \Test\TestCase { } public function isFileBlacklistedData() { - return array( - array('/etc/foo/bar/foo.txt', false), - array('\etc\foo/bar\foo.txt', false), - array('.htaccess', true), - array('.htaccess/', true), - array('.htaccess\\', true), - array('/etc/foo\bar/.htaccess\\', true), - array('/etc/foo\bar/.htaccess/', true), - array('/etc/foo\bar/.htaccess/foo', false), - array('//foo//bar/\.htaccess/', true), - array('\foo\bar\.HTAccess', true), - ); + return [ + ['/etc/foo/bar/foo.txt', false], + ['\etc\foo/bar\foo.txt', false], + ['.htaccess', true], + ['.htaccess/', true], + ['.htaccess\\', true], + ['/etc/foo\bar/.htaccess\\', true], + ['/etc/foo\bar/.htaccess/', true], + ['/etc/foo\bar/.htaccess/foo', false], + ['//foo//bar/\.htaccess/', true], + ['\foo\bar\.HTAccess', true], + ]; } /** @@ -304,7 +304,7 @@ class FilesystemTest extends \Test\TestCase { \OC_Hook::clear('OC_Filesystem'); \OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook'); - \OC\Files\Filesystem::mount('OC\Files\Storage\Temporary', array(), '/'); + \OC\Files\Filesystem::mount('OC\Files\Storage\Temporary', [], '/'); $rootView = new \OC\Files\View(''); $rootView->mkdir('/' . $user); diff --git a/tests/lib/Files/Mount/ManagerTest.php b/tests/lib/Files/Mount/ManagerTest.php index f3cdc4264e4..1e80ec17ea1 100644 --- a/tests/lib/Files/Mount/ManagerTest.php +++ b/tests/lib/Files/Mount/ManagerTest.php @@ -30,39 +30,39 @@ class ManagerTest extends \Test\TestCase { public function testFind() { $this->assertNull($this->manager->find('/')); - $rootMount = new \OC\Files\Mount\MountPoint(new Temporary(array()), '/'); + $rootMount = new \OC\Files\Mount\MountPoint(new Temporary([]), '/'); $this->manager->addMount($rootMount); $this->assertEquals($rootMount, $this->manager->find('/')); $this->assertEquals($rootMount, $this->manager->find('/foo/bar')); - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount1 = new \OC\Files\Mount\MountPoint($storage, '/foo'); $this->manager->addMount($mount1); $this->assertEquals($rootMount, $this->manager->find('/')); $this->assertEquals($mount1, $this->manager->find('/foo/bar')); $this->assertEquals(1, count($this->manager->findIn('/'))); - $mount2 = new \OC\Files\Mount\MountPoint(new Temporary(array()), '/bar'); + $mount2 = new \OC\Files\Mount\MountPoint(new Temporary([]), '/bar'); $this->manager->addMount($mount2); $this->assertEquals(2, count($this->manager->findIn('/'))); $id = $mount1->getStorageId(); - $this->assertEquals(array($mount1), $this->manager->findByStorageId($id)); + $this->assertEquals([$mount1], $this->manager->findByStorageId($id)); $mount3 = new \OC\Files\Mount\MountPoint($storage, '/foo/bar'); $this->manager->addMount($mount3); - $this->assertEquals(array($mount1, $mount3), $this->manager->findByStorageId($id)); + $this->assertEquals([$mount1, $mount3], $this->manager->findByStorageId($id)); } public function testLong() { - $storage = new LongId(array()); + $storage = new LongId([]); $mount = new \OC\Files\Mount\MountPoint($storage, '/foo'); $this->manager->addMount($mount); $id = $mount->getStorageId(); $storageId = $storage->getId(); - $this->assertEquals(array($mount), $this->manager->findByStorageId($id)); - $this->assertEquals(array($mount), $this->manager->findByStorageId($storageId)); - $this->assertEquals(array($mount), $this->manager->findByStorageId(md5($storageId))); + $this->assertEquals([$mount], $this->manager->findByStorageId($id)); + $this->assertEquals([$mount], $this->manager->findByStorageId($storageId)); + $this->assertEquals([$mount], $this->manager->findByStorageId(md5($storageId))); } } diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php index 9b63c507b5f..800b360415a 100644 --- a/tests/lib/Files/Mount/MountPointTest.php +++ b/tests/lib/Files/Mount/MountPointTest.php @@ -21,12 +21,12 @@ class MountPointTest extends \Test\TestCase { $storage = $this->createMock(Storage::class); $storage->expects($this->once()) ->method('getId') - ->will($this->returnValue(123)); + ->willReturn(123); $loader = $this->createMock(StorageFactory::class); $loader->expects($this->once()) ->method('wrap') - ->will($this->returnValue($storage)); + ->willReturn($storage); $mountPoint = new \OC\Files\Mount\MountPoint( // just use this because a real class is needed diff --git a/tests/lib/Files/Mount/MountTest.php b/tests/lib/Files/Mount/MountTest.php index f21095f2fa5..160545e784c 100644 --- a/tests/lib/Files/Mount/MountTest.php +++ b/tests/lib/Files/Mount/MountTest.php @@ -31,7 +31,7 @@ class MountTest extends \Test\TestCase { $wrapper = function ($mountPoint, $storage) use (&$test) { $test->assertEquals('/foo/', $mountPoint); $test->assertInstanceOf('\OC\Files\Storage\Storage', $storage); - return new Wrapper(array('storage' => $storage)); + return new Wrapper(['storage' => $storage]); }; $loader = new StorageFactory(); @@ -40,7 +40,7 @@ class MountTest extends \Test\TestCase { $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary') ->disableOriginalConstructor() ->getMock(); - $mount = new \OC\Files\Mount\MountPoint($storage, '/foo', array(), $loader); + $mount = new \OC\Files\Mount\MountPoint($storage, '/foo', [], $loader); $this->assertInstanceOf('\OC\Files\Storage\Wrapper\Wrapper', $mount->getStorage()); } } diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php index 2cdf9cbdc5a..c6f468b796b 100644 --- a/tests/lib/Files/Node/FileTest.php +++ b/tests/lib/Files/Node/FileTest.php @@ -48,12 +48,12 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('file_get_contents') ->with('/bar/foo') - ->will($this->returnValue('bar')); + ->willReturn('bar'); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $this->assertEquals('bar', $node->getContent()); @@ -70,12 +70,12 @@ class FileTest extends NodeTest { $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => 0)))); + ->willReturn($this->getFileInfo(['permissions' => 0])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->getContent(); @@ -89,17 +89,17 @@ class FileTest extends NodeTest { $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $this->view->expects($this->once()) ->method('file_put_contents') ->with('/bar/foo', 'bar') - ->will($this->returnValue(true)); + ->willReturn(true); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->putContent('bar'); @@ -117,7 +117,7 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->putContent('bar'); @@ -132,7 +132,7 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('mimetype' => 'text/plain')))); + ->willReturn($this->getFileInfo(['mimetype' => 'text/plain'])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $this->assertEquals('text/plain', $node->getMimeType()); @@ -162,12 +162,12 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('fopen') ->with('/bar/foo', 'r') - ->will($this->returnValue($stream)); + ->willReturn($stream); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $fh = $node->fopen('r'); @@ -197,12 +197,12 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('fopen') ->with('/bar/foo', 'w') - ->will($this->returnValue($stream)); + ->willReturn($stream); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $fh = $node->fopen('w'); @@ -232,7 +232,7 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => 0)))); + ->willReturn($this->getFileInfo(['permissions' => 0])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->fopen('r'); @@ -257,7 +257,7 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_UPDATE)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_UPDATE])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->fopen('w'); @@ -282,7 +282,7 @@ class FileTest extends NodeTest { $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\File($root, $this->view, '/bar/foo'); $node->fopen('w'); diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index d33fb4f68f8..d2bbf65965a 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -19,7 +19,6 @@ use OC\Files\Node\Root; use OC\Files\Storage\Temporary; use OC\Files\Storage\Wrapper\Jail; use OC\Files\View; -use OC\User\User; use OCP\Files\Mount\IMountPoint; use OCP\Files\NotFoundException; use OCP\Files\Storage; @@ -59,15 +58,15 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $view->expects($this->any()) ->method('getDirectoryContent') ->with('/bar/foo') - ->will($this->returnValue(array( + ->willReturn([ new FileInfo('/bar/foo/asd', null, 'foo/asd', ['fileid' => 2, 'path' => '/bar/foo/asd', 'name' => 'asd', 'size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'], null), new FileInfo('/bar/foo/qwerty', null, 'foo/qwerty', ['fileid' => 3, 'path' => '/bar/foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'httpd/unix-directory'], null) - ))); + ]); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $children = $node->getDirectoryListing(); @@ -91,7 +90,7 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $root->expects($this->once()) ->method('get') @@ -112,14 +111,14 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd'); $root->expects($this->once()) ->method('get') ->with('/bar/foo/asd') - ->will($this->returnValue($child)); + ->willReturn($child); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $this->assertTrue($node->nodeExists('asd')); @@ -136,7 +135,7 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $root->expects($this->once()) ->method('get') @@ -158,17 +157,17 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $view->expects($this->once()) ->method('mkdir') ->with('/bar/foo/asd') - ->will($this->returnValue(true)); + ->willReturn(true); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $child = new \OC\Files\Node\Folder($root, $view, '/bar/foo/asd'); @@ -190,12 +189,12 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $node->newFolder('asd'); @@ -212,17 +211,17 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $view->expects($this->once()) ->method('touch') ->with('/bar/foo/asd') - ->will($this->returnValue(true)); + ->willReturn(true); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $child = new \OC\Files\Node\File($root, $view, '/bar/foo/asd'); @@ -244,12 +243,12 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $node->newFile('asd'); @@ -266,12 +265,12 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $view->expects($this->once()) ->method('free_space') ->with('/bar/foo') - ->will($this->returnValue(100)); + ->willReturn(100); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $this->assertEquals(100, $node->getFreeSpace()); @@ -288,39 +287,39 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $storage = $this->createMock(Storage::class); $storage->method('getId')->willReturn(''); $cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock(); $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $mount = $this->createMock(IMountPoint::class); $mount->expects($this->once()) ->method('getStorage') - ->will($this->returnValue($storage)); + ->willReturn($storage); $mount->expects($this->once()) ->method('getInternalPath') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->will($this->returnValue(array( - array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - ))); + ->willReturn([ + ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->will($this->returnValue(array())); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') ->with('/bar/foo') - ->will($this->returnValue($mount)); + ->willReturn($mount); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $result = $node->search('qw'); @@ -340,7 +339,7 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); /** @var \PHPUnit_Framework_MockObject_MockObject|Storage $storage */ $storage = $this->createMock(Storage::class); $storage->method('getId')->willReturn(''); @@ -349,32 +348,32 @@ class FolderTest extends NodeTest { $mount = $this->createMock(IMountPoint::class); $mount->expects($this->once()) ->method('getStorage') - ->will($this->returnValue($storage)); + ->willReturn($storage); $mount->expects($this->once()) ->method('getInternalPath') - ->will($this->returnValue('files')); + ->willReturn('files'); $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->will($this->returnValue(array( - array('fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'), - array('fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'), - ))); + ->willReturn([ + ['fileid' => 3, 'path' => 'files/foo', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'], + ['fileid' => 3, 'path' => 'files_trashbin/foo2.d12345', 'name' => 'foo2.d12345', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'], + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('') - ->will($this->returnValue(array())); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') ->with('') - ->will($this->returnValue($mount)); + ->willReturn($mount); $result = $root->search('qw'); $this->assertEquals(1, count($result)); @@ -392,7 +391,7 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $storage = $this->createMock(Storage::class); $storage->method('getId')->willReturn(''); $cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock(); @@ -400,31 +399,31 @@ class FolderTest extends NodeTest { $mount = $this->createMock(IMountPoint::class); $mount->expects($this->once()) ->method('getStorage') - ->will($this->returnValue($storage)); + ->willReturn($storage); $mount->expects($this->once()) ->method('getInternalPath') - ->will($this->returnValue('')); + ->willReturn(''); $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->will($this->returnValue(array( - array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - ))); + ->willReturn([ + ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar') - ->will($this->returnValue(array())); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') ->with('/bar') - ->will($this->returnValue($mount)); + ->willReturn($mount); $node = new \OC\Files\Node\Folder($root, $view, '/bar'); $result = $node->search('qw'); @@ -443,7 +442,7 @@ class FolderTest extends NodeTest { ->getMock(); $root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $storage = $this->createMock(Storage::class); $storage->method('getId')->willReturn(''); $cache = $this->getMockBuilder(Cache::class)->setConstructorArgs([$storage])->getMock(); @@ -454,50 +453,50 @@ class FolderTest extends NodeTest { $mount = $this->createMock(IMountPoint::class); $mount->expects($this->once()) ->method('getStorage') - ->will($this->returnValue($storage)); + ->willReturn($storage); $mount->expects($this->once()) ->method('getInternalPath') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $subMount->expects($this->once()) ->method('getStorage') - ->will($this->returnValue($subStorage)); + ->willReturn($subStorage); $subMount->expects($this->once()) ->method('getMountPoint') - ->will($this->returnValue('/bar/foo/bar/')); + ->willReturn('/bar/foo/bar/'); $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $subStorage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($subCache)); + ->willReturn($subCache); $cache->expects($this->once()) ->method('search') ->with('%qw%') - ->will($this->returnValue(array( - array('fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - ))); + ->willReturn([ + ['fileid' => 3, 'path' => 'foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $subCache->expects($this->once()) ->method('search') ->with('%qw%') - ->will($this->returnValue(array( - array('fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain') - ))); + ->willReturn([ + ['fileid' => 4, 'path' => 'asd/qweasd', 'name' => 'qweasd', 'size' => 200, 'mtime' => 55, 'mimetype' => 'text/plain'] + ]); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->will($this->returnValue(array($subMount))); + ->willReturn([$subMount]); $root->expects($this->once()) ->method('getMount') ->with('/bar/foo') - ->will($this->returnValue($mount)); + ->willReturn($mount); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); @@ -534,34 +533,34 @@ class FolderTest extends NodeTest { $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $this->userMountCache->expects($this->any()) ->method('getMountsForFileId') ->with(1) - ->will($this->returnValue([new CachedMountInfo( + ->willReturn([new CachedMountInfo( $this->user, 1, 0, '/bar/', 1, '' - )])); + )]); $cache->expects($this->once()) ->method('get') ->with(1) - ->will($this->returnValue($fileInfo)); + ->willReturn($fileInfo); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->will($this->returnValue(array())); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') ->with('/bar/foo') - ->will($this->returnValue($mount)); + ->willReturn($mount); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $result = $node->getById(1); @@ -588,29 +587,29 @@ class FolderTest extends NodeTest { $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $this->userMountCache->expects($this->any()) ->method('getMountsForFileId') ->with(1) - ->will($this->returnValue([new CachedMountInfo( + ->willReturn([new CachedMountInfo( $this->user, 1, 0, '/bar/', 1, '' - )])); + )]); $cache->expects($this->once()) ->method('get') ->with(1) - ->will($this->returnValue($fileInfo)); + ->willReturn($fileInfo); $root->expects($this->once()) ->method('getMount') ->with('/bar') - ->will($this->returnValue($mount)); + ->willReturn($mount); $node = new \OC\Files\Node\Folder($root, $view, '/bar'); $result = $node->getById(1); @@ -637,34 +636,34 @@ class FolderTest extends NodeTest { $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $this->userMountCache->expects($this->any()) ->method('getMountsForFileId') ->with(1) - ->will($this->returnValue([new CachedMountInfo( + ->willReturn([new CachedMountInfo( $this->user, 1, 0, '/bar/', 1, '' - )])); + )]); $cache->expects($this->once()) ->method('get') ->with(1) - ->will($this->returnValue($fileInfo)); + ->willReturn($fileInfo); $root->expects($this->once()) ->method('getMountsIn') ->with('/bar/foo') - ->will($this->returnValue(array())); + ->willReturn([]); $root->expects($this->once()) ->method('getMount') ->with('/bar/foo') - ->will($this->returnValue($mount)); + ->willReturn($mount); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $result = $node->getById(1); @@ -691,12 +690,12 @@ class FolderTest extends NodeTest { $storage->expects($this->exactly(2)) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $this->userMountCache->expects($this->any()) ->method('getMountsForFileId') ->with(1) - ->will($this->returnValue([ + ->willReturn([ new CachedMountInfo( $this->user, 1, @@ -713,26 +712,26 @@ class FolderTest extends NodeTest { 1, '' ) - ])); + ]); $storage->expects($this->any()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $cache->expects($this->any()) ->method('get') ->with(1) - ->will($this->returnValue($fileInfo)); + ->willReturn($fileInfo); $root->expects($this->any()) ->method('getMountsIn') ->with('/bar/foo') - ->will($this->returnValue(array($mount2))); + ->willReturn([$mount2]); $root->expects($this->once()) ->method('getMount') ->with('/bar/foo') - ->will($this->returnValue($mount1)); + ->willReturn($mount1); $node = new \OC\Files\Node\Folder($root, $view, '/bar/foo'); $result = $node->getById(1); @@ -767,14 +766,14 @@ class FolderTest extends NodeTest { $view->expects($this->any()) ->method('file_exists') - ->will($this->returnCallback(function ($path) use ($existingFiles, $folderPath) { + ->willReturnCallback(function ($path) use ($existingFiles, $folderPath) { foreach ($existingFiles as $existing) { if ($folderPath . '/' . $existing === $path) { return true; } } return false; - })); + }); $node = new \OC\Files\Node\Folder($root, $view, $folderPath); $this->assertEquals($expected, $node->getNonExistingName($name)); @@ -802,7 +801,7 @@ class FolderTest extends NodeTest { $folderInfo->expects($this->any()) ->method('getMountPoint') - ->will($this->returnValue($mount)); + ->willReturn($mount); $cache = $storage->getCache(); @@ -866,7 +865,7 @@ class FolderTest extends NodeTest { $folderInfo->expects($this->any()) ->method('getMountPoint') - ->will($this->returnValue($mount)); + ->willReturn($mount); $cache = $storage->getCache(); @@ -932,7 +931,7 @@ class FolderTest extends NodeTest { $folderInfo->expects($this->any()) ->method('getMountPoint') - ->will($this->returnValue($mount)); + ->willReturn($mount); $cache = $storage->getCache(); diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php index 2a542a1097a..26cdf398d94 100644 --- a/tests/lib/Files/Node/IntegrationTest.php +++ b/tests/lib/Files/Node/IntegrationTest.php @@ -57,8 +57,8 @@ class IntegrationTest extends \Test\TestCase { $this->createMock(ILogger::class), $this->createMock(IUserManager::class) ); - $storage = new Temporary(array()); - $subStorage = new Temporary(array()); + $storage = new Temporary([]); + $subStorage = new Temporary([]); $this->storages[] = $storage; $this->storages[] = $subStorage; $this->root->mount($storage, '/'); diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php index 7c8ddee6b5f..adcf43956be 100644 --- a/tests/lib/Files/Node/NodeTest.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -11,14 +11,11 @@ namespace Test\Files\Node; use OC\Files\FileInfo; use OC\Files\Mount\Manager; use OC\Files\View; -use OCP\Files\Config\IUserMountCache; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\Storage; -use OCP\IConfig; use OCP\ILogger; -use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; @@ -92,7 +89,7 @@ abstract class NodeTest extends \Test\TestCase { ->getMock(); $storage->expects($this->any()) ->method('getId') - ->will($this->returnValue('home::someuser')); + ->willReturn('home::someuser'); return $storage; } @@ -103,20 +100,20 @@ abstract class NodeTest extends \Test\TestCase { public function testDelete() { $this->root->expects($this->exactly(2)) ->method('emit') - ->will($this->returnValue(true)); + ->willReturn(true); $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $this->view->expects($this->once()) ->method($this->getViewDeleteMethod()) ->with('/bar/foo') - ->will($this->returnValue(true)); + ->willReturn(true); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $node->delete(); @@ -163,17 +160,17 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain']))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1, 'mimetype' => 'text/plain'])); $this->view->expects($this->once()) ->method($this->getViewDeleteMethod()) ->with('/bar/foo') - ->will($this->returnValue(true)); + ->willReturn(true); $this->view->expects($this->any()) ->method('resolvePath') ->with('/bar/foo') - ->will($this->returnValue([null, 'foo'])); + ->willReturn([null, 'foo']); $node = $this->createTestNode($root, $this->view, '/bar/foo'); $node->delete(); @@ -186,12 +183,12 @@ abstract class NodeTest extends \Test\TestCase { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $node->delete(); @@ -201,20 +198,20 @@ abstract class NodeTest extends \Test\TestCase { public function testStat() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); - $stat = array( + $stat = [ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50, 'permissions' => 0 - ); + ]; $this->view->expects($this->once()) ->method('stat') ->with('/bar/foo') - ->will($this->returnValue($stat)); + ->willReturn($stat); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $this->assertEquals($stat, $node->stat()); @@ -223,19 +220,19 @@ abstract class NodeTest extends \Test\TestCase { public function testGetId() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($stat)); + ->willReturn($stat); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $this->assertEquals(1, $node->getId()); @@ -244,20 +241,20 @@ abstract class NodeTest extends \Test\TestCase { public function testGetSize() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($stat)); + ->willReturn($stat); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $this->assertEquals(100, $node->getSize()); @@ -266,19 +263,19 @@ abstract class NodeTest extends \Test\TestCase { public function testGetEtag() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($stat)); + ->willReturn($stat); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $this->assertEquals('qwerty', $node->getEtag()); @@ -287,19 +284,19 @@ abstract class NodeTest extends \Test\TestCase { public function testGetMTime() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); - $stat = $this->getFileInfo(array( + $stat = $this->getFileInfo([ 'fileid' => 1, 'size' => 100, 'etag' => 'qwerty', 'mtime' => 50 - )); + ]); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($stat)); + ->willReturn($stat); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $this->assertEquals(50, $node->getMTime()); @@ -308,7 +305,7 @@ abstract class NodeTest extends \Test\TestCase { public function testGetStorage() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); /** * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage */ @@ -319,7 +316,7 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->once()) ->method('resolvePath') ->with('/bar/foo') - ->will($this->returnValue(array($storage, 'foo'))); + ->willReturn([$storage, 'foo']); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); @@ -329,7 +326,7 @@ abstract class NodeTest extends \Test\TestCase { public function testGetPath() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $this->assertEquals('/bar/foo', $node->getPath()); @@ -338,7 +335,7 @@ abstract class NodeTest extends \Test\TestCase { public function testGetInternalPath() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); /** * @var \OC\Files\Storage\Storage | \PHPUnit_Framework_MockObject_MockObject $storage */ @@ -349,7 +346,7 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->once()) ->method('resolvePath') ->with('/bar/foo') - ->will($this->returnValue(array($storage, 'foo'))); + ->willReturn([$storage, 'foo']); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); @@ -359,7 +356,7 @@ abstract class NodeTest extends \Test\TestCase { public function testGetName() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $this->assertEquals('foo', $node->getName()); @@ -368,17 +365,17 @@ abstract class NodeTest extends \Test\TestCase { public function testTouchSetMTime() { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->view->expects($this->once()) ->method('touch') ->with('/bar/foo', 100) - ->will($this->returnValue(true)); + ->willReturn(true); $this->view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $node->touch(100); @@ -420,17 +417,17 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->once()) ->method('touch') ->with('/bar/foo', 100) - ->will($this->returnValue(true)); + ->willReturn(true); $this->view->expects($this->any()) ->method('resolvePath') ->with('/bar/foo') - ->will($this->returnValue(array(null, 'foo'))); + ->willReturn([null, 'foo']); $this->view->expects($this->any()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_ALL)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL])); $node = $this->createTestNode($root, $this->view, '/bar/foo'); $node->touch(100); @@ -443,12 +440,12 @@ abstract class NodeTest extends \Test\TestCase { $this->root->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->view->expects($this->any()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('permissions' => \OCP\Constants::PERMISSION_READ)))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $node->touch(100); @@ -466,11 +463,11 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method('copy') ->with('/bar/foo', '/bar/asd') - ->will($this->returnValue(true)); + ->willReturn(true); $this->view->expects($this->any()) ->method('getFileInfo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 3])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar'); @@ -478,10 +475,10 @@ abstract class NodeTest extends \Test\TestCase { $this->root->expects($this->exactly(2)) ->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ ['/bar/asd', $newNode], ['/bar', $parentNode] - ])); + ]); $target = $node->copy('/bar/asd'); $this->assertInstanceOf($this->getNodeClass(), $target); @@ -505,16 +502,16 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method('getFileInfo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ, 'fileid' => 3])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar'); $this->root->expects($this->once()) ->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ ['/bar', $parentNode] - ])); + ]); $node->copy('/bar/asd'); } @@ -548,9 +545,9 @@ abstract class NodeTest extends \Test\TestCase { $this->root->expects($this->once()) ->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ ['/bar', $parentNode] - ])); + ]); $node->copy('/bar/asd'); } @@ -559,18 +556,18 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method('rename') ->with('/bar/foo', '/bar/asd') - ->will($this->returnValue(true)); + ->willReturn(true); $this->view->expects($this->any()) ->method('getFileInfo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar'); $this->root->expects($this->any()) ->method('get') - ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]])); + ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]); $target = $node->move('/bar/asd'); $this->assertInstanceOf($this->getNodeClass(), $target); @@ -602,11 +599,11 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method($viewMethod) ->with('/bar/foo', '/bar/asd') - ->will($this->returnValue(true)); + ->willReturn(true); $this->view->expects($this->any()) ->method('getFileInfo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])); /** * @var \OC\Files\Node\File|\PHPUnit_Framework_MockObject_MockObject $node @@ -617,7 +614,7 @@ abstract class NodeTest extends \Test\TestCase { $root->expects($this->any()) ->method('get') - ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]])); + ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $targetTestNode]]); $hooksRun = 0; @@ -665,7 +662,7 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method('getFileInfo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_READ])); $this->view->expects($this->never()) ->method('rename'); @@ -676,7 +673,7 @@ abstract class NodeTest extends \Test\TestCase { $this->root->expects($this->once()) ->method('get') ->with('/bar') - ->will($this->returnValue($parentNode)); + ->willReturn($parentNode); $node->move('/bar/asd'); } @@ -716,7 +713,7 @@ abstract class NodeTest extends \Test\TestCase { $this->root->expects($this->once()) ->method('get') ->with('/bar') - ->will($this->returnValue($parentNode)); + ->willReturn($parentNode); $node->move('/bar/asd'); } @@ -728,18 +725,18 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method('rename') ->with('/bar/foo', '/bar/asd') - ->will($this->returnValue(false)); + ->willReturn(false); $this->view->expects($this->any()) ->method('getFileInfo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar'); $this->root->expects($this->any()) ->method('get') - ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]])); + ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]); $node->move('/bar/asd'); } @@ -751,18 +748,18 @@ abstract class NodeTest extends \Test\TestCase { $this->view->expects($this->any()) ->method('copy') ->with('/bar/foo', '/bar/asd') - ->will($this->returnValue(false)); + ->willReturn(false); $this->view->expects($this->any()) ->method('getFileInfo') - ->will($this->returnValue($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1]))); + ->willReturn($this->getFileInfo(['permissions' => \OCP\Constants::PERMISSION_ALL, 'fileid' => 1])); $node = $this->createTestNode($this->root, $this->view, '/bar/foo'); $parentNode = new \OC\Files\Node\Folder($this->root, $this->view, '/bar'); $this->root->expects($this->any()) ->method('get') - ->will($this->returnValueMap([['/bar', $parentNode], ['/bar/asd', $node]])); + ->willReturnMap([['/bar', $parentNode], ['/bar/asd', $node]]); $node->copy('/bar/asd'); } diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php index 5067236ec58..6c006d1cf62 100644 --- a/tests/lib/Files/Node/RootTest.php +++ b/tests/lib/Files/Node/RootTest.php @@ -13,9 +13,7 @@ use OC\Files\FileInfo; use OC\Files\Mount\Manager; use OC\Files\Node\Folder; use OC\Files\View; -use OCP\IConfig; use OCP\ILogger; -use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; @@ -79,7 +77,7 @@ class RootTest extends \Test\TestCase { $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue($this->getFileInfo(array('fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain')))); + ->willReturn($this->getFileInfo(['fileid' => 10, 'path' => 'bar/foo', 'name', 'mimetype' => 'text/plain'])); $root->mount($storage, ''); $node = $root->get('/bar/foo'); @@ -115,7 +113,7 @@ class RootTest extends \Test\TestCase { $view->expects($this->once()) ->method('getFileInfo') ->with('/bar/foo') - ->will($this->returnValue(false)); + ->willReturn(false); $root->mount($storage, ''); $root->get('/bar/foo'); diff --git a/tests/lib/Files/ObjectStore/NoopScannerTest.php b/tests/lib/Files/ObjectStore/NoopScannerTest.php index 8b879e8ab37..570fc16ee98 100644 --- a/tests/lib/Files/ObjectStore/NoopScannerTest.php +++ b/tests/lib/Files/ObjectStore/NoopScannerTest.php @@ -22,7 +22,7 @@ class NoopScannerTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary(array()); + $this->storage = new \OC\Files\Storage\Temporary([]); $this->scanner = new \OC\Files\ObjectStore\NoopScanner($this->storage); } diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php index b8c7b15e039..25ce5525361 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php @@ -20,7 +20,6 @@ namespace Test\Files\ObjectStore; -use OC\Files\ObjectStore\ObjectStoreStorage; use OC\Files\ObjectStore\StorageObjectStore; use OC\Files\Storage\Temporary; use OCP\Files\ObjectStore\IObjectStore; diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php index 91b24d8b615..b56978f4fee 100644 --- a/tests/lib/Files/ObjectStore/S3Test.php +++ b/tests/lib/Files/ObjectStore/S3Test.php @@ -34,11 +34,11 @@ class MultiPartUploadS3 extends S3 { class NonSeekableStream extends Wrapper { public static function wrap($source) { - $context = stream_context_create(array( - 'nonseek' => array( + $context = stream_context_create([ + 'nonseek' => [ 'source' => $source - ) - )); + ] + ]); return Wrapper::wrapSource($source, $context, 'nonseek', self::class); } diff --git a/tests/lib/Files/SimpleFS/SimpleFileTest.php b/tests/lib/Files/SimpleFS/SimpleFileTest.php index 07a7e79c7a3..8de5cf50aa3 100644 --- a/tests/lib/Files/SimpleFS/SimpleFileTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFileTest.php @@ -27,7 +27,6 @@ use OC\Files\SimpleFS\SimpleFile; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\NotFoundException; -use OCP\Files\NotPermittedException; class SimpleFileTest extends \Test\TestCase { /** @var File|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/tests/lib/Files/SimpleFS/SimpleFolderTest.php b/tests/lib/Files/SimpleFS/SimpleFolderTest.php index b902cac77cc..4cab1136d82 100644 --- a/tests/lib/Files/SimpleFS/SimpleFolderTest.php +++ b/tests/lib/Files/SimpleFS/SimpleFolderTest.php @@ -25,10 +25,7 @@ namespace Test\File\SimpleFS; use OC\Files\SimpleFS\SimpleFolder; use OC\Files\Storage\Temporary; -use OC\Files\View; -use OCP\Files\File; use OCP\Files\Folder; -use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFile; use Test\Traits\MountProviderTrait; diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php index 6075e9af293..d5feb40840f 100644 --- a/tests/lib/Files/Storage/HomeTest.php +++ b/tests/lib/Files/Storage/HomeTest.php @@ -73,7 +73,7 @@ class HomeTest extends Storage { $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->userId = $this->getUniqueID('user_'); $this->user = new DummyUser($this->userId, $this->tmpDir); - $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user)); + $this->instance = new \OC\Files\Storage\Home(['user' => $this->user]); } protected function tearDown(): void { diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index 23738a25c2a..46784811248 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -39,7 +39,7 @@ class LocalTest extends Storage { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); - $this->instance = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); + $this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); } protected function tearDown(): void { diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php index a25a3f74f9e..736cbfff4f0 100644 --- a/tests/lib/Files/Storage/Storage.php +++ b/tests/lib/Files/Storage/Storage.php @@ -80,13 +80,13 @@ abstract class Storage extends \Test\TestCase { $this->assertTrue($this->instance->isUpdatable('/' . $directory)); $dh = $this->instance->opendir('/'); - $content = array(); + $content = []; while ($file = readdir($dh)) { if ($file != '.' and $file != '..') { $content[] = $file; } } - $this->assertEquals(array($directory), $content); + $this->assertEquals([$directory], $content); $this->assertFalse($this->instance->mkdir('/' . $directory)); //can't create existing folders $this->assertTrue($this->instance->rmdir('/' . $directory)); @@ -97,13 +97,13 @@ abstract class Storage extends \Test\TestCase { $this->assertFalse($this->instance->rmdir('/' . $directory)); //can't remove non existing folders $dh = $this->instance->opendir('/'); - $content = array(); + $content = []; while ($file = readdir($dh)) { if ($file != '.' and $file != '..') { $content[] = $file; } } - $this->assertEquals(array(), $content); + $this->assertEquals([], $content); } public function fileNameProvider() { @@ -130,12 +130,12 @@ abstract class Storage extends \Test\TestCase { function loremFileProvider() { $root = \OC::$SERVERROOT . '/tests/data/'; - return array( + return [ // small file - array($root . 'lorem.txt'), + [$root . 'lorem.txt'], // bigger file (> 8 KB which is the standard PHP block size) - array($root . 'lorem-big.txt') - ); + [$root . 'lorem-big.txt'] + ]; } /** @@ -413,11 +413,11 @@ abstract class Storage extends \Test\TestCase { } public function hashProvider() { - return array( - array('Foobar', 'md5'), - array('Foobar', 'sha1'), - array('Foobar', 'sha256'), - ); + return [ + ['Foobar', 'md5'], + ['Foobar', 'sha1'], + ['Foobar', 'sha256'], + ]; } /** @@ -438,14 +438,14 @@ abstract class Storage extends \Test\TestCase { $this->assertEquals('data', $this->instance->file_get_contents('#foo/test.txt')); $dh = $this->instance->opendir('#foo'); - $content = array(); + $content = []; while ($file = readdir($dh)) { if ($file != '.' and $file != '..') { $content[] = $file; } } - $this->assertEquals(array('test.txt'), $content); + $this->assertEquals(['test.txt'], $content); } public function testCopyOverWriteFile() { diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index a9d678e76e9..ac3880309c0 100644 --- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -148,7 +148,7 @@ class EncryptionTest extends Storage { $this->logger = $this->createMock(Log::class); - $this->sourceStorage = new Temporary(array()); + $this->sourceStorage = new Temporary([]); $this->keyStore = $this->getMockBuilder('\OC\Encryption\Keys\Storage') ->disableOriginalConstructor()->getMock(); @@ -458,13 +458,13 @@ class EncryptionTest extends Storage { * @return array */ public function dataTestCopyAndRename() { - return array( - array('source', 'target', true, false, false), - array('source', 'target', true, true, false), - array('source', '/subFolder/target', true, false, false), - array('source', '/subFolder/target', true, true, true), - array('source', '/subFolder/target', false, true, false), - ); + return [ + ['source', 'target', true, false, false], + ['source', 'target', true, true, false], + ['source', '/subFolder/target', true, false, false], + ['source', '/subFolder/target', true, true, true], + ['source', '/subFolder/target', false, true, false], + ]; } public function testIsLocal() { @@ -512,16 +512,16 @@ class EncryptionTest extends Storage { } public function dataTestRmdir() { - return array( - array('/file.txt', true, true, true), - array('/file.txt', false, true, true), - array('/file.txt', true, false, true), - array('/file.txt', false, false, true), - array('/file.txt', true, true, false), - array('/file.txt', false, true, false), - array('/file.txt', true, false, false), - array('/file.txt', false, false, false), - ); + return [ + ['/file.txt', true, true, true], + ['/file.txt', false, true, true], + ['/file.txt', true, false, true], + ['/file.txt', false, false, true], + ['/file.txt', true, true, false], + ['/file.txt', false, true, false], + ['/file.txt', true, false, false], + ['/file.txt', false, false, false], + ]; } /** @@ -547,10 +547,10 @@ class EncryptionTest extends Storage { } public function dataTestCopyKeys() { - return array( - array(true, false), - array(false, true), - ); + return [ + [true, false], + [false, true], + ]; } /** @@ -613,13 +613,13 @@ class EncryptionTest extends Storage { } public function dataTestGetHeader() { - return array( - array('/foo/bar.txt', false, '/foo/bar.txt'), - array('/foo/bar.txt.part', false, '/foo/bar.txt'), - array('/foo/bar.txt.ocTransferId7437493.part', false, '/foo/bar.txt'), - array('/foo/bar.txt.part', true, '/foo/bar.txt'), - array('/foo/bar.txt.ocTransferId7437493.part', true, '/foo/bar.txt'), - ); + return [ + ['/foo/bar.txt', false, '/foo/bar.txt'], + ['/foo/bar.txt.part', false, '/foo/bar.txt'], + ['/foo/bar.txt.ocTransferId7437493.part', false, '/foo/bar.txt'], + ['/foo/bar.txt.part', true, '/foo/bar.txt'], + ['/foo/bar.txt.ocTransferId7437493.part', true, '/foo/bar.txt'], + ]; } /** diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php index cb7003cb7ea..6c8905af765 100644 --- a/tests/lib/Files/Storage/Wrapper/JailTest.php +++ b/tests/lib/Files/Storage/Wrapper/JailTest.php @@ -17,24 +17,24 @@ class JailTest extends \Test\Files\Storage\Storage { protected function setUp(): void { parent::setUp(); - $this->sourceStorage = new \OC\Files\Storage\Temporary(array()); + $this->sourceStorage = new \OC\Files\Storage\Temporary([]); $this->sourceStorage->mkdir('foo'); - $this->instance = new \OC\Files\Storage\Wrapper\Jail(array( + $this->instance = new \OC\Files\Storage\Wrapper\Jail([ 'storage' => $this->sourceStorage, 'root' => 'foo' - )); + ]); } protected function tearDown(): void { // test that nothing outside our jail is touched - $contents = array(); + $contents = []; $dh = $this->sourceStorage->opendir(''); while ($file = readdir($dh)) { if (!\OC\Files\Filesystem::isIgnoredDir($file)) { $contents[] = $file; } } - $this->assertEquals(array('foo'), $contents); + $this->assertEquals(['foo'], $contents); $this->sourceStorage->cleanUp(); parent::tearDown(); } diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php index bfdd3d3ddbb..1e69ee7165e 100644 --- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php +++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php @@ -24,7 +24,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { protected function setUp(): void { parent::setUp(); - $this->sourceStorage = new \OC\Files\Storage\Temporary(array()); + $this->sourceStorage = new \OC\Files\Storage\Temporary([]); $this->instance = $this->getMaskedStorage(Constants::PERMISSION_ALL); } @@ -34,10 +34,10 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { } protected function getMaskedStorage($mask) { - return new \OC\Files\Storage\Wrapper\PermissionsMask(array( + return new \OC\Files\Storage\Wrapper\PermissionsMask([ 'storage' => $this->sourceStorage, 'mask' => $mask - )); + ]); } public function testMkdirNoCreate() { @@ -129,10 +129,10 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage { public function testScanNewFilesNested() { $storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE + Constants::PERMISSION_UPDATE); - $nestedStorage = new \OC\Files\Storage\Wrapper\PermissionsMask(array( + $nestedStorage = new \OC\Files\Storage\Wrapper\PermissionsMask([ 'storage' => $storage, 'mask' => Constants::PERMISSION_READ + Constants::PERMISSION_CREATE - )); + ]); $wrappedStorage = new Wrapper(['storage' => $nestedStorage]); $wrappedStorage->file_put_contents('foo', 'bar'); $wrappedStorage->getScanner()->scan(''); diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index 0061ca3910e..65cfe30eb1c 100644 --- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -31,8 +31,8 @@ class QuotaTest extends \Test\Files\Storage\Storage { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); - $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); - $this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000)); + $storage = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); + $this->instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => 10000000]); } protected function tearDown(): void { @@ -44,10 +44,10 @@ class QuotaTest extends \Test\Files\Storage\Storage { * @param integer $limit */ protected function getLimitedStorage($limit) { - $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); + $storage = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); $storage->mkdir('files'); $storage->getScanner()->scan(''); - return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $limit)); + return new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => $limit]); } public function testFilePutContentsNotEnoughSpace() { @@ -70,7 +70,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { public function testFreeSpaceWithUsedSpace() { $instance = $this->getLimitedStorage(9); $instance->getCache()->put( - '', array('size' => 3) + '', ['size' => 3] ); $this->assertEquals(6, $instance->free_space('')); } @@ -82,12 +82,12 @@ class QuotaTest extends \Test\Files\Storage\Storage { ->getMock(); $storage->expects($this->any()) ->method('free_space') - ->will($this->returnValue(-2)); + ->willReturn(-2); $storage->getScanner()->scan(''); - $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9)); + $instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => 9]); $instance->getCache()->put( - '', array('size' => 3) + '', ['size' => 3] ); $this->assertEquals(6, $instance->free_space('')); } @@ -95,7 +95,7 @@ class QuotaTest extends \Test\Files\Storage\Storage { public function testFreeSpaceWithUsedSpaceAndEncryption() { $instance = $this->getLimitedStorage(9); $instance->getCache()->put( - '', array('size' => 7) + '', ['size' => 7] ); $this->assertEquals(2, $instance->free_space('')); } @@ -138,9 +138,9 @@ class QuotaTest extends \Test\Files\Storage\Storage { ->getMock(); $failStorage->expects($this->any()) ->method('fopen') - ->will($this->returnValue(false)); + ->willReturn(false); - $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $failStorage, 'quota' => 1000)); + $instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $failStorage, 'quota' => 1000]); $this->assertFalse($instance->fopen('failedfopen', 'r')); } @@ -189,16 +189,16 @@ class QuotaTest extends \Test\Files\Storage\Storage { $cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock(); $storage->expects($this->once()) ->method('getCache') - ->will($this->returnValue($cache)); + ->willReturn($cache); $storage->expects($this->once()) ->method('free_space') - ->will($this->returnValue(2048)); + ->willReturn(2048); $cache->expects($this->once()) ->method('get') ->with('files') - ->will($this->returnValue(new CacheEntry(['size' => 50]))); + ->willReturn(new CacheEntry(['size' => 50])); - $instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 1024, 'root' => 'files')); + $instance = new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => 1024, 'root' => 'files']); $this->assertEquals(1024 - 50, $instance->free_space('')); } diff --git a/tests/lib/Files/Storage/Wrapper/WrapperTest.php b/tests/lib/Files/Storage/Wrapper/WrapperTest.php index 2477b361bc1..b9bb54e09b2 100644 --- a/tests/lib/Files/Storage/Wrapper/WrapperTest.php +++ b/tests/lib/Files/Storage/Wrapper/WrapperTest.php @@ -18,8 +18,8 @@ class WrapperTest extends \Test\Files\Storage\Storage { parent::setUp(); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); - $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir)); - $this->instance = new \OC\Files\Storage\Wrapper\Wrapper(array('storage' => $storage)); + $storage = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir]); + $this->instance = new \OC\Files\Storage\Wrapper\Wrapper(['storage' => $storage]); } protected function tearDown(): void { diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php index fd5e8c6ca9d..43114ff70f3 100644 --- a/tests/lib/Files/Stream/EncryptionTest.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -99,10 +99,10 @@ class EncryptionTest extends \Test\TestCase { $fileMock->expects($this->never())->method('getAccessList'); } else { $fileMock->expects($this->once())->method('getAccessList') - ->will($this->returnCallback(function ($sharePath) use ($expectedSharePath) { + ->willReturnCallback(function ($sharePath) use ($expectedSharePath) { $this->assertSame($expectedSharePath, $sharePath); - return array(); - })); + return []; + }); } $utilMock = $this->getMockBuilder('\OC\Encryption\Util') ->disableOriginalConstructor()->getMock(); @@ -138,7 +138,7 @@ class EncryptionTest extends \Test\TestCase { $fullPathP->setAccessible(false); $header = $stream->getProperty('header'); $header->setAccessible(true); - $header->setValue($streamWrapper, array()); + $header->setValue($streamWrapper, []); $header->setAccessible(false); $this->invokePrivate($streamWrapper, 'signed', [true]); @@ -205,9 +205,9 @@ class EncryptionTest extends \Test\TestCase { $fileName = tempnam("/tmp", "FOO"); $stream = $this->getStream($fileName, 'w+', 0); $this->assertEquals(6, fwrite($stream, 'foobar')); - $this->assertEquals(TRUE, rewind($stream)); + $this->assertEquals(true, rewind($stream)); $this->assertEquals('foobar', fread($stream, 100)); - $this->assertEquals(TRUE, rewind($stream)); + $this->assertEquals(true, rewind($stream)); $this->assertEquals(3, fwrite($stream, 'bar')); fclose($stream); diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 01f11bf39c8..3befe64c825 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -240,14 +240,14 @@ class DetectionTest extends \Test\TestCase { [$this->equalTo('core'), $this->equalTo('filetypes/my-type.png')], [$this->equalTo('core'), $this->equalTo('filetypes/my.png')] ) - ->will($this->returnCallback( + ->willReturnCallback( function($appName, $file) { if ($file === 'filetypes/my.png') { return 'my.svg'; } throw new \RuntimeException(); } - )); + ); $detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url()); $mimeType = $detection->mimeTypeIcon('my-type'); @@ -271,14 +271,14 @@ class DetectionTest extends \Test\TestCase { [$this->equalTo('core'), $this->equalTo('filetypes/foo.png')], [$this->equalTo('core'), $this->equalTo('filetypes/file.png')] ) - ->will($this->returnCallback( + ->willReturnCallback( function($appName, $file) { if ($file === 'filetypes/file.png') { return 'file.svg'; } throw new \RuntimeException(); } - )); + ); $detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url()); $mimeType = $detection->mimeTypeIcon('foo-bar'); diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php index 44422cd97d1..c5183ac3929 100644 --- a/tests/lib/Files/Utils/ScannerTest.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -21,7 +21,7 @@ class TestScanner extends \OC\Files\Utils\Scanner { /** * @var \OC\Files\Mount\MountPoint[] $mounts */ - private $mounts = array(); + private $mounts = []; /** * @param \OC\Files\Mount\MountPoint $mount @@ -63,7 +63,7 @@ class ScannerTest extends \Test\TestCase { } public function testReuseExistingRoot() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); @@ -85,7 +85,7 @@ class ScannerTest extends \Test\TestCase { } public function testReuseExistingFile() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); @@ -112,18 +112,18 @@ class ScannerTest extends \Test\TestCase { $mountProvider = $this->createMock(IMountProvider::class); - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, '/' . $uid . '/files/foo'); $mountProvider->expects($this->any()) ->method('getMountsForUser') - ->will($this->returnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) { + ->willReturnCallback(function (IUser $user, IStorageFactory $storageFactory) use ($mount, $uid) { if ($user->getUID() === $uid) { return [$mount]; } else { return []; } - })); + }); \OC::$server->getMountProviderCollection()->registerProvider($mountProvider); $cache = $storage->getCache(); @@ -169,7 +169,7 @@ class ScannerTest extends \Test\TestCase { } public function testPropagateEtag() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); @@ -199,9 +199,9 @@ class ScannerTest extends \Test\TestCase { $sharedStorage->expects($this->any()) ->method('instanceOfStorage') - ->will($this->returnValueMap([ + ->willReturnMap([ [SharedStorage::class, true], - ])); + ]); $sharedStorage->expects($this->never()) ->method('getScanner'); @@ -213,7 +213,7 @@ class ScannerTest extends \Test\TestCase { } public function testShallow() { - $storage = new Temporary(array()); + $storage = new Temporary([]); $mount = new MountPoint($storage, ''); Filesystem::getMountManager()->addMount($mount); $cache = $storage->getCache(); diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 57050059375..c1da385a3cc 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -15,6 +15,7 @@ use OC\Files\Storage\Common; use OC\Files\Storage\Temporary; use OC\Files\Stream\Quota; use OC\Files\View; +use OCP\Constants; use OCP\Files\Config\IMountProvider; use OCP\Files\FileInfo; use OCP\Files\Storage\IStorage; @@ -1169,11 +1170,11 @@ class ViewTest extends \Test\TestCase { $storage2->expects($this->any()) ->method('fopen') - ->will($this->returnCallback(function ($path, $mode) use ($storage2) { + ->willReturnCallback(function ($path, $mode) use ($storage2) { /** @var \PHPUnit_Framework_MockObject_MockObject | \OC\Files\Storage\Temporary $storage2 */ $source = fopen($storage2->getSourcePath($path), $mode); return Quota::wrap($source, 9); - })); + }); $storage1->mkdir('sub'); $storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH'); @@ -1220,7 +1221,7 @@ class ViewTest extends \Test\TestCase { ->getMock(); $storage->expects($this->once()) ->method('unlink') - ->will($this->returnValue(false)); + ->willReturn(false); $scanner = $storage->getScanner(); $cache = $storage->getCache(); $storage->file_put_contents('foo.txt', 'asd'); @@ -1597,7 +1598,7 @@ class ViewTest extends \Test\TestCase { $mountProvider = $this->createMock(IMountProvider::class); $mountProvider->expects($this->any()) ->method('getMountsForUser') - ->will($this->returnValue($mounts)); + ->willReturn($mounts); $mountProviderCollection = \OC::$server->getMountProviderCollection(); $mountProviderCollection->registerProvider($mountProvider); @@ -1611,17 +1612,17 @@ class ViewTest extends \Test\TestCase { public function testMountPointMove() { self::loginAsUser($this->user); - list($mount1, $mount2) = $this->createTestMovableMountPoints([ + [$mount1, $mount2] = $this->createTestMovableMountPoints([ $this->user . '/files/mount1', $this->user . '/files/mount2', ]); $mount1->expects($this->once()) ->method('moveMount') - ->will($this->returnValue(true)); + ->willReturn(true); $mount2->expects($this->once()) ->method('moveMount') - ->will($this->returnValue(true)); + ->willReturn(true); $view = new View('/' . $this->user . '/files/'); $view->mkdir('sub'); @@ -1636,7 +1637,7 @@ class ViewTest extends \Test\TestCase { public function testMoveMountPointIntoAnother() { self::loginAsUser($this->user); - list($mount1, $mount2) = $this->createTestMovableMountPoints([ + [$mount1, $mount2] = $this->createTestMovableMountPoints([ $this->user . '/files/mount1', $this->user . '/files/mount2', ]); @@ -1659,7 +1660,7 @@ class ViewTest extends \Test\TestCase { public function testMoveMountPointIntoSharedFolder() { self::loginAsUser($this->user); - list($mount1) = $this->createTestMovableMountPoints([ + [$mount1] = $this->createTestMovableMountPoints([ $this->user . '/files/mount1', ]); @@ -1846,13 +1847,13 @@ class ViewTest extends \Test\TestCase { $storage->expects($this->once()) ->method($operation) - ->will($this->returnCallback( + ->willReturnCallback( function () use ($view, $lockedPath, &$lockTypeDuring) { $lockTypeDuring = $this->getFileLockType($view, $lockedPath); return true; } - )); + ); $this->assertNull($this->getFileLockType($view, $lockedPath), 'File not locked before operation'); @@ -1890,13 +1891,13 @@ class ViewTest extends \Test\TestCase { $storage->expects($this->once()) ->method('fopen') - ->will($this->returnCallback( + ->willReturnCallback( function () use ($view, $path, &$lockTypeDuring) { $lockTypeDuring = $this->getFileLockType($view, $path); return fopen('php://temp', 'r+'); } - )); + ); $this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost); @@ -1929,13 +1930,13 @@ class ViewTest extends \Test\TestCase { $storage->expects($this->once()) ->method('fopen') - ->will($this->returnCallback( + ->willReturnCallback( function () use ($view, $path, &$lockTypeDuring) { $lockTypeDuring = $this->getFileLockType($view, $path); return fopen('php://temp', 'r+'); } - )); + ); $this->connectMockHooks('write', $view, $path, $lockTypePre, $lockTypePost); @@ -1990,11 +1991,11 @@ class ViewTest extends \Test\TestCase { $storage->expects($this->once()) ->method($operation) - ->will($this->returnCallback( + ->willReturnCallback( function () { throw new \Exception('Simulated exception'); } - )); + ); $thrown = false; try { @@ -2097,12 +2098,21 @@ class ViewTest extends \Test\TestCase { /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage */ $storage = $this->getMockBuilder(Temporary::class) - ->setMethods([$operation, 'filemtime']) + ->setMethods([$operation, 'getMetaData', 'filemtime']) ->getMock(); $storage->expects($this->any()) + ->method('getMetaData') + ->will($this->returnValue([ + 'mtime' => 1885434487, + 'etag' => '', + 'mimetype' => 'text/plain', + 'permissions' => Constants::PERMISSION_ALL, + 'size' => 3 + ])); + $storage->expects($this->any()) ->method('filemtime') - ->will($this->returnValue(123456789)); + ->willReturn(123456789); $sourcePath = 'original.txt'; $targetPath = 'target.txt'; @@ -2113,14 +2123,14 @@ class ViewTest extends \Test\TestCase { $storage->expects($this->once()) ->method($operation) - ->will($this->returnCallback( + ->willReturnCallback( function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath); $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath); return true; } - )); + ); $this->connectMockHooks($operation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost); $this->connectMockHooks($operation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost); @@ -2166,11 +2176,11 @@ class ViewTest extends \Test\TestCase { $storage->expects($this->once()) ->method('copy') - ->will($this->returnCallback( + ->willReturnCallback( function () { throw new \Exception(); } - )); + ); $this->connectMockHooks('copy', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost); $this->connectMockHooks('copy', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost); @@ -2277,12 +2287,21 @@ class ViewTest extends \Test\TestCase { ->getMock(); /** @var Temporary|\PHPUnit_Framework_MockObject_MockObject $storage2 */ $storage2 = $this->getMockBuilder(Temporary::class) - ->setMethods([$storageOperation, 'filemtime']) + ->setMethods([$storageOperation, 'getMetaData', 'filemtime']) ->getMock(); $storage2->expects($this->any()) + ->method('getMetaData') + ->will($this->returnValue([ + 'mtime' => 1885434487, + 'etag' => '', + 'mimetype' => 'text/plain', + 'permissions' => Constants::PERMISSION_ALL, + 'size' => 3 + ])); + $storage2->expects($this->any()) ->method('filemtime') - ->will($this->returnValue(123456789)); + ->willReturn(123456789); $sourcePath = 'original.txt'; $targetPath = 'substorage/target.txt'; @@ -2296,14 +2315,14 @@ class ViewTest extends \Test\TestCase { ->method($storageOperation); $storage2->expects($this->once()) ->method($storageOperation) - ->will($this->returnCallback( + ->willReturnCallback( function () use ($view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring) { $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath); $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath); return true; } - )); + ); $this->connectMockHooks($viewOperation, $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost); $this->connectMockHooks($viewOperation, $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost); @@ -2331,7 +2350,7 @@ class ViewTest extends \Test\TestCase { public function testLockMoveMountPoint() { self::loginAsUser('test'); - list($mount) = $this->createTestMovableMountPoints([ + [$mount] = $this->createTestMovableMountPoints([ $this->user . '/files/substorage', ]); @@ -2343,7 +2362,7 @@ class ViewTest extends \Test\TestCase { $mount->expects($this->once()) ->method('moveMount') - ->will($this->returnCallback( + ->willReturnCallback( function ($target) use ($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) { $lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true); $lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true); @@ -2354,7 +2373,7 @@ class ViewTest extends \Test\TestCase { return true; } - )); + ); $this->connectMockHooks('rename', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost, true); $this->connectMockHooks('rename', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost, true); @@ -2408,18 +2427,18 @@ class ViewTest extends \Test\TestCase { $eventHandler->expects($this->any()) ->method('preCallback') - ->will($this->returnCallback( + ->willReturnCallback( function () use ($view, $path, $onMountPoint, &$lockTypePre) { $lockTypePre = $this->getFileLockType($view, $path, $onMountPoint); } - )); + ); $eventHandler->expects($this->any()) ->method('postCallback') - ->will($this->returnCallback( + ->willReturnCallback( function () use ($view, $path, $onMountPoint, &$lockTypePost) { $lockTypePost = $this->getFileLockType($view, $path, $onMountPoint); } - )); + ); if ($hookType !== null) { Util::connectHook( @@ -2553,6 +2572,7 @@ class ViewTest extends \Test\TestCase { $fh = tmpfile(); fwrite($fh, 'fooo'); rewind($fh); + clearstatcache(); $view->file_put_contents('', $fh); $this->assertEquals('fooo', $view->file_get_contents('')); $data = $view->getFileInfo('.'); diff --git a/tests/lib/Group/Backend.php b/tests/lib/Group/Backend.php index f702d94b2b4..541ed78719b 100644 --- a/tests/lib/Group/Backend.php +++ b/tests/lib/Group/Backend.php @@ -108,15 +108,15 @@ abstract class Backend extends \Test\TestCase { $this->assertFalse($this->backend->addToGroup($user1, $group1)); - $this->assertEquals(array($user1), $this->backend->usersInGroup($group1)); - $this->assertEquals(array(), $this->backend->usersInGroup($group2)); + $this->assertEquals([$user1], $this->backend->usersInGroup($group1)); + $this->assertEquals([], $this->backend->usersInGroup($group2)); - $this->assertEquals(array($group1), $this->backend->getUserGroups($user1)); - $this->assertEquals(array(), $this->backend->getUserGroups($user2)); + $this->assertEquals([$group1], $this->backend->getUserGroups($user1)); + $this->assertEquals([], $this->backend->getUserGroups($user2)); $this->backend->deleteGroup($group1); - $this->assertEquals(array(), $this->backend->getUserGroups($user1)); - $this->assertEquals(array(), $this->backend->usersInGroup($group1)); + $this->assertEquals([], $this->backend->getUserGroups($user1)); + $this->assertEquals([], $this->backend->usersInGroup($group1)); $this->assertFalse($this->backend->inGroup($user1, $group1)); } diff --git a/tests/lib/Group/DatabaseTest.php b/tests/lib/Group/DatabaseTest.php index 4af8b1cd430..586d77e0ec0 100644 --- a/tests/lib/Group/DatabaseTest.php +++ b/tests/lib/Group/DatabaseTest.php @@ -31,7 +31,7 @@ namespace Test\Group; * @group DB */ class DatabaseTest extends Backend { - private $groups = array(); + private $groups = []; /** * get a new unique group name diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php index 61e4b39c8f3..b85496620b8 100644 --- a/tests/lib/Group/GroupTest.php +++ b/tests/lib/Group/GroupTest.php @@ -10,8 +10,6 @@ namespace Test\Group; use OC\User\User; -use OCP\IConfig; -use OCP\IURLGenerator; use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -56,11 +54,11 @@ class GroupTest extends \Test\TestCase { $user3 = $this->newUser('user3', $backend); $userManager->expects($this->any()) ->method('get') - ->will($this->returnValueMap(array( - array('user1', $user1), - array('user2', $user2), - array('user3', $user3) - ))); + ->willReturnMap([ + ['user1', $user1], + ['user2', $user2], + ['user3', $user3] + ]); return $userManager; } @@ -69,12 +67,12 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('usersInGroup') ->with('group1') - ->will($this->returnValue(array('user1', 'user2'))); + ->willReturn(['user1', 'user2']); $users = $group->getUsers(); @@ -93,17 +91,17 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('usersInGroup') ->with('group1') - ->will($this->returnValue(array('user1', 'user2'))); + ->willReturn(['user1', 'user2']); $backend2->expects($this->once()) ->method('usersInGroup') ->with('group1') - ->will($this->returnValue(array('user2', 'user3'))); + ->willReturn(['user2', 'user3']); $users = $group->getUsers(); @@ -124,12 +122,12 @@ class GroupTest extends \Test\TestCase { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertTrue($group->inGroup($this->newUser('user1', $userBackend))); } @@ -145,17 +143,17 @@ class GroupTest extends \Test\TestCase { $userBackend = $this->getMockBuilder(\OC\User\Backend::class) ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(false)); + ->willReturn(false); $backend2->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertTrue($group->inGroup($this->newUser('user1', $userBackend))); } @@ -168,15 +166,15 @@ class GroupTest extends \Test\TestCase { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(false)); + ->willReturn(false); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('addToGroup') @@ -193,15 +191,15 @@ class GroupTest extends \Test\TestCase { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->never()) ->method('addToGroup'); @@ -217,15 +215,15 @@ class GroupTest extends \Test\TestCase { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('removeFromGroup') @@ -242,15 +240,15 @@ class GroupTest extends \Test\TestCase { $userBackend = $this->getMockBuilder(\OC\User\Backend::class) ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(false)); + ->willReturn(false); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->never()) ->method('removeFromGroup'); @@ -269,15 +267,15 @@ class GroupTest extends \Test\TestCase { $userBackend = $this->getMockBuilder('\OC\User\Backend') ->disableOriginalConstructor() ->getMock(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(true)); + ->willReturn(true); $backend1->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend1->expects($this->once()) ->method('removeFromGroup') @@ -286,10 +284,10 @@ class GroupTest extends \Test\TestCase { $backend2->expects($this->once()) ->method('inGroup') ->with('user1', 'group1') - ->will($this->returnValue(true)); + ->willReturn(true); $backend2->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend2->expects($this->once()) ->method('removeFromGroup') @@ -303,12 +301,12 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('usersInGroup') ->with('group1', '2') - ->will($this->returnValue(array('user2'))); + ->willReturn(['user2']); $users = $group->searchUsers('2'); @@ -325,16 +323,16 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('usersInGroup') ->with('group1', '2') - ->will($this->returnValue(array('user2'))); + ->willReturn(['user2']); $backend2->expects($this->once()) ->method('usersInGroup') ->with('group1', '2') - ->will($this->returnValue(array('user2'))); + ->willReturn(['user2']); $users = $group->searchUsers('2'); @@ -348,12 +346,12 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('usersInGroup') ->with('group1', 'user', 1, 1) - ->will($this->returnValue(array('user2'))); + ->willReturn(['user2']); $users = $group->searchUsers('user', 1, 1); @@ -370,16 +368,16 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('usersInGroup') ->with('group1', 'user', 2, 1) - ->will($this->returnValue(array('user2'))); + ->willReturn(['user2']); $backend2->expects($this->once()) ->method('usersInGroup') ->with('group1', 'user', 2, 1) - ->will($this->returnValue(array('user1'))); + ->willReturn(['user1']); $users = $group->searchUsers('user', 2, 1); @@ -395,16 +393,16 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('countUsersInGroup') ->with('group1', '2') - ->will($this->returnValue(3)); + ->willReturn(3); $backend1->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $users = $group->count('2'); @@ -419,23 +417,23 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1, $backend2), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1, $backend2], $this->dispatcher, $userManager); $backend1->expects($this->once()) ->method('countUsersInGroup') ->with('group1', '2') - ->will($this->returnValue(3)); + ->willReturn(3); $backend1->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend2->expects($this->once()) ->method('countUsersInGroup') ->with('group1', '2') - ->will($this->returnValue(4)); + ->willReturn(4); $backend2->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $users = $group->count('2'); @@ -447,13 +445,13 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend1), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend1], $this->dispatcher, $userManager); $backend1->expects($this->never()) ->method('countUsersInGroup'); $backend1->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(false)); + ->willReturn(false); $users = $group->count('2'); @@ -465,14 +463,14 @@ class GroupTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $userManager = $this->getUserManager(); - $group = new \OC\Group\Group('group1', array($backend), $this->dispatcher, $userManager); + $group = new \OC\Group\Group('group1', [$backend], $this->dispatcher, $userManager); $backend->expects($this->once()) ->method('deleteGroup') ->with('group1'); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $group->delete(); } diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php index d5f8baa3fa1..73b315ac297 100644 --- a/tests/lib/Group/ManagerTest.php +++ b/tests/lib/Group/ManagerTest.php @@ -52,10 +52,10 @@ class ManagerTest extends TestCase { $mockUser = $this->createMock(IUser::class); $mockUser->expects($this->any()) ->method('getUID') - ->will($this->returnValue($userId)); + ->willReturn($userId); $mockUser->expects($this->any()) ->method('getDisplayName') - ->will($this->returnValue($userId)); + ->willReturn($userId); return $mockUser; } @@ -91,9 +91,9 @@ class ManagerTest extends TestCase { ->getMock(); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function($actions) use ($implementedActions) { + ->willReturnCallback(function($actions) use ($implementedActions) { return (bool)($actions & $implementedActions); - })); + }); return $backend; } @@ -105,7 +105,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -129,7 +129,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(false)); + ->willReturn(false); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -157,7 +157,7 @@ class ManagerTest extends TestCase { $backend1->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(false)); + ->willReturn(false); /** * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2 @@ -166,7 +166,7 @@ class ManagerTest extends TestCase { $backend2->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend1); @@ -184,15 +184,15 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnCallback(function () use (&$backendGroupCreated) { + ->willReturnCallback(function () use (&$backendGroupCreated) { return $backendGroupCreated; - })); + }); $backend->expects($this->once()) ->method('createGroup') - ->will($this->returnCallback(function () use (&$backendGroupCreated) { + ->willReturnCallback(function () use (&$backendGroupCreated) { $backendGroupCreated = true; return true; - })); + }); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -236,7 +236,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->never()) ->method('createGroup'); @@ -255,11 +255,11 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getGroups') ->with('1') - ->will($this->returnValue(array('group1'))); + ->willReturn(['group1']); $backend->expects($this->once()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -278,10 +278,10 @@ class ManagerTest extends TestCase { $backend1->expects($this->once()) ->method('getGroups') ->with('1') - ->will($this->returnValue(array('group1'))); + ->willReturn(['group1']); $backend1->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); /** * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2 @@ -290,10 +290,10 @@ class ManagerTest extends TestCase { $backend2->expects($this->once()) ->method('getGroups') ->with('1') - ->will($this->returnValue(array('group12', 'group1'))); + ->willReturn(['group12', 'group1']); $backend2->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend1); @@ -315,10 +315,10 @@ class ManagerTest extends TestCase { $backend1->expects($this->once()) ->method('getGroups') ->with('1', 2, 1) - ->will($this->returnValue(array('group1'))); + ->willReturn(['group1']); $backend1->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); /** * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2 @@ -327,10 +327,10 @@ class ManagerTest extends TestCase { $backend2->expects($this->once()) ->method('getGroups') ->with('1', 2, 1) - ->will($this->returnValue(array('group12'))); + ->willReturn(['group12']); $backend2->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend1); @@ -350,11 +350,11 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getGroups') ->with('1') - ->will($this->returnValue(['group1'])); + ->willReturn(['group1']); $backend->expects($this->once()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(false)); + ->willReturn(false); /** @var \OC\User\Manager $userManager */ $userManager = $this->createMock(Manager::class); @@ -374,11 +374,11 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(array('group1'))); + ->willReturn(['group1']); $backend->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -421,11 +421,11 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(array('group1'))); + ->willReturn(['group1']); $backend->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(false)); + ->willReturn(false); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -448,10 +448,10 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(array('group1', 'admin', 'group2'))); + ->willReturn(['group1', 'admin', 'group2']); $backend->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -467,10 +467,10 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(array('group1', 'admin', 'group2'))); + ->willReturn(['group1', 'admin', 'group2']); $backend->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -486,10 +486,10 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(array('group1', 'group2'))); + ->willReturn(['group1', 'group2']); $backend->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -505,10 +505,10 @@ class ManagerTest extends TestCase { $backend1->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(array('group1'))); + ->willReturn(['group1']); $backend1->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); /** * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend2 @@ -517,10 +517,10 @@ class ManagerTest extends TestCase { $backend2->expects($this->once()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(array('group1', 'group2'))); + ->willReturn(['group1', 'group2']); $backend1->expects($this->any()) ->method('groupExists') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend1); @@ -542,11 +542,11 @@ class ManagerTest extends TestCase { $backend->expects($this->exactly(1)) ->method('groupExists') ->with('testgroup') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->any()) ->method('inGroup') - ->will($this->returnCallback(function($uid, $gid) { + ->willReturnCallback(function($uid, $gid) { switch($uid) { case 'user1' : return false; case 'user2' : return true; @@ -555,22 +555,22 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $this->userManager->expects($this->any()) ->method('searchDisplayName') ->with('user3') - ->will($this->returnCallback(function($search, $limit, $offset) { + ->willReturnCallback(function($search, $limit, $offset) { switch($offset) { case 0 : return ['user3' => $this->getTestUser('user3'), 'user33' => $this->getTestUser('user33')]; case 2 : return []; } return null; - })); + }); $this->userManager->expects($this->any()) ->method('get') - ->will($this->returnCallback(function($uid) { + ->willReturnCallback(function($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -579,7 +579,7 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -600,11 +600,11 @@ class ManagerTest extends TestCase { $backend->expects($this->exactly(1)) ->method('groupExists') ->with('testgroup') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->any()) ->method('inGroup') - ->will($this->returnCallback(function($uid, $gid) { + ->willReturnCallback(function($uid, $gid) { switch($uid) { case 'user1' : return false; case 'user2' : return true; @@ -614,22 +614,22 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $this->userManager->expects($this->any()) ->method('searchDisplayName') ->with('user3') - ->will($this->returnCallback(function($search, $limit, $offset) { + ->willReturnCallback(function($search, $limit, $offset) { switch($offset) { case 0 : return ['user3' => $this->getTestUser('user3'), 'user33' => $this->getTestUser('user33')]; case 2 : return ['user333' => $this->getTestUser('user333')]; } return null; - })); + }); $this->userManager->expects($this->any()) ->method('get') - ->will($this->returnCallback(function($uid) { + ->willReturnCallback(function($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -639,7 +639,7 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -661,11 +661,11 @@ class ManagerTest extends TestCase { $backend->expects($this->exactly(1)) ->method('groupExists') ->with('testgroup') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->any()) ->method('inGroup') - ->will($this->returnCallback(function($uid) { + ->willReturnCallback(function($uid) { switch($uid) { case 'user1' : return false; case 'user2' : return true; @@ -675,12 +675,12 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $this->userManager->expects($this->any()) ->method('searchDisplayName') ->with('user3') - ->will($this->returnCallback(function($search, $limit, $offset) { + ->willReturnCallback(function($search, $limit, $offset) { switch($offset) { case 0 : return [ @@ -690,10 +690,10 @@ class ManagerTest extends TestCase { ]; } return null; - })); + }); $this->userManager->expects($this->any()) ->method('get') - ->will($this->returnCallback(function($uid) { + ->willReturnCallback(function($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -703,7 +703,7 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -725,16 +725,16 @@ class ManagerTest extends TestCase { $backend->expects($this->exactly(1)) ->method('groupExists') ->with('testgroup') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('usersInGroup') ->with('testgroup', '', -1, 0) - ->will($this->returnValue(array('user2', 'user33'))); + ->willReturn(['user2', 'user33']); $this->userManager->expects($this->any()) ->method('get') - ->will($this->returnCallback(function($uid) { + ->willReturnCallback(function($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -743,7 +743,7 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -764,16 +764,16 @@ class ManagerTest extends TestCase { $backend->expects($this->exactly(1)) ->method('groupExists') ->with('testgroup') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('usersInGroup') ->with('testgroup', '', 1, 0) - ->will($this->returnValue(array('user2'))); + ->willReturn(['user2']); $this->userManager->expects($this->any()) ->method('get') - ->will($this->returnCallback(function($uid) { + ->willReturnCallback(function($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -782,7 +782,7 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -803,16 +803,16 @@ class ManagerTest extends TestCase { $backend->expects($this->exactly(1)) ->method('groupExists') ->with('testgroup') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('usersInGroup') ->with('testgroup', '', 1, 1) - ->will($this->returnValue(array('user33'))); + ->willReturn(['user33']); $this->userManager->expects($this->any()) ->method('get') - ->will($this->returnCallback(function($uid) { + ->willReturnCallback(function($uid) { switch($uid) { case 'user1' : return $this->getTestUser('user1'); case 'user2' : return $this->getTestUser('user2'); @@ -821,7 +821,7 @@ class ManagerTest extends TestCase { default: return null; } - })); + }); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -843,13 +843,13 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('getUserGroups') ->with('user1') - ->will($this->returnCallback(function () use (&$expectedGroups) { + ->willReturnCallback(function () use (&$expectedGroups) { return $expectedGroups; - })); + }); $backend->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -857,7 +857,7 @@ class ManagerTest extends TestCase { // prime cache $user1 = $this->getTestUser('user1'); $groups = $manager->getUserGroups($user1); - $this->assertEquals(array(), $groups); + $this->assertEquals([], $groups); // add user $group = $manager->get('group1'); @@ -880,19 +880,19 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('getUserGroups') ->with('user1') - ->will($this->returnCallback(function () use (&$expectedGroups) { + ->willReturnCallback(function () use (&$expectedGroups) { return $expectedGroups; - })); + }); $backend->expects($this->any()) ->method('groupExists') ->with('group1') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('inGroup') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('removeFromGroup') - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -907,7 +907,7 @@ class ManagerTest extends TestCase { // remove user $group = $manager->get('group1'); $group->removeUser($user1); - $expectedGroups = array(); + $expectedGroups = []; // check result $groups = $manager->getUserGroups($user1); @@ -922,7 +922,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('getUserGroups') ->with('user1') - ->will($this->returnValue(null)); + ->willReturn(null); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); @@ -945,10 +945,10 @@ class ManagerTest extends TestCase { ); $backend->expects($this->any()) ->method('getGroupDetails') - ->will($this->returnValueMap([ + ->willReturnMap([ ['group1', ['gid' => 'group1', 'displayName' => 'Group One']], ['group2', ['gid' => 'group2']], - ])); + ]); $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger); $manager->addBackend($backend); diff --git a/tests/lib/Group/MetaDataTest.php b/tests/lib/Group/MetaDataTest.php index 4332a6f036f..ebd9cd79f23 100644 --- a/tests/lib/Group/MetaDataTest.php +++ b/tests/lib/Group/MetaDataTest.php @@ -83,7 +83,7 @@ class MetaDataTest extends \Test\TestCase { $this->groupManager->expects($this->once()) ->method('search') ->with('') - ->will($this->returnValue($groups)); + ->willReturn($groups); list($adminGroups, $ordinaryGroups) = $this->groupMetadata->get(); @@ -103,7 +103,7 @@ class MetaDataTest extends \Test\TestCase { $this->groupManager->expects($this->once()) ->method('search') ->with('') - ->will($this->returnValue($groups)); + ->willReturn($groups); list($adminGroups, $ordinaryGroups) = $this->groupMetadata->get(); @@ -121,7 +121,7 @@ class MetaDataTest extends \Test\TestCase { $this->groupManager->expects($this->once()) ->method('search') ->with('') - ->will($this->returnValue($groups)); + ->willReturn($groups); //two calls, if caching fails call counts for group and groupmanager //are exceeded @@ -137,7 +137,7 @@ class MetaDataTest extends \Test\TestCase { ->expects($this->once()) ->method('search') ->with('Foo') - ->will($this->returnValue(['DummyValue'])); + ->willReturn(['DummyValue']); $expected = ['DummyValue']; $this->assertSame($expected, $this->invokePrivate($this->groupMetadata, 'getGroups', ['Foo'])); diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php index 7b2fb665733..606a527f5c9 100644 --- a/tests/lib/HelperStorageTest.php +++ b/tests/lib/HelperStorageTest.php @@ -46,7 +46,7 @@ class HelperStorageTest extends \Test\TestCase { $this->storageMock = null; } \OC\Files\Filesystem::tearDown(); - \OC\Files\Filesystem::mount($this->storage, array(), '/'); + \OC\Files\Filesystem::mount($this->storage, [], '/'); \OC_User::setUserId(''); $user = \OC::$server->getUserManager()->get($this->user); @@ -71,7 +71,7 @@ class HelperStorageTest extends \Test\TestCase { $this->storageMock->expects($this->once()) ->method('free_space') - ->will($this->returnValue(12)); + ->willReturn(12); return $this->storageMock; } @@ -80,7 +80,7 @@ class HelperStorageTest extends \Test\TestCase { */ function testGetStorageInfo() { $homeStorage = $this->getStorageMock(12); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); $storageInfo = \OC_Helper::getStorageInfo(''); @@ -94,14 +94,14 @@ class HelperStorageTest extends \Test\TestCase { */ function testGetStorageInfoExcludingExtStorage() { $homeStorage = $this->getStorageMock(12); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); - $extStorage = new \OC\Files\Storage\Temporary(array()); + $extStorage = new \OC\Files\Storage\Temporary([]); $extStorage->file_put_contents('extfile.txt', 'abcdefghijklmnopq'); $extStorage->getScanner()->scan(''); // update root size - \OC\Files\Filesystem::mount($extStorage, array(), '/' . $this->user . '/files/ext'); + \OC\Files\Filesystem::mount($extStorage, [], '/' . $this->user . '/files/ext'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(12, $storageInfo['free']); @@ -113,15 +113,15 @@ class HelperStorageTest extends \Test\TestCase { * Test getting the storage info, including extra mount points */ function testGetStorageInfoIncludingExtStorage() { - $homeStorage = new \OC\Files\Storage\Temporary(array()); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + $homeStorage = new \OC\Files\Storage\Temporary([]); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); - $extStorage = new \OC\Files\Storage\Temporary(array()); + $extStorage = new \OC\Files\Storage\Temporary([]); $extStorage->file_put_contents('extfile.txt', 'abcdefghijklmnopq'); $extStorage->getScanner()->scan(''); // update root size - \OC\Files\Filesystem::mount($extStorage, array(), '/' . $this->user . '/files/ext'); + \OC\Files\Filesystem::mount($extStorage, [], '/' . $this->user . '/files/ext'); $config = \OC::$server->getConfig(); $oldConfig = $config->getSystemValue('quota_include_external_storage', false); @@ -145,14 +145,14 @@ class HelperStorageTest extends \Test\TestCase { */ function testGetStorageInfoIncludingExtStorageWithNoUserQuota() { $homeStorage = $this->getStorageMock(12); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $homeStorage->file_put_contents('test.txt', '01234'); - $extStorage = new \OC\Files\Storage\Temporary(array()); + $extStorage = new \OC\Files\Storage\Temporary([]); $extStorage->file_put_contents('extfile.txt', 'abcdefghijklmnopq'); $extStorage->getScanner()->scan(''); // update root size - \OC\Files\Filesystem::mount($extStorage, array(), '/' . $this->user . '/files/ext'); + \OC\Files\Filesystem::mount($extStorage, [], '/' . $this->user . '/files/ext'); $config = \OC::$server->getConfig(); $oldConfig = $config->getSystemValue('quota_include_external_storage', false); @@ -174,12 +174,12 @@ class HelperStorageTest extends \Test\TestCase { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '01234'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( - array( + [ 'storage' => $homeStorage, 'quota' => 7 - ) + ] ); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(2, $storageInfo['free']); @@ -194,12 +194,12 @@ class HelperStorageTest extends \Test\TestCase { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '0123456789'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( - array( + [ 'storage' => $homeStorage, 'quota' => 7 - ) + ] ); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(0, $storageInfo['free']); @@ -216,12 +216,12 @@ class HelperStorageTest extends \Test\TestCase { $homeStorage = $this->getStorageMock(12); $homeStorage->file_put_contents('test.txt', '01234'); $homeStorage = new \OC\Files\Storage\Wrapper\Quota( - array( + [ 'storage' => $homeStorage, 'quota' => 18 - ) + ] ); - \OC\Files\Filesystem::mount($homeStorage, array(), '/' . $this->user . '/files'); + \OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files'); $storageInfo = \OC_Helper::getStorageInfo(''); $this->assertEquals(12, $storageInfo['free']); diff --git a/tests/lib/HookHelper.php b/tests/lib/HookHelper.php index f1cce831477..5e040724d90 100644 --- a/tests/lib/HookHelper.php +++ b/tests/lib/HookHelper.php @@ -62,45 +62,45 @@ class HookHelper { } public static function createCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_create, 'params' => $params - ); + ]; } public static function updateCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_update, 'params' => $params - ); + ]; } public static function writeCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_write, 'params' => $params - ); + ]; } public static function postCreateCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_create, 'params' => $params - ); + ]; } public static function postUpdateCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_update, 'params' => $params - ); + ]; } public static function postWriteCallback($params) { - self::$hookCalls[] = array( + self::$hookCalls[] = [ 'signal' => Filesystem::signal_post_write, 'params' => $params - ); + ]; } /** diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php index 1f88dee1032..01ae4d4f28b 100644 --- a/tests/lib/Hooks/BasicEmitterTest.php +++ b/tests/lib/Hooks/BasicEmitterTest.php @@ -16,7 +16,7 @@ namespace Test\Hooks; * @package Test\Hooks */ class DummyEmitter extends \OC\Hooks\BasicEmitter { - public function emitEvent($scope, $method, $arguments = array()) { + public function emitEvent($scope, $method, $arguments = []) { $this->emit($scope, $method, $arguments); } } @@ -64,7 +64,7 @@ class BasicEmitterTest extends \Test\TestCase { public function testStaticCallback() { $this->expectException(\Test\Hooks\EmittedException::class); - $this->emitter->listen('Test', 'test', array('\Test\Hooks\BasicEmitterTest', 'staticCallBack')); + $this->emitter->listen('Test', 'test', ['\Test\Hooks\BasicEmitterTest', 'staticCallBack']); $this->emitter->emitEvent('Test', 'test'); } @@ -72,7 +72,7 @@ class BasicEmitterTest extends \Test\TestCase { public function testNonStaticCallback() { $this->expectException(\Test\Hooks\EmittedException::class); - $this->emitter->listen('Test', 'test', array($this, 'nonStaticCallBack')); + $this->emitter->listen('Test', 'test', [$this, 'nonStaticCallBack']); $this->emitter->emitEvent('Test', 'test'); } @@ -134,7 +134,7 @@ class BasicEmitterTest extends \Test\TestCase { throw new EmittedException; } }); - $this->emitter->emitEvent('Test', 'test', array('foo', 'bar')); + $this->emitter->emitEvent('Test', 'test', ['foo', 'bar']); } @@ -146,7 +146,7 @@ class BasicEmitterTest extends \Test\TestCase { throw new EmittedException; } }); - $this->emitter->emitEvent('Test', 'test', array('foo' => 'foo', 'bar' => 'bar')); + $this->emitter->emitEvent('Test', 'test', ['foo' => 'foo', 'bar' => 'bar']); } public function testRemoveAllSpecified() { diff --git a/tests/lib/Hooks/ForwardingEmitterTest.php b/tests/lib/Hooks/ForwardingEmitterTest.php index ea8ee5c4121..9b0a51d1bd4 100644 --- a/tests/lib/Hooks/ForwardingEmitterTest.php +++ b/tests/lib/Hooks/ForwardingEmitterTest.php @@ -10,7 +10,7 @@ namespace Test\Hooks; use OC\Hooks\PublicEmitter; class DummyForwardingEmitter extends \OC\Hooks\ForwardingEmitter { - public function emitEvent($scope, $method, $arguments = array()) { + public function emitEvent($scope, $method, $arguments = []) { $this->emit($scope, $method, $arguments); } diff --git a/tests/lib/Hooks/LegacyEmitterTest.php b/tests/lib/Hooks/LegacyEmitterTest.php index 32c923d8013..3b9eb26ec50 100644 --- a/tests/lib/Hooks/LegacyEmitterTest.php +++ b/tests/lib/Hooks/LegacyEmitterTest.php @@ -16,7 +16,7 @@ namespace Test\Hooks; * @package Test\Hooks */ class DummyLegacyEmitter extends \OC\Hooks\LegacyEmitter { - public function emitEvent($scope, $method, $arguments = array()) { + public function emitEvent($scope, $method, $arguments = []) { $this->emit($scope, $method, $arguments); } } @@ -51,7 +51,7 @@ class LegacyEmitterTest extends BasicEmitterTest { public function testLegacyArguments() { \OC_Hook::connect('Test', 'test', '\Test\Hooks\LegacyEmitterTest', 'staticLegacyArgumentsCallBack'); - $this->emitter->emitEvent('Test', 'test', array('foo' => 'foo', 'bar' => 'bar')); + $this->emitter->emitEvent('Test', 'test', ['foo' => 'foo', 'bar' => 'bar']); $this->assertEquals(true, self::$emitted); } } diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php index 34fcf0e004d..3858945d191 100644 --- a/tests/lib/ImageTest.php +++ b/tests/lib/ImageTest.php @@ -345,11 +345,11 @@ class ImageTest extends \Test\TestCase { } function convertDataProvider() { - return array( - array( 'image/gif'), - array( 'image/jpeg'), - array( 'image/png'), - ); + return [ + [ 'image/gif'], + [ 'image/jpeg'], + [ 'image/png'], + ]; } /** diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php index 4530784e8e2..7a91fcab270 100644 --- a/tests/lib/InstallerTest.php +++ b/tests/lib/InstallerTest.php @@ -9,7 +9,6 @@ namespace Test; -use OC\App\AppStore\Bundles\Bundle; use OC\App\AppStore\Fetcher\AppFetcher; use OC\Archive\ZIP; use OC\Installer; diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 586a42ff547..7d99316f479 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -62,13 +62,13 @@ class CheckerTest extends TestCase { $this->mimeTypeDetector = $this->createMock(\OC\Files\Type\Detection::class); $this->config->method('getAppValue') - ->will($this->returnArgument(2)); + ->willReturnArgument(2); $this->cacheFactory ->expects($this->any()) ->method('createDistributed') ->with('oc.integritycheck.checker') - ->will($this->returnValue(new NullCache())); + ->willReturn(new NullCache()); $this->checker = new Checker( $this->environmentHelper, @@ -161,12 +161,12 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $expected = [ 'EXCEPTION' => [ @@ -181,18 +181,18 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->once()) ->method('getAppPath') ->with('SomeApp') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -207,14 +207,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( '/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $this->assertSame([], $this->checker->verifyAppSignature('SomeApp')); } @@ -223,18 +223,18 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->once()) ->method('getAppPath') ->with('SomeApp') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "tampered", @@ -249,14 +249,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( '/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ 'EXCEPTION' => [ @@ -271,18 +271,18 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->once()) ->method('getAppPath') ->with('SomeApp') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -297,14 +297,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( '/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ @@ -335,12 +335,12 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->never()) @@ -360,14 +360,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( '/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ @@ -398,18 +398,18 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->once()) ->method('getAppPath') ->with('SomeApp') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -422,14 +422,14 @@ class CheckerTest extends TestCase { ->expects($this->at(0)) ->method('file_get_contents') ->with(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//appinfo/signature.json') - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( '/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ 'EXCEPTION' => [ @@ -444,18 +444,18 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->once()) ->method('getAppPath') ->with('SomeApp') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -468,14 +468,14 @@ class CheckerTest extends TestCase { ->expects($this->at(0)) ->method('file_get_contents') ->with(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json') - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( '/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $this->assertSame([], $this->checker->verifyAppSignature('SomeApp')); } @@ -540,7 +540,7 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $this->fileAccessHelper ->expects($this->once()) ->method('file_put_contents') @@ -575,7 +575,7 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/'); $this->fileAccessHelper ->expects($this->once()) ->method('file_put_contents') @@ -640,7 +640,7 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); $this->fileAccessHelper ->expects($this->once()) ->method('file_put_contents') @@ -667,12 +667,12 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $expected = [ 'EXCEPTION' => [ @@ -687,17 +687,17 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -712,14 +712,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $this->assertSame([], $this->checker->verifyCoreSignature()); } @@ -728,17 +728,17 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent'); $signatureDataFile = '{ "hashes": { ".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227", @@ -753,14 +753,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $this->assertSame([], $this->checker->verifyCoreSignature()); } @@ -769,18 +769,18 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->mimeTypeDetector ->expects($this->once()) ->method('getOnlyDefaultAliases') ->willReturn( - array ( + [ '_comment' => 'Array of mimetype aliases.', '_comment2' => 'Any changes you make here will be overwritten on an update of Nextcloud.', '_comment3' => 'Put any custom mappings in a new file mimetypealiases.json in the config/ folder of Nextcloud', @@ -881,13 +881,13 @@ class CheckerTest extends TestCase { 'text/x-shellscript' => 'text/code', 'web' => 'text/code', 'application/internet-shortcut' => 'link', - )); + ]); $this->mimeTypeDetector ->expects($this->once()) ->method('getAllAliases') ->willReturn( - array ( + [ '_comment' => 'Array of mimetype aliases.', '_comment2' => 'Any changes you make here will be overwritten on an update of Nextcloud.', '_comment3' => 'Put any custom mappings in a new file mimetypealiases.json in the config/ folder of Nextcloud', @@ -989,12 +989,12 @@ class CheckerTest extends TestCase { 'text/x-shellscript' => 'text/code', 'web' => 'text/code', 'application/internet-shortcut' => 'link', - )); + ]); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified'); $signatureDataFile = '{ "hashes": { "mimetypelist.js": "dc48de7ad4baa030c5e563350c9a80b274bad783f6f5adbf1595ecef6c6a32e52890a24cb26cddb0aa20193ba52c001150c68d8bfb567f0aed566f4029a190a3" @@ -1008,14 +1008,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/mimetypeListModified/resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $this->assertSame([], $this->checker->verifyCoreSignature()); @@ -1025,17 +1025,17 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -1050,14 +1050,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $this->assertSame([], $this->checker->verifyCoreSignature()); } @@ -1066,17 +1066,17 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "tampered", @@ -1091,14 +1091,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ 'EXCEPTION' => [ @@ -1113,17 +1113,17 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -1138,14 +1138,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData//resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ 'INVALID_HASH' => [ @@ -1175,17 +1175,17 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -1200,14 +1200,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ 'EXCEPTION' => [ @@ -1222,17 +1222,17 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->environmentHelper ->expects($this->any()) ->method('getServerRoot') - ->will($this->returnValue(\OC::$SERVERROOT . '/tests/data/integritycheck/app/')); + ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/'); $signatureDataFile = '{ "hashes": { "AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112", @@ -1247,14 +1247,14 @@ class CheckerTest extends TestCase { ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json' ) - ->will($this->returnValue($signatureDataFile)); + ->willReturn($signatureDataFile); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_get_contents') ->with( \OC::$SERVERROOT . '/tests/data/integritycheck/app//resources/codesigning/root.crt' ) - ->will($this->returnValue(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt'))); + ->willReturn(file_get_contents(__DIR__ .'/../../data/integritycheck/root.crt')); $expected = [ 'EXCEPTION' => [ @@ -1289,17 +1289,17 @@ class CheckerTest extends TestCase { $this->appLocator ->expects($this->at(0)) ->method('getAllApps') - ->will($this->returnValue([ + ->willReturn([ 'files', 'calendar', 'contacts', 'dav', - ])); + ]); $this->appManager ->expects($this->at(0)) ->method('isShipped') ->with('files') - ->will($this->returnValue(true)); + ->willReturn(true); $this->checker ->expects($this->at(1)) ->method('verifyAppSignature') @@ -1308,17 +1308,17 @@ class CheckerTest extends TestCase { ->expects($this->at(1)) ->method('isShipped') ->with('calendar') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->at(1)) ->method('getAppPath') ->with('calendar') - ->will($this->returnValue('/apps/calendar')); + ->willReturn('/apps/calendar'); $this->fileAccessHelper ->expects($this->at(0)) ->method('file_exists') ->with('/apps/calendar/appinfo/signature.json') - ->will($this->returnValue(true)); + ->willReturn(true); $this->checker ->expects($this->at(2)) ->method('verifyAppSignature') @@ -1327,22 +1327,22 @@ class CheckerTest extends TestCase { ->expects($this->at(2)) ->method('isShipped') ->with('contacts') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appLocator ->expects($this->at(2)) ->method('getAppPath') ->with('contacts') - ->will($this->returnValue('/apps/contacts')); + ->willReturn('/apps/contacts'); $this->fileAccessHelper ->expects($this->at(1)) ->method('file_exists') ->with('/apps/contacts/appinfo/signature.json') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(3)) ->method('isShipped') ->with('dav') - ->will($this->returnValue(true)); + ->willReturn(true); $this->checker ->expects($this->at(3)) ->method('verifyAppSignature') @@ -1359,12 +1359,12 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue('stable')); + ->willReturn('stable'); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(true)); + ->willReturn(true); $expected = []; $this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp')); @@ -1389,12 +1389,12 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue($channel)); + ->willReturn($channel); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertSame($isCodeSigningEnforced, $this->checker->isCodeCheckEnforced()); } @@ -1407,12 +1407,12 @@ class CheckerTest extends TestCase { $this->environmentHelper ->expects($this->once()) ->method('getChannel') - ->will($this->returnValue($channel)); + ->willReturn($channel); $this->config ->expects($this->any()) ->method('getSystemValue') ->with('integrity.check.disabled', false) - ->will($this->returnValue(true)); + ->willReturn(true); $this->assertFalse(self::invokePrivate($this->checker, 'isCodeCheckEnforced')); } diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index c75bfba5b99..4d35aeabc91 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -510,7 +510,7 @@ class FactoryTest extends TestCase { $this->config->expects($this->any()) ->method('getSystemValue') - ->will($this->returnCallback(function($var, $default) use ($defaultLang) { + ->willReturnCallback(function($var, $default) use ($defaultLang) { if ($var === 'installed') { return true; } else if ($var === 'default_language') { @@ -518,7 +518,7 @@ class FactoryTest extends TestCase { } else { return $default; } - })); + }); if ($loggedIn) { $user = $this->getMockBuilder(IUser::class) @@ -549,14 +549,14 @@ class FactoryTest extends TestCase { $factory = $this->getFactory(['languageExists', 'findAvailableLanguages', 'respectDefaultLanguage']); $factory->expects($this->any()) ->method('languageExists') - ->will($this->returnCallback(function ($app, $lang) use ($availableLang) { + ->willReturnCallback(function ($app, $lang) use ($availableLang) { return in_array($lang, $availableLang); - })); + }); $factory->expects($this->any()) ->method('findAvailableLanguages') - ->will($this->returnCallback(function ($app) use ($availableLang) { + ->willReturnCallback(function ($app) use ($availableLang) { return $availableLang; - })); + }); $factory->expects($this->any()) ->method('respectDefaultLanguage')->willReturnCallback(function($app, $lang) { return $lang; diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php index dd0fa000b7e..b2e7d5ebfc9 100644 --- a/tests/lib/L10N/L10nTest.php +++ b/tests/lib/L10N/L10nTest.php @@ -78,39 +78,39 @@ class L10nTest extends TestCase { } public function localizationData() { - return array( + return [ // timestamp as string - array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', '1234567890'), - array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', '1234567890'), - array('February 13, 2009', 'en', 'en_US', 'date', '1234567890'), - array('13. Februar 2009', 'de', 'de_DE', 'date', '1234567890'), - array('11:31:30 PM GMT+0', 'en', 'en_US', 'time', '1234567890'), - array('23:31:30 GMT+0', 'de', 'de_DE', 'time', '1234567890'), + ['February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', '1234567890'], + ['13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', '1234567890'], + ['February 13, 2009', 'en', 'en_US', 'date', '1234567890'], + ['13. Februar 2009', 'de', 'de_DE', 'date', '1234567890'], + ['11:31:30 PM GMT+0', 'en', 'en_US', 'time', '1234567890'], + ['23:31:30 GMT+0', 'de', 'de_DE', 'time', '1234567890'], // timestamp as int - array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', 1234567890), - array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', 1234567890), - array('February 13, 2009', 'en', 'en_US', 'date', 1234567890), - array('13. Februar 2009', 'de', 'de_DE', 'date', 1234567890), - array('11:31:30 PM GMT+0', 'en', 'en_US', 'time', 1234567890), - array('23:31:30 GMT+0', 'de', 'de_DE', 'time', 1234567890), + ['February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', 1234567890], + ['13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', 1234567890], + ['February 13, 2009', 'en', 'en_US', 'date', 1234567890], + ['13. Februar 2009', 'de', 'de_DE', 'date', 1234567890], + ['11:31:30 PM GMT+0', 'en', 'en_US', 'time', 1234567890], + ['23:31:30 GMT+0', 'de', 'de_DE', 'time', 1234567890], // DateTime object - array('February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', new DateTime('@1234567890')), - array('13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', new DateTime('@1234567890')), - array('February 13, 2009', 'en', 'en_US', 'date', new DateTime('@1234567890')), - array('13. Februar 2009', 'de', 'de_DE', 'date', new DateTime('@1234567890')), - array('11:31:30 PM GMT+0', 'en', 'en_US', 'time', new DateTime('@1234567890')), - array('23:31:30 GMT+0', 'de', 'de_DE', 'time', new DateTime('@1234567890')), + ['February 13, 2009 at 11:31:30 PM GMT+0', 'en', 'en_US', 'datetime', new DateTime('@1234567890')], + ['13. Februar 2009 um 23:31:30 GMT+0', 'de', 'de_DE', 'datetime', new DateTime('@1234567890')], + ['February 13, 2009', 'en', 'en_US', 'date', new DateTime('@1234567890')], + ['13. Februar 2009', 'de', 'de_DE', 'date', new DateTime('@1234567890')], + ['11:31:30 PM GMT+0', 'en', 'en_US', 'time', new DateTime('@1234567890')], + ['23:31:30 GMT+0', 'de', 'de_DE', 'time', new DateTime('@1234567890')], // en_GB - array('13 February 2009 at 23:31:30 GMT+0', 'en_GB', 'en_GB', 'datetime', new DateTime('@1234567890')), - array('13 February 2009', 'en_GB', 'en_GB', 'date', new DateTime('@1234567890')), - array('23:31:30 GMT+0', 'en_GB', 'en_GB', 'time', new DateTime('@1234567890')), - array('13 February 2009 at 23:31:30 GMT+0', 'en-GB', 'en_GB', 'datetime', new DateTime('@1234567890')), - array('13 February 2009', 'en-GB', 'en_GB', 'date', new DateTime('@1234567890')), - array('23:31:30 GMT+0', 'en-GB', 'en_GB', 'time', new DateTime('@1234567890')), - ); + ['13 February 2009 at 23:31:30 GMT+0', 'en_GB', 'en_GB', 'datetime', new DateTime('@1234567890')], + ['13 February 2009', 'en_GB', 'en_GB', 'date', new DateTime('@1234567890')], + ['23:31:30 GMT+0', 'en_GB', 'en_GB', 'time', new DateTime('@1234567890')], + ['13 February 2009 at 23:31:30 GMT+0', 'en-GB', 'en_GB', 'datetime', new DateTime('@1234567890')], + ['13 February 2009', 'en-GB', 'en_GB', 'date', new DateTime('@1234567890')], + ['23:31:30 GMT+0', 'en-GB', 'en_GB', 'time', new DateTime('@1234567890')], + ]; } /** @@ -122,10 +122,10 @@ class L10nTest extends TestCase { } public function firstDayData() { - return array( - array(1, 'de', 'de_DE'), - array(0, 'en', 'en_US'), - ); + return [ + [1, 'de', 'de_DE'], + [0, 'en', 'en_US'], + ]; } /** @@ -140,10 +140,10 @@ class L10nTest extends TestCase { } public function jsDateData() { - return array( - array('dd.MM.yy', 'de', 'de_DE'), - array('M/d/yy', 'en', 'en_US'), - ); + return [ + ['dd.MM.yy', 'de', 'de_DE'], + ['M/d/yy', 'en', 'en_US'], + ]; } /** diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php index 21d5dbc8bab..f6e85ea188c 100644 --- a/tests/lib/LegacyHelperTest.php +++ b/tests/lib/LegacyHelperTest.php @@ -35,15 +35,15 @@ class LegacyHelperTest extends \Test\TestCase { public function humanFileSizeProvider() { - return array( - array('0 B', 0), - array('1 KB', 1024), - array('9.5 MB', 10000000), - array('1.3 GB', 1395864371), - array('465.7 GB', 500000000000), - array('454.7 TB', 500000000000000), - array('444.1 PB', 500000000000000000), - ); + return [ + ['0 B', 0], + ['1 KB', 1024], + ['9.5 MB', 10000000], + ['1.3 GB', 1395864371], + ['465.7 GB', 500000000000], + ['454.7 TB', 500000000000000], + ['444.1 PB', 500000000000000000], + ]; } /** @@ -66,36 +66,36 @@ class LegacyHelperTest extends \Test\TestCase { } function testMb_array_change_key_case() { - $arrayStart = array( + $arrayStart = [ "Foo" => "bar", "Bar" => "foo", - ); - $arrayResult = array( + ]; + $arrayResult = [ "foo" => "bar", "bar" => "foo", - ); + ]; $result = OC_Helper::mb_array_change_key_case($arrayStart); $expected = $arrayResult; $this->assertEquals($result, $expected); - $arrayStart = array( + $arrayStart = [ "foo" => "bar", "bar" => "foo", - ); - $arrayResult = array( + ]; + $arrayResult = [ "FOO" => "bar", "BAR" => "foo", - ); + ]; $result = OC_Helper::mb_array_change_key_case($arrayStart, MB_CASE_UPPER); $expected = $arrayResult; $this->assertEquals($result, $expected); } function testRecursiveArraySearch() { - $haystack = array( + $haystack = [ "Foo" => "own", "Bar" => "Cloud", - ); + ]; $result = OC_Helper::recursiveArraySearch($haystack, "own"); $expected = "Foo"; @@ -112,56 +112,56 @@ class LegacyHelperTest extends \Test\TestCase { $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename.ext exists + ->willReturn(true); // filename.ext exists $this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename.ext exists + ->willReturn(true); // filename.ext exists $viewMock->expects($this->at(1)) ->method('file_exists') - ->will($this->returnValue(true)); // filename (2).ext exists + ->willReturn(true); // filename (2).ext exists $this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename (1).ext exists + ->willReturn(true); // filename (1).ext exists $this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (1).ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename (2).ext exists + ->willReturn(true); // filename (2).ext exists $this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename (2).ext exists + ->willReturn(true); // filename (2).ext exists $viewMock->expects($this->at(1)) ->method('file_exists') - ->will($this->returnValue(true)); // filename (3).ext exists + ->willReturn(true); // filename (3).ext exists $this->assertEquals('dir/filename (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename(1).ext exists + ->willReturn(true); // filename(1).ext exists $this->assertEquals('dir/filename(2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1).ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename(1) (1).ext exists + ->willReturn(true); // filename(1) (1).ext exists $this->assertEquals('dir/filename(1) (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename(1) (1).ext exists + ->willReturn(true); // filename(1) (1).ext exists $viewMock->expects($this->at(1)) ->method('file_exists') - ->will($this->returnValue(true)); // filename(1) (2).ext exists + ->willReturn(true); // filename(1) (2).ext exists $this->assertEquals('dir/filename(1) (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock)); $viewMock->expects($this->at(0)) ->method('file_exists') - ->will($this->returnValue(true)); // filename(1) (2) (3).ext exists + ->willReturn(true); // filename(1) (2) (3).ext exists $this->assertEquals('dir/filename(1) (2) (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (2) (3).ext', $viewMock)); } @@ -192,12 +192,12 @@ class LegacyHelperTest extends \Test\TestCase { function streamCopyDataProvider() { - return array( - array(0, false, false, false), - array(0, false, \OC::$SERVERROOT . '/tests/data/lorem.txt', false), - array(filesize(\OC::$SERVERROOT . '/tests/data/lorem.txt'), true, \OC::$SERVERROOT . '/tests/data/lorem.txt', \OC::$SERVERROOT . '/tests/data/lorem-copy.txt'), - array(3670, true, \OC::$SERVERROOT . '/tests/data/testimage.png', \OC::$SERVERROOT . '/tests/data/testimage-copy.png'), - ); + return [ + [0, false, false, false], + [0, false, \OC::$SERVERROOT . '/tests/data/lorem.txt', false], + [filesize(\OC::$SERVERROOT . '/tests/data/lorem.txt'), true, \OC::$SERVERROOT . '/tests/data/lorem.txt', \OC::$SERVERROOT . '/tests/data/lorem-copy.txt'], + [3670, true, \OC::$SERVERROOT . '/tests/data/testimage.png', \OC::$SERVERROOT . '/tests/data/testimage-copy.png'], + ]; } /** @@ -234,7 +234,7 @@ class LegacyHelperTest extends \Test\TestCase { * @return mixed * @deprecated Please extend \Test\TestCase and use self::invokePrivate() then */ - public static function invokePrivate($object, $methodName, array $parameters = array()) { + public static function invokePrivate($object, $methodName, array $parameters = []) { return parent::invokePrivate($object, $methodName, $parameters); } } diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php index 73a7b6c3f83..ac58538284c 100644 --- a/tests/lib/Lock/DBLockingProviderTest.php +++ b/tests/lib/Lock/DBLockingProviderTest.php @@ -54,9 +54,9 @@ class DBLockingProviderTest extends LockingProvider { $this->timeFactory = $this->createMock(ITimeFactory::class); $this->timeFactory->expects($this->any()) ->method('getTime') - ->will($this->returnCallback(function () { + ->willReturnCallback(function () { return $this->currentTime; - })); + }); parent::setUp(); } diff --git a/tests/lib/Log/LogFactoryTest.php b/tests/lib/Log/LogFactoryTest.php index 37dbf1d97b8..4a3997dbf20 100644 --- a/tests/lib/Log/LogFactoryTest.php +++ b/tests/lib/Log/LogFactoryTest.php @@ -29,7 +29,6 @@ use OC\Log\LogFactory; use OC\Log\Syslog; use OC\Log\Systemdlog; use OC\SystemConfig; -use OCP\IConfig; use OCP\IServerContainer; use Test\TestCase; diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php index fa4e481ac48..fd695c8c68d 100644 --- a/tests/lib/LoggerTest.php +++ b/tests/lib/LoggerTest.php @@ -37,9 +37,9 @@ class LoggerTest extends TestCase implements IWriter { public function testInterpolation() { $logger = $this->logger; - $logger->warning('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + $logger->warning('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']); - $expected = array('2 {Message {nothing} Bob Bar a}'); + $expected = ['2 {Message {nothing} Bob Bar a}']; $this->assertEquals($expected, $this->getLogs()); } diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index 3a08cd9acf2..8d169d598c9 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -1,6 +1,9 @@ <?php /** * Copyright (c) 2014-2015 Lukas Reschke <lukas@owncloud.com> + * + * @author Arne Hamann <github@arne.email> + * * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -8,14 +11,19 @@ namespace Test\Mail; + use OC\Mail\EMailTemplate; use OC\Mail\Mailer; +use OC\Mail\Message; use OCP\Defaults; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; use OCP\IURLGenerator; +use OCP\Mail\Events\BeforeMessageSent; use Test\TestCase; +use Swift_SwiftException; class MailerTest extends TestCase { /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ @@ -30,6 +38,9 @@ class MailerTest extends TestCase { private $l10n; /** @var Mailer */ private $mailer; + /** @var IEventDispatcher */ + private $dispatcher; + protected function setUp(): void { parent::setUp(); @@ -39,12 +50,14 @@ class MailerTest extends TestCase { $this->logger = $this->createMock(ILogger::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->l10n = $this->createMock(IL10N::class); + $this->dispatcher = $this->createMock(IEventDispatcher::class); $this->mailer = new Mailer( $this->config, $this->logger, $this->defaults, $this->urlGenerator, - $this->l10n + $this->l10n, + $this->dispatcher ); } @@ -67,10 +80,10 @@ class MailerTest extends TestCase { $this->config ->expects($this->exactly(2)) ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'sendmail'], ['mail_sendmailmode', 'smtp', $sendmailMode], - ])); + ]); $path = \OC_Helper::findBinaryPath('sendmail'); if ($path === null) { @@ -90,10 +103,10 @@ class MailerTest extends TestCase { $this->config ->expects($this->exactly(2)) ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'qmail'], ['mail_sendmailmode', 'smtp', $sendmailMode], - ])); + ]); $this->assertEquals(new \Swift_SendmailTransport('/var/qmail/bin/sendmail' . $binaryParam), self::invokePrivate($this->mailer, 'getSendMailInstance')); } @@ -107,22 +120,37 @@ class MailerTest extends TestCase { public function testGetInstanceSendmail() { $this->config ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'sendmail'], ['mail_sendmailmode', 'smtp', 'smtp'], - ])); + ]); $mailer = self::invokePrivate($this->mailer, 'getInstance'); $this->assertInstanceOf(\Swift_Mailer::class, $mailer); $this->assertInstanceOf(\Swift_SendmailTransport::class, $mailer->getTransport()); } + public function testEvents() { + $message = $this->createMock(Message::class); + + $event = new BeforeMessageSent($message); + $this->dispatcher->expects($this->at(0)) + ->method('dispatchTyped') + ->with($this->equalTo($event)); + + # We do not care at this point about errors in Swiftmailer + try { + $this->mailer->send($message); + } catch (Swift_SwiftException $e) { + } + } + public function testCreateMessage() { $this->config ->expects($this->any()) ->method('getSystemValue') ->with('mail_send_plaintext_only', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage()); } @@ -134,7 +162,7 @@ class MailerTest extends TestCase { ->disableOriginalConstructor()->getMock(); $message->expects($this->once()) ->method('getSwiftMessage') - ->will($this->returnValue(new \Swift_Message())); + ->willReturn(new \Swift_Message()); $this->mailer->send($message); } @@ -170,10 +198,10 @@ class MailerTest extends TestCase { public function testStreamingOptions() { $this->config->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'smtp'], ['mail_smtpstreamoptions', [], ['foo' => 1]] - ])); + ]); $mailer = self::invokePrivate($this->mailer, 'getInstance'); $this->assertEquals(1, count($mailer->getTransport()->getStreamOptions())); $this->assertTrue(isset($mailer->getTransport()->getStreamOptions()['foo'])); @@ -182,10 +210,10 @@ class MailerTest extends TestCase { public function testStreamingOptionsWrongType() { $this->config->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'smtp'], ['mail_smtpstreamoptions', [], 'bar'] - ])); + ]); $mailer = self::invokePrivate($this->mailer, 'getInstance'); $this->assertEquals(0, count($mailer->getTransport()->getStreamOptions())); } diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php index e0a0f468a50..173d9414cda 100644 --- a/tests/lib/Mail/MessageTest.php +++ b/tests/lib/Mail/MessageTest.php @@ -23,12 +23,22 @@ class MessageTest extends TestCase { * @return array */ public function mailAddressProvider() { - return array( - array(array('lukas@owncloud.com' => 'Lukas Reschke'), array('lukas@owncloud.com' => 'Lukas Reschke')), - array(array('lukas@owncloud.com' => 'Lukas Reschke', 'lukas@öwnclöüd.com', 'lukäs@owncloud.örg' => 'Lükäs Réschke'), - array('lukas@owncloud.com' => 'Lukas Reschke', 'lukas@xn--wncld-iuae2c.com', 'lukäs@owncloud.xn--rg-eka' => 'Lükäs Réschke')), - array(array('lukas@öwnclöüd.com'), array('lukas@xn--wncld-iuae2c.com')) - ); + return [ + [['lukas@owncloud.com' => 'Lukas Reschke'], ['lukas@owncloud.com' => 'Lukas Reschke']], + [['lukas@owncloud.com' => 'Lukas Reschke', 'lukas@öwnclöüd.com', 'lukäs@owncloud.örg' => 'Lükäs Réschke'], + ['lukas@owncloud.com' => 'Lukas Reschke', 'lukas@xn--wncld-iuae2c.com', 'lukäs@owncloud.xn--rg-eka' => 'Lükäs Réschke']], + [['lukas@öwnclöüd.com'], ['lukas@xn--wncld-iuae2c.com']], + ]; + } + + /** + * @return array + */ + public function getMailAddressProvider() { + return [ + [null, []], + [['lukas@owncloud.com' => 'Lukas Reschke'], ['lukas@owncloud.com' => 'Lukas Reschke']], + ]; } protected function setUp(): void { @@ -48,24 +58,31 @@ class MessageTest extends TestCase { * @param string $expected */ public function testConvertAddresses($unconverted, $expected) { - $this->assertSame($expected, self::invokePrivate($this->message, 'convertAddresses', array($unconverted))); + $this->assertSame($expected, self::invokePrivate($this->message, 'convertAddresses', [$unconverted])); } public function testSetFrom() { $this->swiftMessage ->expects($this->once()) ->method('setFrom') - ->with(array('lukas@owncloud.com')); - $this->message->setFrom(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setFrom(['lukas@owncloud.com']); } - public function testGetFrom() { + + /** + * @dataProvider getMailAddressProvider + * + * @param $swiftresult + * @param $return + */ + public function testGetFrom($swiftresult, $return) { $this->swiftMessage ->expects($this->once()) ->method('getFrom') - ->will($this->returnValue(array('lukas@owncloud.com'))); + ->willReturn($swiftresult); - $this->assertSame(array('lukas@owncloud.com'), $this->message->getFrom()); + $this->assertSame($return, $this->message->getFrom()); } public function testSetReplyTo() { @@ -89,51 +106,60 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('setTo') - ->with(array('lukas@owncloud.com')); - $this->message->setTo(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setTo(['lukas@owncloud.com']); } - public function testGetTo() { + /** + * @dataProvider getMailAddressProvider + */ + public function testGetTo($swiftresult,$return) { $this->swiftMessage ->expects($this->once()) ->method('getTo') - ->will($this->returnValue(array('lukas@owncloud.com'))); + ->willReturn($swiftresult); - $this->assertSame(array('lukas@owncloud.com'), $this->message->getTo()); + $this->assertSame($return, $this->message->getTo()); } public function testSetCc() { $this->swiftMessage ->expects($this->once()) ->method('setCc') - ->with(array('lukas@owncloud.com')); - $this->message->setCc(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setCc(['lukas@owncloud.com']); } - public function testGetCc() { + /** + * @dataProvider getMailAddressProvider + */ + public function testGetCc($swiftresult,$return) { $this->swiftMessage ->expects($this->once()) ->method('getCc') - ->will($this->returnValue(array('lukas@owncloud.com'))); + ->willReturn($swiftresult); - $this->assertSame(array('lukas@owncloud.com'), $this->message->getCc()); + $this->assertSame($return, $this->message->getCc()); } public function testSetBcc() { $this->swiftMessage ->expects($this->once()) ->method('setBcc') - ->with(array('lukas@owncloud.com')); - $this->message->setBcc(array('lukas@owncloud.com')); + ->with(['lukas@owncloud.com']); + $this->message->setBcc(['lukas@owncloud.com']); } - public function testGetBcc() { + /** + * @dataProvider getMailAddressProvider + */ + public function testGetBcc($swiftresult,$return) { $this->swiftMessage ->expects($this->once()) ->method('getBcc') - ->will($this->returnValue(array('lukas@owncloud.com'))); + ->willReturn($swiftresult); - $this->assertSame(array('lukas@owncloud.com'), $this->message->getBcc()); + $this->assertSame($return, $this->message->getBcc()); } public function testSetSubject() { @@ -149,7 +175,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getSubject') - ->will($this->returnValue('Fancy Subject')); + ->willReturn('Fancy Subject'); $this->assertSame('Fancy Subject', $this->message->getSubject()); } @@ -167,7 +193,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getBody') - ->will($this->returnValue('Fancy Body')); + ->willReturn('Fancy Body'); $this->assertSame('Fancy Body', $this->message->getPlainBody()); } diff --git a/tests/lib/Memcache/CasTraitTest.php b/tests/lib/Memcache/CasTraitTest.php index 2f0ef939aa7..61972153886 100644 --- a/tests/lib/Memcache/CasTraitTest.php +++ b/tests/lib/Memcache/CasTraitTest.php @@ -33,27 +33,27 @@ class CasTraitTest extends TestCase { $mock->expects($this->any()) ->method('set') - ->will($this->returnCallback(function ($key, $value, $ttl) use ($sourceCache) { + ->willReturnCallback(function ($key, $value, $ttl) use ($sourceCache) { return $sourceCache->set($key, $value, $ttl); - })); + }); $mock->expects($this->any()) ->method('get') - ->will($this->returnCallback(function ($key) use ($sourceCache) { + ->willReturnCallback(function ($key) use ($sourceCache) { return $sourceCache->get($key); - })); + }); $mock->expects($this->any()) ->method('add') - ->will($this->returnCallback(function ($key, $value, $ttl) use ($sourceCache) { + ->willReturnCallback(function ($key, $value, $ttl) use ($sourceCache) { return $sourceCache->add($key, $value, $ttl); - })); + }); $mock->expects($this->any()) ->method('remove') - ->will($this->returnCallback(function ($key) use ($sourceCache) { + ->willReturnCallback(function ($key) use ($sourceCache) { return $sourceCache->remove($key); - })); + }); return $mock; } diff --git a/tests/lib/NaturalSortTest.php b/tests/lib/NaturalSortTest.php index 50c2d0be9f0..1408a64dadd 100644 --- a/tests/lib/NaturalSortTest.php +++ b/tests/lib/NaturalSortTest.php @@ -20,7 +20,7 @@ class NaturalSortTest extends \Test\TestCase { return; } $comparator = \OC\NaturalSort::getInstance(); - usort($array, array($comparator, 'compare')); + usort($array, [$comparator, 'compare']); $this->assertEquals($sorted, $array); } @@ -30,7 +30,7 @@ class NaturalSortTest extends \Test\TestCase { public function testDefaultCollatorCompare($array, $sorted) { $comparator = new \OC\NaturalSort(new \OC\NaturalSort_DefaultCollator()); - usort($array, array($comparator, 'compare')); + usort($array, [$comparator, 'compare']); $this->assertEquals($sorted, $array); } @@ -41,28 +41,28 @@ class NaturalSortTest extends \Test\TestCase { */ public function naturalSortDataProvider() { - return array( + return [ // different casing - array( + [ // unsorted - array( + [ 'aaa', 'bbb', 'BBB', 'AAA' - ), + ], // sorted - array( + [ 'aaa', 'AAA', 'bbb', 'BBB' - ) - ), + ] + ], // numbers - array( + [ // unsorted - array( + [ '124.txt', 'abc1', '123.txt', @@ -85,9 +85,9 @@ class NaturalSortTest extends \Test\TestCase { 'zz', '15.txt', '15b.txt', - ), + ], // sorted - array( + [ '15.txt', '15b.txt', '123.txt', @@ -110,12 +110,12 @@ class NaturalSortTest extends \Test\TestCase { 'z', 'za', 'zz', - ) - ), + ] + ], // chinese characters - array( + [ // unsorted - array( + [ '十.txt', '一.txt', '二.txt', @@ -134,9 +134,9 @@ class NaturalSortTest extends \Test\TestCase { '莫.txt', '啊.txt', '123.txt', - ), + ], // sorted - array( + [ '123.txt', 'abc.txt', '一.txt', @@ -155,12 +155,12 @@ class NaturalSortTest extends \Test\TestCase { '波.txt', '破.txt', '莫.txt', - ) - ), + ] + ], // with umlauts - array( + [ // unsorted - array( + [ 'öh.txt', 'Äh.txt', 'oh.txt', @@ -171,9 +171,9 @@ class NaturalSortTest extends \Test\TestCase { 'uh.txt', 'üh.txt', 'äh.txt', - ), + ], // sorted - array( + [ 'ah.txt', 'äh.txt', 'Äh.txt', @@ -184,9 +184,9 @@ class NaturalSortTest extends \Test\TestCase { 'üh.txt', 'Üh.txt', 'Üh 2.txt', - ) - ), - ); + ] + ], + ]; } /** @@ -196,28 +196,28 @@ class NaturalSortTest extends \Test\TestCase { */ public function defaultCollatorDataProvider() { - return array( + return [ // different casing - array( + [ // unsorted - array( + [ 'aaa', 'bbb', 'BBB', 'AAA' - ), + ], // sorted - array( + [ 'aaa', 'AAA', 'bbb', 'BBB' - ) - ), + ] + ], // numbers - array( + [ // unsorted - array( + [ '124.txt', 'abc1', '123.txt', @@ -240,9 +240,9 @@ class NaturalSortTest extends \Test\TestCase { 'zz', '15.txt', '15b.txt', - ), + ], // sorted - array( + [ '15.txt', '15b.txt', '123.txt', @@ -265,8 +265,8 @@ class NaturalSortTest extends \Test\TestCase { 'z', 'za', 'zz', - ) - ), - ); + ] + ], + ]; } } diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php index 6ca83b4b367..a8a94631137 100644 --- a/tests/lib/Notification/ManagerTest.php +++ b/tests/lib/Notification/ManagerTest.php @@ -23,10 +23,8 @@ namespace Test\Notification; use OC\Notification\Manager; use OCP\ILogger; -use OCP\Notification\IApp; use OCP\Notification\IManager; use OCP\Notification\INotification; -use OCP\Notification\INotifier; use OCP\RichObjectStrings\IValidator; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php index 7ee802e54fb..3a78793f91d 100644 --- a/tests/lib/OCS/ProviderTest.php +++ b/tests/lib/OCS/ProviderTest.php @@ -44,22 +44,22 @@ class ProviderTest extends \Test\TestCase { ->expects($this->at(0)) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(1)) ->method('isEnabledForUser') ->with('federation') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(2)) ->method('isEnabledForUser') ->with('activity') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(3)) ->method('isEnabledForUser') ->with('provisioning_api') - ->will($this->returnValue(false)); + ->willReturn(false); $expected = new \OCP\AppFramework\Http\JSONResponse( [ @@ -85,22 +85,22 @@ class ProviderTest extends \Test\TestCase { ->expects($this->at(0)) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(true)); + ->willReturn(true); $this->appManager ->expects($this->at(1)) ->method('isEnabledForUser') ->with('federation') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(2)) ->method('isEnabledForUser') ->with('activity') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(3)) ->method('isEnabledForUser') ->with('provisioning_api') - ->will($this->returnValue(false)); + ->willReturn(false); $expected = new \OCP\AppFramework\Http\JSONResponse( [ @@ -139,22 +139,22 @@ class ProviderTest extends \Test\TestCase { ->expects($this->at(0)) ->method('isEnabledForUser') ->with('files_sharing') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(1)) ->method('isEnabledForUser') ->with('federation') - ->will($this->returnValue(true)); + ->willReturn(true); $this->appManager ->expects($this->at(2)) ->method('isEnabledForUser') ->with('activity') - ->will($this->returnValue(false)); + ->willReturn(false); $this->appManager ->expects($this->at(3)) ->method('isEnabledForUser') ->with('provisioning_api') - ->will($this->returnValue(false)); + ->willReturn(false); $expected = new \OCP\AppFramework\Http\JSONResponse( [ @@ -187,7 +187,7 @@ class ProviderTest extends \Test\TestCase { $this->appManager ->expects($this->any()) ->method('isEnabledForUser') - ->will($this->returnValue(true)); + ->willReturn(true); $expected = new \OCP\AppFramework\Http\JSONResponse( [ diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php index 09c4a16f87a..5536204dd20 100644 --- a/tests/lib/Preview/BackgroundCleanupJobTest.php +++ b/tests/lib/Preview/BackgroundCleanupJobTest.php @@ -25,7 +25,6 @@ namespace Test\Preview; use OC\Files\AppData\Factory; use OC\Preview\BackgroundCleanupJob; use OC\PreviewManager; -use OC\SystemConfig; use OCP\Files\IRootFolder; use OCP\IDBConnection; use Test\Traits\MountProviderTrait; diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index cfb78a05da5..ae84d8eb4b3 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -33,7 +33,6 @@ use OCP\Files\SimpleFS\ISimpleFolder; use OCP\IConfig; use OCP\IImage; use OCP\IPreview; -use OCP\Preview\IProvider; use OCP\Preview\IProviderV2; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; @@ -147,9 +146,9 @@ class GeneratorTest extends \Test\TestCase { ->willReturn($previewFolder); $this->config->method('getSystemValue') - ->will($this->returnCallback(function($key, $defult) { + ->willReturnCallback(function($key, $defult) { return $defult; - })); + }); $invalidProvider = $this->createMock(IProviderV2::class); $invalidProvider->method('isAvailable') @@ -169,7 +168,7 @@ class GeneratorTest extends \Test\TestCase { ]); $this->helper->method('getProvider') - ->will($this->returnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) { + ->willReturnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) { if ($provider === 'wrongProvider') { $this->fail('Wrongprovider should not be constructed!'); } else if ($provider === 'brokenProvider') { @@ -182,7 +181,7 @@ class GeneratorTest extends \Test\TestCase { return $unavailableProvider; } $this->fail('Unexpected provider requested'); - })); + }); $image = $this->createMock(IImage::class); $image->method('width')->willReturn(2048); @@ -191,13 +190,13 @@ class GeneratorTest extends \Test\TestCase { $image->method('dataMimeType')->willReturn('image/png'); $this->helper->method('getThumbnail') - ->will($this->returnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) { + ->willReturnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) { if ($provider === $validProvider) { return $image; } else { return false; } - })); + }); $image->method('data') ->willReturn('my data'); @@ -211,14 +210,14 @@ class GeneratorTest extends \Test\TestCase { $previewFolder->method('getDirectoryListing') ->willReturn([]); $previewFolder->method('newFile') - ->will($this->returnCallback(function($filename) use ($maxPreview, $previewFile) { + ->willReturnCallback(function($filename) use ($maxPreview, $previewFile) { if ($filename === '2048-2048-max.png') { return $maxPreview; } else if ($filename === '256-256.png') { return $previewFile; } $this->fail('Unexpected file'); - })); + }); $maxPreview->expects($this->once()) ->method('putContent') diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php index 1baaf89e0a0..ed25a81ca1f 100644 --- a/tests/lib/Repair/RepairInvalidSharesTest.php +++ b/tests/lib/Repair/RepairInvalidSharesTest.php @@ -40,7 +40,7 @@ class RepairInvalidSharesTest extends TestCase { $config->expects($this->any()) ->method('getSystemValue') ->with('version') - ->will($this->returnValue('12.0.0.0')); + ->willReturn('12.0.0.0'); $this->connection = \OC::$server->getDatabaseConnection(); $this->deleteAllShares(); diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php index 013e170cc9d..d7525a09b18 100644 --- a/tests/lib/Repair/RepairMimeTypesTest.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -46,7 +46,7 @@ class RepairMimeTypesTest extends \Test\TestCase { $config->expects($this->any()) ->method('getSystemValue') ->with('version') - ->will($this->returnValue('11.0.0.0')); + ->willReturn('11.0.0.0'); $this->storage = new \OC\Files\Storage\Temporary([]); diff --git a/tests/lib/Repair/RepairSqliteAutoincrementTest.php b/tests/lib/Repair/RepairSqliteAutoincrementTest.php index c7008179a0d..66b30ca033f 100644 --- a/tests/lib/Repair/RepairSqliteAutoincrementTest.php +++ b/tests/lib/Repair/RepairSqliteAutoincrementTest.php @@ -65,7 +65,7 @@ class RepairSqliteAutoincrementTest extends \Test\TestCase { protected function checkAutoincrement() { $this->connection->executeUpdate('INSERT INTO ' . $this->tableName . ' ("text") VALUES ("test")'); $insertId = $this->connection->lastInsertId(); - $this->connection->executeUpdate('DELETE FROM ' . $this->tableName . ' WHERE "someid" = ?', array($insertId)); + $this->connection->executeUpdate('DELETE FROM ' . $this->tableName . ' WHERE "someid" = ?', [$insertId]); // insert again $this->connection->executeUpdate('INSERT INTO ' . $this->tableName . ' ("text") VALUES ("test2")'); diff --git a/tests/lib/RepairStepTest.php b/tests/lib/RepairStepTest.php index 433a161e8fa..00506e5dba7 100644 --- a/tests/lib/RepairStepTest.php +++ b/tests/lib/RepairStepTest.php @@ -64,10 +64,10 @@ class RepairTest extends TestCase { $this->repair->run(); $this->assertEquals( - array( + [ 'step: Test Name', 'info: Simulated info', - ), + ], $this->outputArray ); } @@ -78,10 +78,10 @@ class RepairTest extends TestCase { $this->repair->run(); $this->assertEquals( - array( + [ 'step: Test Name', 'warning: Simulated warning', - ), + ], $this->outputArray ); } @@ -93,7 +93,7 @@ class RepairTest extends TestCase { ->will($this->throwException(new \Exception())); $mock->expects($this->any()) ->method('getName') - ->will($this->returnValue('Exception Test')); + ->willReturn('Exception Test'); $this->repair->addStep($mock); $this->repair->addStep(new TestRepairStep(false)); @@ -109,9 +109,9 @@ class RepairTest extends TestCase { $this->assertTrue($thrown); // jump out after exception $this->assertEquals( - array( + [ 'step: Exception Test', - ), + ], $this->outputArray ); } @@ -122,12 +122,12 @@ class RepairTest extends TestCase { $this->repair->run(); $this->assertEquals( - array( + [ 'step: Test Name', 'warning: Simulated warning', 'step: Test Name', 'info: Simulated info', - ), + ], $this->outputArray ); } diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php index 048540fb5a5..5e0db3bf24c 100644 --- a/tests/lib/Security/Bruteforce/ThrottlerTest.php +++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php @@ -185,7 +185,7 @@ class ThrottlerTest extends TestCase { ->willReturn($enabled); $this->config->method('getAppValue') - ->will($this->returnCallback(function($app, $key, $default) use ($whitelists) { + ->willReturnCallback(function($app, $key, $default) use ($whitelists) { if ($app !== 'bruteForce') { return $default; } @@ -193,7 +193,7 @@ class ThrottlerTest extends TestCase { return $whitelists[$key]; } return $default; - })); + }); $this->assertSame( ($enabled === false) ? true : $isWhiteListed, diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php index 009613fbe32..c4749513140 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php @@ -25,8 +25,6 @@ namespace Test\Security\CSP; use OC\Security\CSP\ContentSecurityPolicyManager; use OCP\EventDispatcher\IEventDispatcher; use OCP\Security\CSP\AddContentSecurityPolicyEvent; -use PHPUnit\Framework\MockObject\MockObject; -use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Test\TestCase; diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php index 136c3160413..5d8e66bb99b 100644 --- a/tests/lib/Security/CertificateManagerTest.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -8,7 +8,6 @@ namespace Test\Security; -use OC\Files\Storage\Temporary; use OC\Files\View; use OC\Security\CertificateManager; use OCP\IConfig; @@ -79,11 +78,11 @@ class CertificateManagerTest extends \Test\TestCase { function testListCertificates() { // Test empty certificate bundle - $this->assertSame(array(), $this->certificateManager->listCertificates()); + $this->assertSame([], $this->certificateManager->listCertificates()); // Add some certificates $this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate'); - $certificateStore = array(); + $certificateStore = []; $certificateStore[] = new \OC\Security\Certificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate'); $this->assertEqualsArrays($certificateStore, $this->certificateManager->listCertificates()); diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php index 0b93c704b5c..5ebcac7756a 100644 --- a/tests/lib/Security/CredentialsManagerTest.php +++ b/tests/lib/Security/CredentialsManagerTest.php @@ -54,7 +54,7 @@ class CredentialsManagerTest extends \Test\TestCase { $result->expects($this->any()) ->method('fetch') - ->will($this->returnValue($row)); + ->willReturn($row); return $result; } diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php index a2c8055750b..5e079c8018f 100644 --- a/tests/lib/Security/CryptoTest.php +++ b/tests/lib/Security/CryptoTest.php @@ -14,11 +14,11 @@ class CryptoTest extends \Test\TestCase { public function defaultEncryptionProvider() { - return array( - array('Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'), - array(''), - array('我看这本书。 我看這本書') - ); + return [ + ['Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'], + [''], + ['我看这本书。 我看這本書'] + ]; } /** @var Crypto */ diff --git a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php index 179bd6630ba..d2be124a482 100644 --- a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php +++ b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php @@ -24,14 +24,10 @@ declare(strict_types=1); namespace Test\Security\CSP; -use OC\Security\CSP\ContentSecurityPolicyManager; use OC\Security\FeaturePolicy\FeaturePolicyManager; use OCP\AppFramework\Http\FeaturePolicy; use OCP\EventDispatcher\IEventDispatcher; -use OCP\Security\CSP\AddContentSecurityPolicyEvent; use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent; -use PHPUnit\Framework\MockObject\MockObject; -use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Test\TestCase; diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php index aff6d3ed5c7..5f96782bae8 100644 --- a/tests/lib/Security/IdentityProof/ManagerTest.php +++ b/tests/lib/Security/IdentityProof/ManagerTest.php @@ -33,7 +33,6 @@ use OCP\ILogger; use OCP\IUser; use OCP\Security\ICrypto; use PHPUnit\Framework\MockObject\MockObject; -use SebastianBergmann\Comparator\MockObjectComparator; use Test\TestCase; class ManagerTest extends TestCase { diff --git a/tests/lib/Security/RateLimiting/LimiterTest.php b/tests/lib/Security/RateLimiting/LimiterTest.php index 20b35029050..ea74f476f3c 100644 --- a/tests/lib/Security/RateLimiting/LimiterTest.php +++ b/tests/lib/Security/RateLimiting/LimiterTest.php @@ -24,10 +24,7 @@ namespace Test\Security\RateLimiting; use OC\Security\RateLimiting\Backend\IBackend; use OC\Security\RateLimiting\Limiter; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\ICacheFactory; -use OCP\IRequest; use OCP\IUser; -use OCP\IUserSession; use Test\TestCase; class LimiterTest extends TestCase { diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php index 71839115a3c..6898c1d8b0f 100644 --- a/tests/lib/Security/SecureRandomTest.php +++ b/tests/lib/Security/SecureRandomTest.php @@ -13,23 +13,23 @@ use OC\Security\SecureRandom; class SecureRandomTest extends \Test\TestCase { public function stringGenerationProvider() { - return array( - array(0, 0), - array(1, 1), - array(128, 128), - array(256, 256), - array(1024, 1024), - array(2048, 2048), - array(64000, 64000), - ); + return [ + [0, 0], + [1, 1], + [128, 128], + [256, 256], + [1024, 1024], + [2048, 2048], + [64000, 64000], + ]; } public static function charCombinations() { - return array( - array('CHAR_LOWER', '[a-z]'), - array('CHAR_UPPER', '[A-Z]'), - array('CHAR_DIGITS', '[0-9]'), - ); + return [ + ['CHAR_LOWER', '[a-z]'], + ['CHAR_UPPER', '[A-Z]'], + ['CHAR_DIGITS', '[0-9]'], + ]; } /** @var SecureRandom */ diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php index f3ee14dead1..2796dead0e2 100644 --- a/tests/lib/Security/TrustedDomainHelperTest.php +++ b/tests/lib/Security/TrustedDomainHelperTest.php @@ -34,11 +34,11 @@ class TrustedDomainHelperTest extends \Test\TestCase { $this->config->expects($this->at(0)) ->method('getSystemValue') ->with('overwritehost') - ->will($this->returnValue('')); + ->willReturn(''); $this->config->expects($this->at(1)) ->method('getSystemValue') ->with('trusted_domains') - ->will($this->returnValue($trustedDomains)); + ->willReturn($trustedDomains); $trustedDomainHelper = new TrustedDomainHelper($this->config); $this->assertEquals($result, $trustedDomainHelper->isTrustedDomain($testDomain)); @@ -122,7 +122,7 @@ class TrustedDomainHelperTest extends \Test\TestCase { $this->config->expects($this->at(0)) ->method('getSystemValue') ->with('overwritehost') - ->will($this->returnValue('myproxyhost')); + ->willReturn('myproxyhost'); $trustedDomainHelper = new TrustedDomainHelper($this->config); $this->assertTrue($trustedDomainHelper->isTrustedDomain('myproxyhost')); diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index bce547c9a29..a0d341266e8 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -24,7 +24,6 @@ namespace OCA\Settings\Tests\AppInfo; use OC\Settings\Manager; -use OCA\Settings\Admin\Sharing; use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; @@ -96,7 +95,7 @@ class ManagerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->will($this->returnArgument(0)); + ->willReturnArgument(0); $this->assertEquals([], $this->manager->getPersonalSections()); } @@ -195,7 +194,7 @@ class ManagerTest extends TestCase { $this->l10n ->expects($this->any()) ->method('t') - ->will($this->returnArgument(0)); + ->willReturnArgument(0); $this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class); $this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class); diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php index 7ab3eb78539..0890b70dfcd 100644 --- a/tests/lib/SetupTest.php +++ b/tests/lib/SetupTest.php @@ -56,17 +56,17 @@ class SetupTest extends \Test\TestCase { $this->config ->expects($this->once()) ->method('getValue') - ->will($this->returnValue( + ->willReturn( ['sqlite', 'mysql', 'oci'] - )); + ); $this->setupClass ->expects($this->once()) ->method('is_callable') - ->will($this->returnValue(false)); + ->willReturn(false); $this->setupClass ->expects($this->any()) ->method('getAvailableDbDriversForPdo') - ->will($this->returnValue(['sqlite'])); + ->willReturn(['sqlite']); $result = $this->setupClass->getSupportedDatabases(); $expectedResult = [ 'sqlite' => 'SQLite' @@ -79,17 +79,17 @@ class SetupTest extends \Test\TestCase { $this->config ->expects($this->once()) ->method('getValue') - ->will($this->returnValue( + ->willReturn( ['sqlite', 'mysql', 'oci', 'pgsql'] - )); + ); $this->setupClass ->expects($this->any()) ->method('is_callable') - ->will($this->returnValue(false)); + ->willReturn(false); $this->setupClass ->expects($this->any()) ->method('getAvailableDbDriversForPdo') - ->will($this->returnValue([])); + ->willReturn([]); $result = $this->setupClass->getSupportedDatabases(); $this->assertSame([], $result); @@ -99,17 +99,17 @@ class SetupTest extends \Test\TestCase { $this->config ->expects($this->once()) ->method('getValue') - ->will($this->returnValue( + ->willReturn( ['sqlite', 'mysql', 'pgsql', 'oci'] - )); + ); $this->setupClass ->expects($this->any()) ->method('is_callable') - ->will($this->returnValue(true)); + ->willReturn(true); $this->setupClass ->expects($this->any()) ->method('getAvailableDbDriversForPdo') - ->will($this->returnValue(['sqlite', 'mysql', 'pgsql'])); + ->willReturn(['sqlite', 'mysql', 'pgsql']); $result = $this->setupClass->getSupportedDatabases(); $expectedResult = [ 'sqlite' => 'SQLite', @@ -128,7 +128,7 @@ class SetupTest extends \Test\TestCase { $this->config ->expects($this->once()) ->method('getValue') - ->will($this->returnValue('NotAnArray')); + ->willReturn('NotAnArray'); $this->setupClass->getSupportedDatabases(); } @@ -143,7 +143,7 @@ class SetupTest extends \Test\TestCase { $this->config ->expects($this->once()) ->method('getValue') - ->will($this->returnValue($url)); + ->willReturn($url); \OC::$CLI = true; try { diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php index 13a86bfae30..1a443229dff 100644 --- a/tests/lib/Share/Backend.php +++ b/tests/lib/Share/Backend.php @@ -49,7 +49,7 @@ class Backend implements \OCP\Share_Backend { $shares = \OC\Share\Share::getItemsSharedWithUser('test', $shareWith); - $knownTargets = array(); + $knownTargets = []; foreach ($shares as $share) { $knownTargets[] = $share['item_target']; } @@ -73,7 +73,7 @@ class Backend implements \OCP\Share_Backend { } public function formatItems($items, $format, $parameters = null) { - $testItems = array(); + $testItems = []; foreach ($items as $item) { if ($format === self::FORMAT_SOURCE) { $testItems[] = $item['item_source']; diff --git a/tests/lib/Share/HelperTest.php b/tests/lib/Share/HelperTest.php index dc2d26509e3..2056e6bd1e2 100644 --- a/tests/lib/Share/HelperTest.php +++ b/tests/lib/Share/HelperTest.php @@ -28,24 +28,24 @@ namespace Test\Share; class HelperTest extends \Test\TestCase { public function expireDateProvider() { - return array( + return [ // no default expire date, we take the users expire date - array(array('defaultExpireDateSet' => false), 2000000000, 2000010000, 2000010000), + [['defaultExpireDateSet' => false], 2000000000, 2000010000, 2000010000], // no default expire date and no user defined expire date, return false - array(array('defaultExpireDateSet' => false), 2000000000, null, false), + [['defaultExpireDateSet' => false], 2000000000, null, false], // unenforced expire data and no user defined expire date, return false (because the default is not enforced) - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, null, false), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, null, false], // enforced expire date and no user defined expire date, take default expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, null, 2000086400), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, null, 2000086400], // unenforced expire date and user defined date > default expire date, take users expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, 2000100000, 2000100000), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, 2000100000, 2000100000], // unenforced expire date and user expire date < default expire date, take users expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, 2000010000, 2000010000), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, 2000010000, 2000010000], // enforced expire date and user expire date < default expire date, take users expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, 2000010000, 2000010000), + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, 2000010000, 2000010000], // enforced expire date and users expire date > default expire date, take default expire date - array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, 2000100000, 2000086400), - ); + [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, 2000100000, 2000086400], + ]; } /** @@ -101,21 +101,21 @@ class HelperTest extends \Test\TestCase { } public function dataTestSplitUserRemoteError() { - return array( + return [ // Invalid path - array('user@'), + ['user@'], // Invalid user - array('@server'), - array('us/er@server'), - array('us:er@server'), + ['@server'], + ['us/er@server'], + ['us:er@server'], // Invalid splitting - array('user'), - array(''), - array('us/erserver'), - array('us:erserver'), - ); + ['user'], + [''], + ['us/erserver'], + ['us:erserver'], + ]; } /** diff --git a/tests/lib/Share/SearchResultSorterTest.php b/tests/lib/Share/SearchResultSorterTest.php index 7feccdd82f5..17869436428 100644 --- a/tests/lib/Share/SearchResultSorterTest.php +++ b/tests/lib/Share/SearchResultSorterTest.php @@ -26,14 +26,14 @@ class SearchResultSorterTest extends \Test\TestCase { $search = 'lin'; $sorter = new \OC\Share\SearchResultSorter($search, 'foobar'); - $result = array( - array('foobar' => 'woot'), - array('foobar' => 'linux'), - array('foobar' => 'Linus'), - array('foobar' => 'Bicyclerepairwoman'), - ); + $result = [ + ['foobar' => 'woot'], + ['foobar' => 'linux'], + ['foobar' => 'Linus'], + ['foobar' => 'Bicyclerepairwoman'], + ]; - usort($result, array($sorter, 'sort')); + usort($result, [$sorter, 'sort']); $this->assertTrue($result[0]['foobar'] === 'Linus'); $this->assertTrue($result[1]['foobar'] === 'linux'); $this->assertTrue($result[2]['foobar'] === 'Bicyclerepairwoman'); diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php index af05d0c4bdd..c4464efa5dd 100644 --- a/tests/lib/Share/ShareTest.php +++ b/tests/lib/Share/ShareTest.php @@ -23,7 +23,6 @@ namespace Test\Share; use OC\Share\Share; use OCP\IGroup; use OCP\IGroupManager; -use OCP\ILogger; use OCP\IUser; use OCP\IUserManager; @@ -115,7 +114,7 @@ class ShareTest extends \Test\TestCase { protected function tearDown(): void { $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?'); - $query->execute(array('test')); + $query->execute(['test']); \OC::$server->getConfig()->setAppValue('core', 'shareapi_allow_resharing', $this->resharing); $this->user1->delete(); @@ -141,37 +140,37 @@ class ShareTest extends \Test\TestCase { $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' .' `item_type`, `item_source`, `item_target`, `share_type`,' .' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)'); - $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2->getUID(), $this->user1->getUID()); + $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2->getUID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4->getUID(), $this->user1->getUID()); + $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4->getUID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user2->getUID()); + $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user2->getUID()]; $query->execute($args); - $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user4->getUID()); + $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3->getUID(), $this->user4->getUID()]; $query->execute($args); - $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6->getUID(), $this->user4->getUID()); + $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6->getUID(), $this->user4->getUID()]; $query->execute($args); $result1 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user2->getUID(), $this->user1->getUID()); $this->assertSame(1, count($result1)); - $this->verifyResult($result1, array('target1')); + $this->verifyResult($result1, ['target1']); $result2 = \OCP\Share::getItemSharedWithUser('test', 99, null, $this->user1->getUID()); $this->assertSame(2, count($result2)); - $this->verifyResult($result2, array('target1', 'target2')); + $this->verifyResult($result2, ['target1', 'target2']); $result3 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user3->getUID()); $this->assertSame(2, count($result3)); - $this->verifyResult($result3, array('target3', 'target4')); + $this->verifyResult($result3, ['target3', 'target4']); $result4 = \OCP\Share::getItemSharedWithUser('test', 99, null, null); $this->assertSame(5, count($result4)); // 5 because target4 appears twice - $this->verifyResult($result4, array('target1', 'target2', 'target3', 'target4')); + $this->verifyResult($result4, ['target1', 'target2', 'target3', 'target4']); $result6 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user6->getUID(), null); $this->assertSame(1, count($result6)); - $this->verifyResult($result6, array('target4')); + $this->verifyResult($result6, ['target4']); } public function testGetItemSharedWithUserFromGroupShare() { @@ -181,32 +180,32 @@ class ShareTest extends \Test\TestCase { $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' .' `item_type`, `item_source`, `item_target`, `share_type`,' .' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)'); - $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()); + $args = ['test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()); + $args = ['test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2->getGID(), $this->user1->getUID()]; $query->execute($args); - $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()); + $args = ['test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user2->getUID()]; $query->execute($args); - $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()); + $args = ['test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1->getGID(), $this->user4->getUID()]; $query->execute($args); // user2 is in group1 and group2 $result1 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user2->getUID(), $this->user1->getUID()); $this->assertSame(2, count($result1)); - $this->verifyResult($result1, array('target1', 'target2')); + $this->verifyResult($result1, ['target1', 'target2']); $result2 = \OCP\Share::getItemSharedWithUser('test', 99, null, $this->user1->getUID()); $this->assertSame(2, count($result2)); - $this->verifyResult($result2, array('target1', 'target2')); + $this->verifyResult($result2, ['target1', 'target2']); // user3 is in group1 and group2 $result3 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user3->getUID()); $this->assertSame(3, count($result3)); - $this->verifyResult($result3, array('target1', 'target3', 'target4')); + $this->verifyResult($result3, ['target1', 'target3', 'target4']); $result4 = \OCP\Share::getItemSharedWithUser('test', 99, null, null); $this->assertSame(4, count($result4)); - $this->verifyResult($result4, array('target1', 'target2', 'target3', 'target4')); + $this->verifyResult($result4, ['target1', 'target2', 'target3', 'target4']); $result6 = \OCP\Share::getItemSharedWithUser('test', 99, $this->user6->getUID(), null); $this->assertSame(0, count($result6)); @@ -229,16 +228,16 @@ class ShareTest extends \Test\TestCase { */ function testRemoveProtocolFromUrl($url, $expectedResult) { $share = new \OC\Share\Share(); - $result = self::invokePrivate($share, 'removeProtocolFromUrl', array($url)); + $result = self::invokePrivate($share, 'removeProtocolFromUrl', [$url]); $this->assertSame($expectedResult, $result); } function urls() { - return array( - array('http://owncloud.org', 'owncloud.org'), - array('https://owncloud.org', 'owncloud.org'), - array('owncloud.org', 'owncloud.org'), - ); + return [ + ['http://owncloud.org', 'owncloud.org'], + ['https://owncloud.org', 'owncloud.org'], + ['owncloud.org', 'owncloud.org'], + ]; } /** @@ -265,57 +264,57 @@ class ShareTest extends \Test\TestCase { } function dataProviderTestGroupItems() { - return array( + return [ // one array with one share - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1')), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1'))), + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1']], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_ALL, 'item_target' => 't1']]], // two shares both point to the same source - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', - 'grouped' => array( - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ) - ), - ) - ), + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', + 'grouped' => [ + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ] + ], + ] + ], // two shares both point to the same source but with different targets - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'), - ), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'), - ) - ), + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'], + ], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't2'], + ] + ], // three shares two point to the same source - array( - array( // input - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ), - array( // expected result - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', - 'grouped' => array( - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'), - array('item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'), - ) - ), - array('item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'), - ) - ), - ); + [ + [ // input + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ], + [ // expected result + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1', + 'grouped' => [ + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_READ, 'item_target' => 't1'], + ['item_source' => 1, 'permissions' => \OCP\Constants::PERMISSION_UPDATE, 'item_target' => 't1'], + ] + ], + ['item_source' => 2, 'permissions' => \OCP\Constants::PERMISSION_CREATE, 'item_target' => 't2'], + ] + ], + ]; } } diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php index ff3cafbdf7c..396f0cbad84 100644 --- a/tests/lib/Share20/DefaultShareProviderTest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -179,9 +179,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap([ + ->willReturnMap([ ['shareOwner', $shareOwnerFolder], - ])); + ]); $share = $this->provider->getShareById($id); @@ -301,9 +301,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap([ + ->willReturnMap([ ['shareOwner', $shareOwnerFolder], - ])); + ]); $share = $this->provider->getShareById($id); @@ -334,13 +334,13 @@ class DefaultShareProviderTest extends \Test\TestCase { $node = $this->createMock(Folder::class); $node->method('getId')->willReturn(42); - $this->rootFolder->method('getUserFolder')->with('user0')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user0')->willReturnSelf(); $this->rootFolder->method('getById')->willReturn([$node]); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user0', $user0], ['user1', $user1], - ])); + ]); $this->groupManager->method('get')->with('group0')->willReturn($group0); $share = $this->provider->getShareById($id, 'user1'); @@ -384,9 +384,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap([ + ->willReturnMap([ ['shareOwner', $shareOwnerFolder], - ])); + ]); $share = $this->provider->getShareById($id); @@ -599,9 +599,9 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap([ + ->willReturnMap([ ['shareOwner', $ownerFolder], - ])); + ]); $share = $this->createMock(IShare::class); $share->method('getId')->willReturn($id); @@ -647,10 +647,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $userFolder = $this->createMock(Folder::class); $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap([ + ->willReturnMap([ ['sharedBy', $userFolder], ['shareOwner', $ownerFolder], - ])); + ]); $userFolder->method('getById') ->with(100) @@ -703,10 +703,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $userFolder = $this->createMock(Folder::class); $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap([ + ->willReturnMap([ ['sharedBy', $userFolder], ['shareOwner', $ownerFolder], - ])); + ]); $userFolder->method('getById') ->with(100) @@ -760,10 +760,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $userFolder = $this->createMock(Folder::class); $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap([ + ->willReturnMap([ ['sharedBy', $userFolder], ['shareOwner', $ownerFolder], - ])); + ]); $userFolder->method('getById') ->with(100) @@ -822,7 +822,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $file = $this->createMock(File::class); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with(42)->willReturn([$file]); $share = $this->provider->getShareByToken('secrettoken'); @@ -913,7 +913,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals(1, $qb->execute()); $file = $this->createMock(File::class); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); $share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_USER, null, 1 , 0); @@ -990,7 +990,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->groupManager->method('get')->with('sharedWith')->willReturn($group); $file = $this->createMock(File::class); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); $share = $this->provider->getSharedWith('sharedWith', \OCP\Share::SHARE_TYPE_GROUP, null, 20 , 1); @@ -1081,7 +1081,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->groupManager->method('get')->with('sharedWith')->willReturn($group); $file = $this->createMock(File::class); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId)->willReturn([$file]); $share = $this->provider->getSharedWith('user', \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0); @@ -1124,7 +1124,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getId')->willReturn($fileId2); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId2)->willReturn([$file]); $share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_USER, $file, -1, 0); @@ -1169,7 +1169,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $node = $this->createMock(Folder::class); $node->method('getId')->willReturn($fileId2); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with($fileId2)->willReturn([$node]); $share = $this->provider->getSharedWith('user0', \OCP\Share::SHARE_TYPE_GROUP, $node, -1, 0); @@ -1220,7 +1220,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals(1, $qb->execute()); $file = $this->createMock(File::class); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with($deletedFileId)->willReturn([$file]); $groups = []; @@ -1285,7 +1285,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->assertEquals(1, $qb->execute()); $file = $this->createMock(File::class); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with(42)->willReturn([$file]); $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, null, false, 1, 0); @@ -1335,7 +1335,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getId')->willReturn(42); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with(42)->willReturn([$file]); $share = $this->provider->getSharesBy('sharedBy', \OCP\Share::SHARE_TYPE_USER, $file, false, 1, 0); @@ -1385,7 +1385,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getId')->willReturn(42); - $this->rootFolder->method('getUserFolder')->with('shareOwner')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('shareOwner')->willReturnSelf(); $this->rootFolder->method('getById')->with(42)->willReturn([$file]); $shares = $this->provider->getSharesBy('shareOwner', \OCP\Share::SHARE_TYPE_USER, null, true, -1, 0); @@ -1431,10 +1431,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $user1->method('getUID')->willReturn('user1'); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user1', $user1], ['user2', $user2], - ])); + ]); $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'); @@ -1444,7 +1444,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with(1)->willReturn([$file]); $share = $this->provider->getShareById($id); @@ -1502,10 +1502,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $user1->method('getUID')->willReturn('user1'); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user1', $user1], ['user2', $user2], - ])); + ]); $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'); @@ -1515,7 +1515,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with(1)->willReturn([$file]); $share = $this->provider->getShareById($id); @@ -1562,10 +1562,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $user1->method('getUID')->willReturn('user1'); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user1', $user1], ['user2', $user2], - ])); + ]); $group = $this->createMock(IGroup::class); $group->method('getGID')->willReturn('group'); @@ -1575,7 +1575,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with(1)->willReturn([$file]); $share = $this->provider->getShareById($id); @@ -1607,17 +1607,17 @@ class DefaultShareProviderTest extends \Test\TestCase { $user1->method('getUID')->willReturn('user1'); $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user1', $user1], ['user2', $user2], - ])); + ]); $this->groupManager->method('get')->with('group')->willReturn(null); $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with(1)->willReturn([$file]); $share = $this->provider->getShareById($id); @@ -1647,15 +1647,15 @@ class DefaultShareProviderTest extends \Test\TestCase { $user2 = $this->createMock(IUser::class); $user2->method('getUID')->willReturn('user2'); $user2->method('getDisplayName')->willReturn('user2'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user1', $user1], ['user2', $user2], - ])); + ]); $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with(1)->willReturn([$file]); $share = $this->provider->getShareById($id); @@ -1701,15 +1701,15 @@ class DefaultShareProviderTest extends \Test\TestCase { $user2->method('getUID')->willReturn('user2'); $user2->method('getDisplayName')->willReturn('user2'); $user3 = $this->createMock(IUser::class); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user1', $user1], ['user2', $user2], - ])); + ]); $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with(1)->willReturn([$file]); $share = $this->provider->getShareById($id); @@ -1739,14 +1739,14 @@ class DefaultShareProviderTest extends \Test\TestCase { $user1 = $this->createMock(IUser::class); $user1->method('getUID')->willReturn('user1'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user1', $user1], - ])); + ]); $file = $this->createMock(File::class); $file->method('getId')->willReturn(1); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->with(1)->willReturn([$file]); $share = $this->provider->getShareById($id); @@ -1766,10 +1766,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $users['user'.$i] = $user; } - $this->userManager->method('get')->will( - $this->returnCallback(function($userId) use ($users) { + $this->userManager->method('get')->willReturnCallback( + function($userId) use ($users) { return $users[$userId]; - }) + } ); $file1 = $this->createMock(File::class); @@ -1782,10 +1782,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $folder2 = $this->createMock(Folder::class); $folder2->method('getById')->with(43)->willReturn([$file2]); - $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([ + $this->rootFolder->method('getUserFolder')->willReturnMap([ ['user2', $folder1], ['user5', $folder2], - ])); + ]); $share = $this->provider->getShareById($id); @@ -1823,10 +1823,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $users['user'.$i] = $user; } - $this->userManager->method('get')->will( - $this->returnCallback(function($userId) use ($users) { + $this->userManager->method('get')->willReturnCallback( + function($userId) use ($users) { return $users[$userId]; - }) + } ); $file1 = $this->createMock(File::class); @@ -1839,10 +1839,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $folder2 = $this->createMock(Folder::class); $folder2->method('getById')->with(43)->willReturn([$file2]); - $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([ + $this->rootFolder->method('getUserFolder')->willReturnMap([ ['user2', $folder1], ['user5', $folder2], - ])); + ]); $share = $this->provider->getShareById($id); @@ -1889,10 +1889,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $users['user'.$i] = $user; } - $this->userManager->method('get')->will( - $this->returnCallback(function($userId) use ($users) { + $this->userManager->method('get')->willReturnCallback( + function($userId) use ($users) { return $users[$userId]; - }) + } ); $file1 = $this->createMock(File::class); @@ -1905,10 +1905,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $folder2 = $this->createMock(Folder::class); $folder2->method('getById')->with(43)->willReturn([$file2]); - $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([ + $this->rootFolder->method('getUserFolder')->willReturnMap([ ['user2', $folder1], ['user5', $folder2], - ])); + ]); $share = $this->provider->getShareById($id); @@ -1946,10 +1946,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $users['user'.$i] = $user; } - $this->userManager->method('get')->will( - $this->returnCallback(function($userId) use ($users) { + $this->userManager->method('get')->willReturnCallback( + function($userId) use ($users) { return $users[$userId]; - }) + } ); $groups = []; @@ -1959,10 +1959,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $groups['group'.$i] = $group; } - $this->groupManager->method('get')->will( - $this->returnCallback(function($groupId) use ($groups) { + $this->groupManager->method('get')->willReturnCallback( + function($groupId) use ($groups) { return $groups[$groupId]; - }) + } ); $file1 = $this->createMock(File::class); @@ -1975,10 +1975,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $folder2 = $this->createMock(Folder::class); $folder2->method('getById')->with(43)->willReturn([$file2]); - $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([ + $this->rootFolder->method('getUserFolder')->willReturnMap([ ['user2', $folder1], ['user5', $folder2], - ])); + ]); $share = $this->provider->getShareById($id); @@ -2024,10 +2024,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $users['user'.$i] = $user; } - $this->userManager->method('get')->will( - $this->returnCallback(function($userId) use ($users) { + $this->userManager->method('get')->willReturnCallback( + function($userId) use ($users) { return $users[$userId]; - }) + } ); $groups = []; @@ -2037,10 +2037,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $groups['group'.$i] = $group; } - $this->groupManager->method('get')->will( - $this->returnCallback(function($groupId) use ($groups) { + $this->groupManager->method('get')->willReturnCallback( + function($groupId) use ($groups) { return $groups[$groupId]; - }) + } ); $file1 = $this->createMock(File::class); @@ -2053,10 +2053,10 @@ class DefaultShareProviderTest extends \Test\TestCase { $folder2 = $this->createMock(Folder::class); $folder2->method('getById')->with(43)->willReturn([$file2]); - $this->rootFolder->method('getUserFolder')->will($this->returnValueMap([ + $this->rootFolder->method('getUserFolder')->willReturnMap([ ['user2', $folder1], ['user5', $folder2], - ])); + ]); $share = $this->provider->getShareById($id); @@ -2118,15 +2118,15 @@ class DefaultShareProviderTest extends \Test\TestCase { $user1->method('getUID')->willReturn('user1'); $user1->method('getDisplayName')->willReturn('user1'); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user0', $user0], ['user1', $user1], - ])); + ]); $file = $this->createMock(File::class); $file->method('getId')->willReturn(42); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->willReturn([$file]); $share = $this->provider->getShareById($id, null); @@ -2153,15 +2153,15 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->groupManager->method('get')->with('group0')->willReturn($group0); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['user0', $user0], ['user1', $user1], - ])); + ]); $folder = $this->createMock(Folder::class); $folder->method('getId')->willReturn(42); - $this->rootFolder->method('getUserFolder')->with('user1')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('user1')->willReturnSelf(); $this->rootFolder->method('getById')->willReturn([$folder]); $share = $this->provider->getShareById($id, 'user0'); @@ -2845,7 +2845,7 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->rootFolder ->method('getUserFolder') - ->will($this->returnValueMap( + ->willReturnMap( [ ['shareOwner1', $shareOwner1Folder], ['shareOwner2', $shareOwner2Folder], @@ -2853,7 +2853,7 @@ class DefaultShareProviderTest extends \Test\TestCase { ['shareOwner4', $shareOwner4Folder], ['shareOwner5', $shareOwner5Folder], ] - )); + ); $shares = iterator_to_array($this->provider->getAllShares()); $this->assertEquals(4, count($shares)); diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php index 14fe32323c1..2b062e592ba 100644 --- a/tests/lib/Share20/LegacyHooksTest.php +++ b/tests/lib/Share20/LegacyHooksTest.php @@ -281,10 +281,10 @@ class LegacyHooksTest extends TestCase { ->expects($this->exactly(1)) ->method('preShare') ->with($expected) - ->will($this->returnCallback(function ($data) { + ->willReturnCallback(function ($data) { $data['run'] = false; $data['error'] = 'I error'; - })); + }); $event = new GenericEvent($share); $this->eventDispatcher->dispatch('OCP\Share::preShare', $event); diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index 314038fe13b..e46e019c6ed 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -123,9 +123,9 @@ class ManagerTest extends \Test\TestCase { $this->l10nFactory = $this->createMock(IFactory::class); $this->l = $this->createMock(IL10N::class); $this->l->method('t') - ->will($this->returnCallback(function($text, $parameters = []) { + ->willReturnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); - })); + }); $this->factory = new DummyFactory(\OC::$server); @@ -334,11 +334,11 @@ class ManagerTest extends \Test\TestCase { $this->defaultProvider ->method('getChildren') - ->will($this->returnValueMap([ + ->willReturnMap([ [$share1, [$share2]], [$share2, [$share3]], [$share3, []], - ])); + ]); $this->defaultProvider ->method('delete') @@ -423,12 +423,12 @@ class ManagerTest extends \Test\TestCase { $this->defaultProvider ->expects($this->exactly(4)) ->method('getChildren') - ->will($this->returnCallback(function($_share) use ($share, $shares) { + ->willReturnCallback(function($_share) use ($share, $shares) { if ($_share === $share) { return $shares; } return []; - })); + }); $this->defaultProvider ->expects($this->exactly(3)) @@ -483,26 +483,26 @@ class ManagerTest extends \Test\TestCase { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Passwords are enforced for link shares'); - $this->config->method('getAppValue')->will($this->returnValueMap([ + $this->config->method('getAppValue')->willReturnMap([ ['core', 'shareapi_enforce_links_password', 'no', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'verifyPassword', [null]); } public function testVerifyPasswordNull() { - $this->config->method('getAppValue')->will($this->returnValueMap([ + $this->config->method('getAppValue')->willReturnMap([ ['core', 'shareapi_enforce_links_password', 'no', 'no'], - ])); + ]); $result = self::invokePrivate($this->manager, 'verifyPassword', [null]); $this->assertNull($result); } public function testVerifyPasswordHook() { - $this->config->method('getAppValue')->will($this->returnValueMap([ + $this->config->method('getAppValue')->willReturnMap([ ['core', 'shareapi_enforce_links_password', 'no', 'no'], - ])); + ]); $this->eventDispatcher->expects($this->once())->method('dispatch') ->willReturnCallback(function(Event $event) { @@ -521,9 +521,9 @@ class ManagerTest extends \Test\TestCase { $this->expectException(\Exception::class); $this->expectExceptionMessage('password not accepted'); - $this->config->method('getAppValue')->will($this->returnValueMap([ + $this->config->method('getAppValue')->willReturnMap([ ['core', 'shareapi_enforce_links_password', 'no', 'no'], - ])); + ]); $this->eventDispatcher->expects($this->once())->method('dispatch') ->willReturnCallback(function(Event $event) { @@ -697,14 +697,14 @@ class ManagerTest extends \Test\TestCase { public function testGeneralChecks($share, $exceptionMessage, $exception) { $thrown = null; - $this->userManager->method('userExists')->will($this->returnValueMap([ + $this->userManager->method('userExists')->willReturnMap([ ['user0', true], ['user1', true], - ])); + ]); - $this->groupManager->method('groupExists')->will($this->returnValueMap([ + $this->groupManager->method('groupExists')->willReturnMap([ ['group0', true], - ])); + ]); $userFolder = $this->createMock(Folder::class); $userFolder->method('getPath')->willReturn('myrootfolder'); @@ -735,10 +735,10 @@ class ManagerTest extends \Test\TestCase { $thrown = null; - $this->userManager->method('userExists')->will($this->returnValueMap([ + $this->userManager->method('userExists')->willReturnMap([ ['user0', true], ['user1', true], - ])); + ]); $userFolder = $this->createMock(Folder::class); $userFolder->method('isSubNode')->with($userFolder)->willReturn(false); @@ -779,10 +779,10 @@ class ManagerTest extends \Test\TestCase { $share->setProviderId('foo')->setId('bar'); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_default_expire_date', 'no', 'yes'], ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'validateExpirationDate', [$share]); } @@ -792,9 +792,9 @@ class ManagerTest extends \Test\TestCase { $share->setProviderId('foo')->setId('bar'); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'validateExpirationDate', [$share]); @@ -805,11 +805,11 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], ['core', 'shareapi_expire_after_n_days', '7', '3'], ['core', 'shareapi_default_expire_date', 'no', 'yes'], - ])); + ]); $expected = new \DateTime(); $expected->setTime(0,0,0); @@ -830,10 +830,10 @@ class ManagerTest extends \Test\TestCase { $share->setExpirationDate($future); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], ['core', 'shareapi_expire_after_n_days', '7', '3'], - ])); + ]); try { self::invokePrivate($this->manager, 'validateExpirationDate', [$share]); @@ -858,10 +858,10 @@ class ManagerTest extends \Test\TestCase { $share->setExpirationDate($future); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], ['core', 'shareapi_expire_after_n_days', '7', '3'], - ])); + ]); $hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock(); \OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener'); @@ -921,10 +921,10 @@ class ManagerTest extends \Test\TestCase { $share->setExpirationDate($future); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_default_expire_date', 'no', 'yes'], ['core', 'shareapi_expire_after_n_days', '7', '3'], - ])); + ]); $hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock(); \OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener'); @@ -946,9 +946,9 @@ class ManagerTest extends \Test\TestCase { $hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock(); \OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener'); - $hookListner->expects($this->once())->method('listener')->will($this->returnCallback(function ($data) { + $hookListner->expects($this->once())->method('listener')->willReturnCallback(function ($data) { $data['expirationDate']->sub(new \DateInterval('P2D')); - })); + }); $share = $this->manager->newShare(); $share->setExpirationDate($nextWeek); @@ -973,10 +973,10 @@ class ManagerTest extends \Test\TestCase { $hookListner = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock(); \OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListner, 'listener'); - $hookListner->expects($this->once())->method('listener')->will($this->returnCallback(function ($data) { + $hookListner->expects($this->once())->method('listener')->willReturnCallback(function ($data) { $data['accepted'] = false; $data['message'] = 'Invalid date!'; - })); + }); self::invokePrivate($this->manager, 'validateExpirationDate', [$share]); } @@ -987,10 +987,10 @@ class ManagerTest extends \Test\TestCase { $share->setId('42')->setProviderId('foo'); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_default_expire_date', 'no', 'yes'], ['core', 'shareapi_expire_after_n_days', '7', '6'], - ])); + ]); self::invokePrivate($this->manager, 'validateExpirationDate', [$share]); @@ -1010,23 +1010,23 @@ class ManagerTest extends \Test\TestCase { $this->groupManager ->method('getUserGroupIds') - ->will( - $this->returnValueMap([ + ->willReturnMap( + [ [$sharedBy, ['group1']], [$sharedWith, ['group2']], - ]) + ] ); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['sharedBy', $sharedBy], ['sharedWith', $sharedWith], - ])); + ]); $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'userCreateChecks', [$share]); } @@ -1043,23 +1043,23 @@ class ManagerTest extends \Test\TestCase { $this->groupManager ->method('getUserGroupIds') - ->will( - $this->returnValueMap([ + ->willReturnMap( + [ [$sharedBy, ['group1', 'group3']], [$sharedWith, ['group2', 'group3']], - ]) + ] ); - $this->userManager->method('get')->will($this->returnValueMap([ + $this->userManager->method('get')->willReturnMap([ ['sharedBy', $sharedBy], ['sharedWith', $sharedWith], - ])); + ]); $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], - ])); + ]); $this->defaultProvider ->method('getSharesByPath') @@ -1215,9 +1215,9 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_group_sharing', 'yes', 'no'], - ])); + ]); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); } @@ -1240,10 +1240,10 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); } @@ -1263,10 +1263,10 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], - ])); + ]); $this->assertNull($this->invokePrivate($this->manager, 'groupCreateChecks', [$share])); } @@ -1292,10 +1292,10 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_only_share_with_group_members', 'no', 'yes'], ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); $this->addToAssertionCount(1); @@ -1325,9 +1325,9 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); } @@ -1349,9 +1349,9 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_group_sharing', 'yes', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); $this->addToAssertionCount(1); @@ -1366,9 +1366,9 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_links', 'yes', 'no'], - ])); + ]); self::invokePrivate($this->manager, 'linkCreateChecks', [$share]); } @@ -1384,9 +1384,9 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_links', 'yes', 'yes'], - ])); + ]); self::invokePrivate($this->manager, 'linkCreateChecks', [$share]); } @@ -1402,10 +1402,10 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_upload', 'yes', 'no'] - ])); + ]); self::invokePrivate($this->manager, 'linkCreateChecks', [$share]); } @@ -1417,10 +1417,10 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_upload', 'yes', 'yes'] - ])); + ]); self::invokePrivate($this->manager, 'linkCreateChecks', [$share]); $this->addToAssertionCount(1); @@ -1433,10 +1433,10 @@ class ManagerTest extends \Test\TestCase { $this->config ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_upload', 'yes', 'no'] - ])); + ]); self::invokePrivate($this->manager, 'linkCreateChecks', [$share]); $this->addToAssertionCount(1); @@ -1525,10 +1525,10 @@ class ManagerTest extends \Test\TestCase { $user = $this->createMock(IUser::class); $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_exclude_groups', 'no', $excludeGroups], ['core', 'shareapi_exclude_groups_list', '', $groupList], - ])); + ]); if ($setList !== null) { $this->config->expects($this->once()) @@ -1573,9 +1573,9 @@ class ManagerTest extends \Test\TestCase { */ public function testCanShare($expected, $sharingEnabled, $disabledForUser) { $this->config->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_enabled', 'yes', $sharingEnabled], - ])); + ]); $manager = $this->createManagerMock() ->setMethods(['sharingDisabledForUser']) @@ -1639,7 +1639,7 @@ class ManagerTest extends \Test\TestCase { ->expects($this->once()) ->method('create') ->with($share) - ->will($this->returnArgument(0)); + ->willReturnArgument(0); $share->expects($this->once()) ->method('setShareOwner') @@ -1692,7 +1692,7 @@ class ManagerTest extends \Test\TestCase { ->expects($this->once()) ->method('create') ->with($share) - ->will($this->returnArgument(0)); + ->willReturnArgument(0); $share->expects($this->once()) ->method('setShareOwner') @@ -1773,9 +1773,9 @@ class ManagerTest extends \Test\TestCase { ->expects($this->once()) ->method('create') ->with($share) - ->will($this->returnCallback(function(Share $share) { + ->willReturnCallback(function(Share $share) { return $share->setId(42); - })); + }); // Pre share $this->eventDispatcher->expects($this->at(0)) @@ -1882,9 +1882,9 @@ class ManagerTest extends \Test\TestCase { ->expects($this->once()) ->method('create') ->with($share) - ->will($this->returnCallback(function(Share $share) { + ->willReturnCallback(function(Share $share) { return $share->setId(42); - })); + }); // Pre share $this->eventDispatcher->expects($this->at(0)) @@ -1993,10 +1993,10 @@ class ManagerTest extends \Test\TestCase { ->with( $this->equalTo('OCP\Share::preShare'), $this->isInstanceOf(GenericEvent::class) - )->will($this->returnCallback(function($name, GenericEvent $e) { + )->willReturnCallback(function($name, GenericEvent $e) { $e->setArgument('error', 'I won\'t let you share!'); $e->stopPropagation(); - }) + } ); $manager->createShare($share); @@ -2062,7 +2062,7 @@ class ManagerTest extends \Test\TestCase { ->expects($this->once()) ->method('create') ->with($share) - ->will($this->returnArgument(0)); + ->willReturnArgument(0); $share->expects($this->once()) ->method('setShareOwner') @@ -2145,22 +2145,22 @@ class ManagerTest extends \Test\TestCase { */ $this->defaultProvider ->method('getSharesBy') - ->will($this->returnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) { + ->willReturnCallback(function($uid, $type, $node, $reshares, $limit, $offset) use (&$shares2) { return array_slice($shares2, $offset, $limit); - })); + }); /* * Simulate the deleteShare call. */ $manager->method('deleteShare') - ->will($this->returnCallback(function($share) use (&$shares2) { + ->willReturnCallback(function($share) use (&$shares2) { for($i = 0; $i < count($shares2); $i++) { if ($shares2[$i]->getId() === $share->getId()) { array_splice($shares2, $i, 1); break; } } - })); + }); $res = $manager->getSharesBy('user', \OCP\Share::SHARE_TYPE_LINK, $node, true, 3, 0); @@ -2255,13 +2255,13 @@ class ManagerTest extends \Test\TestCase { $factory->expects($this->any()) ->method('getProviderForType') - ->will($this->returnCallback(function($shareType) use ($roomShareProvider) { + ->willReturnCallback(function($shareType) use ($roomShareProvider) { if ($shareType !== \OCP\Share::SHARE_TYPE_ROOM) { throw new Exception\ProviderException(); } return $roomShareProvider; - })); + }); $roomShareProvider->expects($this->once()) ->method('getShareByToken') @@ -2409,9 +2409,9 @@ class ManagerTest extends \Test\TestCase { $this->config ->expects($this->at(1)) ->method('getAppValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['core', 'shareapi_allow_public_upload', 'yes', 'no'], - ])); + ]); $this->defaultProvider->expects($this->once()) ->method('getShareByToken') @@ -2464,11 +2464,11 @@ class ManagerTest extends \Test\TestCase { ->setPassword('passwordHash'); $this->hasher->method('verify')->with('password', 'passwordHash', '') - ->will($this->returnCallback(function($pass, $hash, &$newHash) { + ->willReturnCallback(function($pass, $hash, &$newHash) { $newHash = 'newHash'; return true; - })); + }); $this->defaultProvider->expects($this->once()) ->method('update') @@ -2607,7 +2607,7 @@ class ManagerTest extends \Test\TestCase { \OCP\Util::connectHook('OCP\Share', 'post_set_expiration_date', $hookListner, 'post'); $hookListner->expects($this->never())->method('post'); - $this->rootFolder->method('getUserFolder')->with('newUser')->will($this->returnSelf()); + $this->rootFolder->method('getUserFolder')->with('newUser')->willReturnSelf(); $this->rootFolder->method('getRelativePath')->with('/newUser/files/myPath')->willReturn('/myPath'); $hookListner2 = $this->getMockBuilder('Dummy')->setMethods(['post'])->getMock(); @@ -3294,7 +3294,7 @@ class ManagerTest extends \Test\TestCase { $share->setSharedWith('recipient'); - $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0)); + $this->defaultProvider->method('move')->with($share, 'recipient')->willReturnArgument(0); $this->manager->moveShare($share, 'recipient'); $this->addToAssertionCount(1); @@ -3352,7 +3352,7 @@ class ManagerTest extends \Test\TestCase { $this->groupManager->method('get')->with('group')->willReturn($group); $this->userManager->method('get')->with('recipient')->willReturn($recipient); - $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0)); + $this->defaultProvider->method('move')->with($share, 'recipient')->willReturnArgument(0); $this->manager->moveShare($share, 'recipient'); $this->addToAssertionCount(1); diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index a5a54fce09f..552e1627629 100644 --- a/tests/lib/SystemTag/SystemTagManagerTest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -15,7 +15,6 @@ use OC\SystemTag\SystemTagObjectMapper; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IUser; -use OCP\IUserManager; use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -439,13 +438,13 @@ class SystemTagManagerTest extends TestCase { $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('test')); + ->willReturn('test'); $tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable); $this->groupManager->expects($this->any()) ->method('isAdmin') ->with('test') - ->will($this->returnValue($isAdmin)); + ->willReturn($isAdmin); $this->assertEquals($expectedResult, $this->tagManager->canUserSeeTag($tag1, $user)); } @@ -486,18 +485,18 @@ class SystemTagManagerTest extends TestCase { $user = $this->getMockBuilder(IUser::class)->getMock(); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('test')); + ->willReturn('test'); $tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable); $this->tagManager->setTagGroups($tag1, $tagGroupIds); $this->groupManager->expects($this->any()) ->method('isAdmin') ->with('test') - ->will($this->returnValue($isAdmin)); + ->willReturn($isAdmin); $this->groupManager->expects($this->any()) ->method('getUserGroupIds') ->with($user) - ->will($this->returnValue($userGroupIds)); + ->willReturn($userGroupIds); $this->assertEquals($expectedResult, $this->tagManager->canUserAssignTag($tag1, $user)); } diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php index f0e535b0f67..986686dc93e 100644 --- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php +++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php @@ -88,7 +88,7 @@ class SystemTagObjectMapperTest extends TestCase { $this->tagManager->expects($this->any()) ->method('getTagsByIds') - ->will($this->returnCallback(function($tagIds) { + ->willReturnCallback(function($tagIds) { $result = []; if (in_array(1, $tagIds)) { $result[1] = $this->tag1; @@ -100,7 +100,7 @@ class SystemTagObjectMapperTest extends TestCase { $result[3] = $this->tag3; } return $result; - })); + }); $this->tagMapper->assignTags('1', 'testtype', $this->tag1->getId()); $this->tagMapper->assignTags('1', 'testtype', $this->tag2->getId()); diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php index db0a77f68f0..463ec5809dd 100644 --- a/tests/lib/TagsTest.php +++ b/tests/lib/TagsTest.php @@ -36,7 +36,7 @@ class TagsTest extends \Test\TestCase { protected $user; /** @var \OCP\IUserSession */ protected $userSession; - protected $backupGlobals = FALSE; + protected $backupGlobals = false; /** @var \OC\Tagging\TagMapper */ protected $tagMapper; /** @var \OCP\ITagManager */ @@ -57,7 +57,7 @@ class TagsTest extends \Test\TestCase { $this->userSession ->expects($this->any()) ->method('getUser') - ->will($this->returnValue($this->user)); + ->willReturn($this->user); $this->objectType = $this->getUniqueID('type_'); $this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection()); @@ -78,13 +78,13 @@ class TagsTest extends \Test\TestCase { $this->userSession ->expects($this->any()) ->method('getUser') - ->will($this->returnValue(null)); + ->willReturn(null); $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession); $this->assertNull($this->tagMgr->load($this->objectType)); } public function testInstantiateWithDefaults() { - $defaultTags = array('Friends', 'Family', 'Work', 'Other'); + $defaultTags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); @@ -92,7 +92,7 @@ class TagsTest extends \Test\TestCase { } public function testAddTags() { - $tags = array('Friends', 'Family', 'Work', 'Other'); + $tags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType); @@ -109,7 +109,7 @@ class TagsTest extends \Test\TestCase { } public function testAddMultiple() { - $tags = array('Friends', 'Family', 'Work', 'Other'); + $tags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType); @@ -169,37 +169,37 @@ class TagsTest extends \Test\TestCase { } public function testGetTagsForObjects() { - $defaultTags = array('Friends', 'Family', 'Work', 'Other'); + $defaultTags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $tagger->tagAs(1, 'Friends'); $tagger->tagAs(1, 'Other'); $tagger->tagAs(2, 'Family'); - $tags = $tagger->getTagsForObjects(array(1)); + $tags = $tagger->getTagsForObjects([1]); $this->assertEquals(1, count($tags)); $tags = current($tags); sort($tags); - $this->assertSame(array('Friends', 'Other'), $tags); + $this->assertSame(['Friends', 'Other'], $tags); - $tags = $tagger->getTagsForObjects(array(1, 2)); + $tags = $tagger->getTagsForObjects([1, 2]); $this->assertEquals(2, count($tags)); $tags1 = $tags[1]; sort($tags1); - $this->assertSame(array('Friends', 'Other'), $tags1); - $this->assertSame(array('Family'), $tags[2]); + $this->assertSame(['Friends', 'Other'], $tags1); + $this->assertSame(['Family'], $tags[2]); $this->assertEquals( - array(), - $tagger->getTagsForObjects(array(4)) + [], + $tagger->getTagsForObjects([4]) ); $this->assertEquals( - array(), - $tagger->getTagsForObjects(array(4, 5)) + [], + $tagger->getTagsForObjects([4, 5]) ); } public function testGetTagsForObjectsMassiveResults() { - $defaultTags = array('tag1'); + $defaultTags = ['tag1']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $tagData = $tagger->getTags(); $tagId = $tagData[0]['id']; @@ -213,9 +213,9 @@ class TagsTest extends \Test\TestCase { ); // insert lots of entries - $idsArray = array(); + $idsArray = []; for($i = 1; $i <= 1500; $i++) { - $statement->execute(array($i, $tagId, $tagType)); + $statement->execute([$i, $tagId, $tagType]); $idsArray[] = $i; } @@ -224,7 +224,7 @@ class TagsTest extends \Test\TestCase { } public function testDeleteTags() { - $defaultTags = array('Friends', 'Family', 'Work', 'Other'); + $defaultTags = ['Friends', 'Family', 'Work', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $this->assertEquals(4, count($tagger->getTags())); @@ -232,12 +232,12 @@ class TagsTest extends \Test\TestCase { $tagger->delete('family'); $this->assertEquals(3, count($tagger->getTags())); - $tagger->delete(array('Friends', 'Work', 'Other')); + $tagger->delete(['Friends', 'Work', 'Other']); $this->assertEquals(0, count($tagger->getTags())); } public function testRenameTag() { - $defaultTags = array('Friends', 'Family', 'Wrok', 'Other'); + $defaultTags = ['Friends', 'Family', 'Wrok', 'Other']; $tagger = $this->tagMgr->load($this->objectType, $defaultTags); $this->assertTrue($tagger->rename('Wrok', 'Work')); @@ -248,7 +248,7 @@ class TagsTest extends \Test\TestCase { } public function testTagAs() { - $objids = array(1, 2, 3, 4, 5, 6, 7, 8, 9); + $objids = [1, 2, 3, 4, 5, 6, 7, 8, 9]; $tagger = $this->tagMgr->load($this->objectType); @@ -264,7 +264,7 @@ class TagsTest extends \Test\TestCase { * @depends testTagAs */ public function testUnTag() { - $objIds = array(1, 2, 3, 4, 5, 6, 7, 8, 9); + $objIds = [1, 2, 3, 4, 5, 6, 7, 8, 9]; // Is this "legal"? $this->testTagAs(); @@ -283,9 +283,9 @@ class TagsTest extends \Test\TestCase { public function testFavorite() { $tagger = $this->tagMgr->load($this->objectType); $this->assertTrue($tagger->addToFavorites(1)); - $this->assertEquals(array(1), $tagger->getFavorites()); + $this->assertEquals([1], $tagger->getFavorites()); $this->assertTrue($tagger->removeFromFavorites(1)); - $this->assertEquals(array(), $tagger->getFavorites()); + $this->assertEquals([], $tagger->getFavorites()); } public function testShareTags() { @@ -318,7 +318,7 @@ class TagsTest extends \Test\TestCase { \OC\Share\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ); \OC_User::setUserId($otherUserId); - $otherTagger = $otherTagMgr->load('test', array(), true); // Update tags, load shared ones. + $otherTagger = $otherTagMgr->load('test', [], true); // Update tags, load shared ones. $this->assertTrue($otherTagger->hasTag($testTag)); $this->assertContains(1, $otherTagger->getIdsForTag($testTag)); } diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php index 6262bd5a00a..f43573c1e3a 100644 --- a/tests/lib/TempManagerTest.php +++ b/tests/lib/TempManagerTest.php @@ -17,7 +17,7 @@ class NullLogger extends Log { //disable original constructor } - public function log(int $level, string $message, array $context = array()) { + public function log(int $level, string $message, array $context = []) { //noop } } 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..bd7a175862a 100644 --- a/tests/lib/Template/IconsCacherTest.php +++ b/tests/lib/Template/IconsCacherTest.php @@ -27,16 +27,10 @@ namespace Test\Template; use OC\Files\AppData\AppData; use OC\Files\AppData\Factory; use OC\Template\IconsCacher; -use OC_App; -use OCA\Theming\ThemingDefaults; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\IAppData; -use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; -use OCP\ICache; -use OCP\ICacheFactory; -use OCP\IConfig; use OCP\ILogger; use OCP\IURLGenerator; @@ -90,9 +84,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/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php index b12124ea5a9..1e8ba5f6a2c 100644 --- a/tests/lib/Template/JSCombinerTest.php +++ b/tests/lib/Template/JSCombinerTest.php @@ -23,7 +23,6 @@ namespace Test\Template; -use function foo\func; use OC\SystemConfig; use OC\Template\JSCombiner; use OCP\Files\IAppData; @@ -121,7 +120,7 @@ class JSCombinerTest extends \Test\TestCase { $fileDeps = $this->createMock(ISimpleFile::class); $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file, $gzfile) { + ->willReturnCallback(function($path) use ($file, $gzfile) { if ($path === 'combine.js') { return $file; } else if ($path === 'combine.js.deps') { @@ -130,7 +129,7 @@ class JSCombinerTest extends \Test\TestCase { return $gzfile; } $this->fail(); - })); + }); $folder->expects($this->once()) ->method('newFile') ->with('combine.js.deps') @@ -158,7 +157,7 @@ class JSCombinerTest extends \Test\TestCase { $gzfile = $this->createMock(ISimpleFile::class); $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file, $gzfile) { + ->willReturnCallback(function($path) use ($file, $gzfile) { if ($path === 'combine.js') { return $file; } else if ($path === 'combine.js.deps') { @@ -167,7 +166,7 @@ class JSCombinerTest extends \Test\TestCase { return $gzfile; } $this->fail(); - })); + }); $folder->expects($this->once()) ->method('newFile') ->with('combine.js.deps') @@ -201,7 +200,7 @@ class JSCombinerTest extends \Test\TestCase { ->willReturn(true); $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file, $fileDeps) { + ->willReturnCallback(function($path) use ($file, $fileDeps) { if ($path === 'combine.js') { return $file; } @@ -211,7 +210,7 @@ class JSCombinerTest extends \Test\TestCase { } $this->fail(); - })); + }); $actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp'); $this->assertTrue($actual); @@ -246,12 +245,12 @@ class JSCombinerTest extends \Test\TestCase { ->willReturn('{}'); $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file) { + ->willReturnCallback(function($path) use ($file) { if ($path === 'combine.js') { return $file; } $this->fail(); - })); + }); $actual = $this->jsCombiner->process(__DIR__, '/data/combine.json', 'awesomeapp'); $this->assertTrue($actual); @@ -263,7 +262,7 @@ class JSCombinerTest extends \Test\TestCase { $file = $this->createMock(ISimpleFile::class); $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file) { + ->willReturnCallback(function($path) use ($file) { if ($path === 'combine.js') { return $file; } @@ -271,7 +270,7 @@ class JSCombinerTest extends \Test\TestCase { throw new NotFoundException(); } $this->fail(); - })); + }); $actual = self::invokePrivate($this->jsCombiner, 'isCached', [$fileName, $folder]); $this->assertFalse($actual); @@ -345,7 +344,7 @@ class JSCombinerTest extends \Test\TestCase { $folder->method('getFile')->willThrowException(new NotFoundException()); - $folder->method('newFile')->will($this->returnCallback( + $folder->method('newFile')->willReturnCallback( function ($filename) use ($file, $depsFile, $gzFile) { if ($filename === 'combine.js') { return $file; @@ -356,7 +355,7 @@ class JSCombinerTest extends \Test\TestCase { } $this->fail(); } - )); + ); $file->expects($this->once())->method('putContent'); $depsFile->expects($this->once())->method('putContent'); @@ -376,7 +375,7 @@ class JSCombinerTest extends \Test\TestCase { $path = __DIR__ . '/data/'; - $folder->method('getFile')->will($this->returnCallback( + $folder->method('getFile')->willReturnCallback( function ($filename) use ($file, $depsFile, $gzFile) { if ($filename === 'combine.js') { return $file; @@ -387,7 +386,7 @@ class JSCombinerTest extends \Test\TestCase { } $this->fail(); } - )); + ); $file->expects($this->once())->method('putContent'); $depsFile->expects($this->once())->method('putContent'); @@ -444,7 +443,7 @@ var b = \'world\'; $path = __DIR__ . '/data/'; - $folder->method('getFile')->will($this->returnCallback( + $folder->method('getFile')->willReturnCallback( function ($filename) use ($file, $depsFile, $gzFile) { if ($filename === 'combine.js') { return $file; @@ -455,7 +454,7 @@ var b = \'world\'; } $this->fail(); } - )); + ); $file->expects($this->at(0)) ->method('putContent') 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 6f9fdf1e7fb..fda899e51b2 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -27,7 +27,6 @@ use OC\Files\AppData\AppData; use OC\Files\AppData\Factory; use OC\Template\IconsCacher; use OC\Template\SCSSCacher; -use OC_App; use OCA\Theming\ThemingDefaults; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\IAppData; @@ -121,7 +120,7 @@ class SCSSCacherTest extends \Test\TestCase { substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) { + ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) { if ($path === $filePrefix.'styles.css') { return $file; } else if ($path === $filePrefix.'styles.css.deps') { @@ -131,7 +130,7 @@ class SCSSCacherTest extends \Test\TestCase { } else { $this->fail(); } - })); + }); $folder->expects($this->once()) ->method('newFile') ->with($filePrefix.'styles.css.deps') @@ -161,7 +160,7 @@ class SCSSCacherTest extends \Test\TestCase { substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) { + ->willReturnCallback(function($path) use ($file, $gzfile, $filePrefix) { if ($path === $filePrefix.'styles.css') { return $file; } else if ($path === $filePrefix.'styles.css.deps') { @@ -171,7 +170,7 @@ class SCSSCacherTest extends \Test\TestCase { }else { $this->fail(); } - })); + }); $folder->expects($this->once()) ->method('newFile') ->with($filePrefix.'styles.css.deps') @@ -197,7 +196,7 @@ class SCSSCacherTest extends \Test\TestCase { substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { + ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { if ($name === $filePrefix.'styles.css') { return $file; } else if ($name === $filePrefix.'styles.css.deps') { @@ -206,7 +205,7 @@ class SCSSCacherTest extends \Test\TestCase { return $gzFile; } $this->fail(); - })); + }); $this->iconsCacher->expects($this->any()) ->method('setIconsCss') @@ -235,7 +234,7 @@ class SCSSCacherTest extends \Test\TestCase { $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' . substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') - ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { + ->willReturnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { if ($name === $filePrefix.'styles.css') { return $file; } else if ($name === $filePrefix.'styles.css.deps') { @@ -244,7 +243,7 @@ class SCSSCacherTest extends \Test\TestCase { return $gzFile; } $this->fail(); - })); + }); $this->iconsCacher->expects($this->any()) ->method('setIconsCss') @@ -273,7 +272,7 @@ class SCSSCacherTest extends \Test\TestCase { $file->expects($this->once())->method('getSize')->willReturn(1); $folder->method('getFile') - ->will($this->returnCallback(function($path) use ($file) { + ->willReturnCallback(function($path) use ($file) { if ($path === 'styles.css') { return $file; } else if ($path === 'styles.css.deps') { @@ -281,7 +280,7 @@ class SCSSCacherTest extends \Test\TestCase { } else { $this->fail(); } - })); + }); $this->appData->expects($this->any()) ->method('getFolder') @@ -301,7 +300,7 @@ class SCSSCacherTest extends \Test\TestCase { $path = \OC::$SERVERROOT . '/core/css/'; $folder->method('getFile')->willThrowException(new NotFoundException()); - $folder->method('newFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { + $folder->method('newFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles.css') { return $file; } else if ($fileName === 'styles.css.deps') { @@ -310,7 +309,7 @@ class SCSSCacherTest extends \Test\TestCase { return $gzipFile; } throw new \Exception(); - })); + }); $this->iconsCacher->expects($this->any()) ->method('setIconsCss') @@ -335,7 +334,7 @@ class SCSSCacherTest extends \Test\TestCase { $webDir = "core/css"; $path = \OC::$SERVERROOT; - $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { + $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles.css') { return $file; } else if ($fileName === 'styles.css.deps') { @@ -344,7 +343,7 @@ class SCSSCacherTest extends \Test\TestCase { return $gzipFile; } throw new \Exception(); - })); + }); $file->expects($this->once())->method('putContent'); $depsFile->expects($this->once())->method('putContent'); @@ -369,7 +368,7 @@ class SCSSCacherTest extends \Test\TestCase { $webDir = "tests/data/scss"; $path = \OC::$SERVERROOT . $webDir; - $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { + $folder->method('getFile')->willReturnCallback(function($fileName) use ($file, $depsFile, $gzipFile) { if ($fileName === 'styles-success.css') { return $file; } else if ($fileName === 'styles-success.css.deps') { @@ -378,7 +377,7 @@ class SCSSCacherTest extends \Test\TestCase { return $gzipFile; } throw new \Exception(); - })); + }); $this->iconsCacher->expects($this->at(0)) ->method('setIconsCss') @@ -471,7 +470,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); diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php index b80e720efd3..be4a7ade787 100644 --- a/tests/lib/TestCase.php +++ b/tests/lib/TestCase.php @@ -194,7 +194,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * @param array $parameters * @return mixed */ - protected static function invokePrivate($object, $methodName, array $parameters = array()) { + protected static function invokePrivate($object, $methodName, array $parameters = []) { if (is_string($object)) { $className = $object; } else { @@ -297,14 +297,14 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { * @param string $dataDir */ static protected function tearDownAfterClassCleanStrayDataFiles($dataDir) { - $knownEntries = array( + $knownEntries = [ 'nextcloud.log' => true, 'audit.log' => true, 'owncloud.db' => true, '.ocdata' => true, '..' => true, '.' => true, - ); + ]; if ($dh = opendir($dataDir)) { while (($file = readdir($dh)) !== false) { @@ -479,9 +479,9 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase { $l10n ->expects($this->any()) ->method('t') - ->will($this->returnCallback(function($text, $parameters = array()) { + ->willReturnCallback(function($text, $parameters = []) { return vsprintf($text, $parameters); - })); + }); $t = new Base($template, $requestToken, $l10n, $theme); $buf = $t->fetchPage($vars); diff --git a/tests/lib/Traits/EncryptionTrait.php b/tests/lib/Traits/EncryptionTrait.php index ad98ba91212..8799ce72fd0 100644 --- a/tests/lib/Traits/EncryptionTrait.php +++ b/tests/lib/Traits/EncryptionTrait.php @@ -75,7 +75,7 @@ trait EncryptionTrait { \OC::$server->getLogger() ); - $this->registerStorageWrapper('oc_encryption', array($encryptionWrapper, 'wrapStorage')); + $this->registerStorageWrapper('oc_encryption', [$encryptionWrapper, 'wrapStorage']); } protected function setUpEncryptionTrait() { diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php index b25557d5569..2f139319bbf 100644 --- a/tests/lib/Updater/VersionCheckTest.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -74,12 +74,12 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue(time())); + ->willReturn(time()); $this->config ->expects($this->at(2)) ->method('getAppValue') ->with('core', 'lastupdateResult') - ->will($this->returnValue(json_encode($expectedResult))); + ->willReturn(json_encode($expectedResult)); $this->assertSame($expectedResult, $this->updater->check()); } @@ -104,7 +104,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue(0)); + ->willReturn(0); $this->config ->expects($this->at(2)) ->method('getSystemValue') @@ -118,12 +118,12 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'installedat') - ->will($this->returnValue('installedat')); + ->willReturn('installedat'); $this->config ->expects($this->at(6)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue('lastupdatedat')); + ->willReturn('lastupdatedat'); $this->config ->expects($this->at(7)) ->method('setAppValue') @@ -142,7 +142,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->once()) ->method('getUrlContent') ->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/')) - ->will($this->returnValue($updateXml)); + ->willReturn($updateXml); $this->assertSame($expectedResult, $this->updater->check()); } @@ -157,7 +157,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue(0)); + ->willReturn(0); $this->config ->expects($this->at(2)) ->method('getSystemValue') @@ -171,12 +171,12 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'installedat') - ->will($this->returnValue('installedat')); + ->willReturn('installedat'); $this->config ->expects($this->at(6)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue('lastupdatedat')); + ->willReturn('lastupdatedat'); $this->config ->expects($this->at(7)) ->method('setAppValue') @@ -187,7 +187,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->once()) ->method('getUrlContent') ->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/')) - ->will($this->returnValue($updateXml)); + ->willReturn($updateXml); $this->assertSame([], $this->updater->check()); } @@ -212,7 +212,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue(0)); + ->willReturn(0); $this->config ->expects($this->at(2)) ->method('getSystemValue') @@ -226,12 +226,12 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'installedat') - ->will($this->returnValue('installedat')); + ->willReturn('installedat'); $this->config ->expects($this->at(6)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue('lastupdatedat')); + ->willReturn('lastupdatedat'); $updateXml = '<?xml version="1.0"?> <owncloud> @@ -245,7 +245,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->once()) ->method('getUrlContent') ->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/')) - ->will($this->returnValue($updateXml)); + ->willReturn($updateXml); $this->assertSame($expectedResult, $this->updater->check()); } @@ -262,7 +262,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue(0)); + ->willReturn(0); $this->config ->expects($this->at(2)) ->method('getSystemValue') @@ -276,12 +276,12 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'installedat') - ->will($this->returnValue('installedat')); + ->willReturn('installedat'); $this->config ->expects($this->at(6)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue('lastupdatedat')); + ->willReturn('lastupdatedat'); $this->config ->expects($this->at(7)) ->method('setAppValue') @@ -292,7 +292,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->once()) ->method('getUrlContent') ->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/')) - ->will($this->returnValue($updateXml)); + ->willReturn($updateXml); $this->assertSame($expectedResult, $this->updater->check()); } @@ -317,7 +317,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue(0)); + ->willReturn(0); $this->config ->expects($this->at(2)) ->method('getSystemValue') @@ -331,12 +331,12 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->at(5)) ->method('getAppValue') ->with('core', 'installedat') - ->will($this->returnValue('installedat')); + ->willReturn('installedat'); $this->config ->expects($this->at(6)) ->method('getAppValue') ->with('core', 'lastupdatedat') - ->will($this->returnValue('lastupdatedat')); + ->willReturn('lastupdatedat'); // missing autoupdater element should still not fail $updateXml = '<?xml version="1.0"?> @@ -350,7 +350,7 @@ class VersionCheckTest extends \Test\TestCase { ->expects($this->once()) ->method('getUrlContent') ->with($this->buildUpdateUrl('https://updates.nextcloud.com/updater_server/')) - ->will($this->returnValue($updateXml)); + ->willReturn($updateXml); $this->assertSame($expectedResult, $this->updater->check()); } diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php index 40197101fd6..3d53301b325 100644 --- a/tests/lib/User/ManagerTest.php +++ b/tests/lib/User/ManagerTest.php @@ -60,7 +60,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); @@ -76,7 +76,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)); + ->willReturn(false); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); @@ -98,7 +98,7 @@ class ManagerTest extends TestCase { $backend1->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)); + ->willReturn(false); /** * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2 @@ -107,7 +107,7 @@ class ManagerTest extends TestCase { $backend2->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend1); @@ -124,7 +124,7 @@ class ManagerTest extends TestCase { $backend1->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)); + ->willReturn(true); /** * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2 @@ -148,17 +148,17 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('checkPassword') ->with($this->equalTo('foo'), $this->equalTo('bar')) - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\USER\BACKEND::CHECK_PASSWORD) { return true; } else { return false; } - })); + }); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); @@ -177,7 +177,7 @@ class ManagerTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(false)); + ->willReturn(false); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); @@ -193,7 +193,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->never()) ->method('loginName2UserName'); @@ -211,7 +211,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)); + ->willReturn(false); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); @@ -227,7 +227,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('userExists') ->with($this->equalTo('bLeNdEr')) - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->never()) ->method('loginName2UserName'); @@ -245,7 +245,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('getUsers') ->with($this->equalTo('fo')) - ->will($this->returnValue(array('foo', 'afoo', 'Afoo1', 'Bfoo'))); + ->willReturn(['foo', 'afoo', 'Afoo1', 'Bfoo']); $backend->expects($this->never()) ->method('loginName2UserName'); @@ -268,7 +268,7 @@ class ManagerTest extends TestCase { $backend1->expects($this->once()) ->method('getUsers') ->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1)) - ->will($this->returnValue(array('foo1', 'foo2'))); + ->willReturn(['foo1', 'foo2']); $backend1->expects($this->never()) ->method('loginName2UserName'); @@ -279,7 +279,7 @@ class ManagerTest extends TestCase { $backend2->expects($this->once()) ->method('getUsers') ->with($this->equalTo('fo'), $this->equalTo(3), $this->equalTo(1)) - ->will($this->returnValue(array('foo3'))); + ->willReturn(['foo3']); $backend2->expects($this->never()) ->method('loginName2UserName'); @@ -351,7 +351,7 @@ class ManagerTest extends TestCase { $backend = $this->createMock(\Test\Util\User\Dummy::class); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('createUser') @@ -360,7 +360,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)); + ->willReturn(false); $backend->expects($this->never()) ->method('loginName2UserName'); @@ -381,7 +381,7 @@ class ManagerTest extends TestCase { $backend = $this->createMock(\Test\Util\User\Dummy::class); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->never()) ->method('createUser'); @@ -389,7 +389,7 @@ class ManagerTest extends TestCase { $backend->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); @@ -404,7 +404,7 @@ class ManagerTest extends TestCase { $backend = $this->createMock(\Test\Util\User\Dummy::class); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(false)); + ->willReturn(false); $backend->expects($this->never()) ->method('createUser'); @@ -453,7 +453,7 @@ class ManagerTest extends TestCase { $backend1 = $this->createMock(\Test\Util\User\Dummy::class); $backend1->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend1->expects($this->never()) ->method('createUser'); @@ -461,7 +461,7 @@ class ManagerTest extends TestCase { $backend1->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)); + ->willReturn(false); /** * @var \Test\Util\User\Dummy | \PHPUnit_Framework_MockObject_MockObject $backend2 @@ -469,7 +469,7 @@ class ManagerTest extends TestCase { $backend2 = $this->createMock(\Test\Util\User\Dummy::class); $backend2->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(true)); + ->willReturn(true); $backend2->expects($this->never()) ->method('createUser'); @@ -477,7 +477,7 @@ class ManagerTest extends TestCase { $backend2->expects($this->once()) ->method('userExists') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend1); @@ -501,16 +501,16 @@ class ManagerTest extends TestCase { $backend = $this->createMock(\Test\Util\User\Dummy::class); $backend->expects($this->once()) ->method('countUsers') - ->will($this->returnValue(7)); + ->willReturn(7); $backend->expects($this->once()) ->method('implementsActions') ->with(\OC\USER\BACKEND::COUNT_USERS) - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->once()) ->method('getBackendName') - ->will($this->returnValue('Mock_Test_Util_User_Dummy')); + ->willReturn('Mock_Test_Util_User_Dummy'); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); @@ -530,28 +530,28 @@ class ManagerTest extends TestCase { $backend1 = $this->createMock(\Test\Util\User\Dummy::class); $backend1->expects($this->once()) ->method('countUsers') - ->will($this->returnValue(7)); + ->willReturn(7); $backend1->expects($this->once()) ->method('implementsActions') ->with(\OC\USER\BACKEND::COUNT_USERS) - ->will($this->returnValue(true)); + ->willReturn(true); $backend1->expects($this->once()) ->method('getBackendName') - ->will($this->returnValue('Mock_Test_Util_User_Dummy')); + ->willReturn('Mock_Test_Util_User_Dummy'); $backend2 = $this->createMock(\Test\Util\User\Dummy::class); $backend2->expects($this->once()) ->method('countUsers') - ->will($this->returnValue(16)); + ->willReturn(16); $backend2->expects($this->once()) ->method('implementsActions') ->with(\OC\USER\BACKEND::COUNT_USERS) - ->will($this->returnValue(true)); + ->willReturn(true); $backend2->expects($this->once()) ->method('getBackendName') - ->will($this->returnValue('Mock_Test_Util_User_Dummy')); + ->willReturn('Mock_Test_Util_User_Dummy'); $manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend1); @@ -672,21 +672,21 @@ class ManagerTest extends TestCase { ->expects($this->at(0)) ->method('getUsersForUserValueCaseInsensitive') ->with('settings', 'email', 'test@example.com') - ->will($this->returnValue(['uid1', 'uid99', 'uid2'])); + ->willReturn(['uid1', 'uid99', 'uid2']); $backend = $this->createMock(\Test\Util\User\Dummy::class); $backend->expects($this->at(0)) ->method('userExists') ->with($this->equalTo('uid1')) - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->at(1)) ->method('userExists') ->with($this->equalTo('uid99')) - ->will($this->returnValue(false)); + ->willReturn(false); $backend->expects($this->at(2)) ->method('userExists') ->with($this->equalTo('uid2')) - ->will($this->returnValue(true)); + ->willReturn(true); $manager = new \OC\User\Manager($config, $this->oldDispatcher, $this->eventDispatcher); $manager->registerBackend($backend); diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index e7df7578c7d..f7aba189603 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -67,7 +67,7 @@ class SessionTest extends \Test\TestCase { $this->timeFactory = $this->createMock(ITimeFactory::class); $this->timeFactory->expects($this->any()) ->method('getTime') - ->will($this->returnValue(10000)); + ->willReturn(10000); $this->tokenProvider = $this->createMock(IProvider::class); $this->config = $this->createMock(IConfig::class); $this->throttler = $this->createMock(Throttler::class); @@ -105,12 +105,12 @@ class SessionTest extends \Test\TestCase { $expectedUser = $this->createMock(IUser::class); $expectedUser->expects($this->any()) ->method('getUID') - ->will($this->returnValue('user123')); + ->willReturn('user123'); $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock(); $session->expects($this->at(0)) ->method('get') ->with('user_id') - ->will($this->returnValue($expectedUser->getUID())); + ->willReturn($expectedUser->getUID()); $sessionId = 'abcdef12345'; $manager = $this->getMockBuilder('\OC\User\Manager') @@ -119,25 +119,25 @@ class SessionTest extends \Test\TestCase { $session->expects($this->at(1)) ->method('get') ->with('app_password') - ->will($this->returnValue(null)); // No password set -> browser session + ->willReturn(null); // No password set -> browser session $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $this->tokenProvider->expects($this->once()) ->method('getToken') ->with($sessionId) - ->will($this->returnValue($token)); + ->willReturn($token); $this->tokenProvider->expects($this->once()) ->method('getPassword') ->with($token, $sessionId) - ->will($this->returnValue('passme')); + ->willReturn('passme'); $manager->expects($this->once()) ->method('checkPassword') ->with('User123', 'passme') - ->will($this->returnValue(true)); + ->willReturn(true); $expectedUser->expects($this->once()) ->method('isEnabled') - ->will($this->returnValue(true)); + ->willReturn(true); $this->tokenProvider->expects($this->once()) ->method('updateTokenActivity') @@ -146,7 +146,7 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with($expectedUser->getUID()) - ->will($this->returnValue($expectedUser)); + ->willReturn($expectedUser); $userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher); $user = $userSession->getUser(); @@ -178,7 +178,7 @@ class SessionTest extends \Test\TestCase { $user = new User('sepp', null, $this->createMock(EventDispatcherInterface::class)); $userSession->expects($this->once()) ->method('getUser') - ->will($this->returnValue($isLoggedIn ? $user : null)); + ->willReturn($isLoggedIn ? $user : null); $this->assertEquals($isLoggedIn, $userSession->isLoggedIn()); } @@ -195,7 +195,7 @@ class SessionTest extends \Test\TestCase { $user = $this->createMock(IUser::class); $user->expects($this->once()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher); $userSession->setUser($user); @@ -240,17 +240,17 @@ class SessionTest extends \Test\TestCase { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('isEnabled') - ->will($this->returnValue(true)); + ->willReturn(true); $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $user->expects($this->once()) ->method('updateLastLoginTimestamp'); $manager->expects($this->once()) ->method('checkPasswordNoLogging') ->with('foo', 'bar') - ->will($this->returnValue($user)); + ->willReturn($user); $userSession = $this->getMockBuilder(Session::class) ->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher]) @@ -304,14 +304,14 @@ class SessionTest extends \Test\TestCase { $user = $this->createMock(IUser::class); $user->expects($this->any()) ->method('isEnabled') - ->will($this->returnValue(false)); + ->willReturn(false); $user->expects($this->never()) ->method('updateLastLoginTimestamp'); $manager->expects($this->once()) ->method('checkPasswordNoLogging') ->with('foo', 'bar') - ->will($this->returnValue($user)); + ->willReturn($user); $this->dispatcher->expects($this->never()) ->method('dispatch'); @@ -355,7 +355,7 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('checkPasswordNoLogging') ->with('foo', 'bar') - ->will($this->returnValue(false)); + ->willReturn(false); $this->dispatcher->expects($this->never()) ->method('dispatch'); @@ -380,7 +380,7 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('checkPasswordNoLogging') ->with('foo', 'bar') - ->will($this->returnValue(false)); + ->willReturn(false); $userSession->login('foo', 'bar'); } @@ -404,12 +404,12 @@ class SessionTest extends \Test\TestCase { $this->tokenProvider->expects($this->once()) ->method('getToken') ->with('bar') - ->will($this->returnValue($token)); + ->willReturn($token); $manager->expects($this->once()) ->method('checkPasswordNoLogging') ->with('foo', 'bar') - ->will($this->returnValue(false)); + ->willReturn(false); $userSession->login('foo', 'bar'); } @@ -435,7 +435,7 @@ class SessionTest extends \Test\TestCase { $this->config->expects($this->once()) ->method('getSystemValue') ->with('token_auth_enforced', false) - ->will($this->returnValue(true)); + ->willReturn(true); $request ->expects($this->any()) ->method('getRemoteAddress') @@ -471,7 +471,7 @@ class SessionTest extends \Test\TestCase { $this->config->expects($this->once()) ->method('getSystemValue') ->with('token_auth_enforced', false) - ->will($this->returnValue(false)); + ->willReturn(false); $manager->method('getByEmail') ->with('unexist') ->willReturn([]); @@ -492,11 +492,11 @@ class SessionTest extends \Test\TestCase { $userSession->expects($this->once()) ->method('isTokenPassword') - ->will($this->returnValue(true)); + ->willReturn(true); $userSession->expects($this->once()) ->method('login') ->with('john', 'I-AM-AN-APP-PASSWORD') - ->will($this->returnValue(true)); + ->willReturn(true); $session->expects($this->once()) ->method('set') @@ -539,12 +539,12 @@ class SessionTest extends \Test\TestCase { $this->config->expects($this->once()) ->method('getSystemValue') ->with('token_auth_enforced', false) - ->will($this->returnValue(false)); + ->willReturn(false); $userSession->expects($this->once()) ->method('isTwoFactorEnforced') ->with('john') - ->will($this->returnValue(true)); + ->willReturn(true); $request ->expects($this->any()) @@ -592,18 +592,18 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($user)); + ->willReturn($user); $this->config->expects($this->once()) ->method('getUserKeys') ->with('foo', 'login_token') - ->will($this->returnValue([$token])); + ->willReturn([$token]); $this->config->expects($this->once()) ->method('deleteUserValue') ->with('foo', 'login_token', $token); $this->random->expects($this->once()) ->method('generate') ->with(32) - ->will($this->returnValue('abcdefg123456')); + ->willReturn('abcdefg123456'); $this->config->expects($this->once()) ->method('setUserValue') ->with('foo', 'login_token', 'abcdefg123456', 10000); @@ -617,7 +617,7 @@ class SessionTest extends \Test\TestCase { $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $this->tokenProvider->expects($this->once()) ->method('renewSessionToken') ->with($oldSessionId, $sessionId) @@ -628,7 +628,7 @@ class SessionTest extends \Test\TestCase { $user->expects($this->any()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $userSession->expects($this->once()) ->method('setMagicInCookie'); $user->expects($this->once()) @@ -636,11 +636,11 @@ class SessionTest extends \Test\TestCase { $setUID = false; $session ->method('set') - ->will($this->returnCallback(function ($k, $v) use (&$setUID) { + ->willReturnCallback(function ($k, $v) use (&$setUID) { if ($k === 'user_id' && $v === 'foo') { $setUID = true; } - })); + }); $userSession->expects($this->once()) ->method('setLoginName') ->willReturn('foobar'); @@ -681,11 +681,11 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($user)); + ->willReturn($user); $this->config->expects($this->once()) ->method('getUserKeys') ->with('foo', 'login_token') - ->will($this->returnValue([$token])); + ->willReturn([$token]); $this->config->expects($this->once()) ->method('deleteUserValue') ->with('foo', 'login_token', $token); @@ -694,7 +694,7 @@ class SessionTest extends \Test\TestCase { $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $this->tokenProvider->expects($this->once()) ->method('renewSessionToken') ->with($oldSessionId, $sessionId) @@ -702,7 +702,7 @@ class SessionTest extends \Test\TestCase { $user->expects($this->never()) ->method('getUID') - ->will($this->returnValue('foo')); + ->willReturn('foo'); $userSession->expects($this->never()) ->method('setMagicInCookie'); $user->expects($this->never()) @@ -744,11 +744,11 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue($user)); + ->willReturn($user); $this->config->expects($this->once()) ->method('getUserKeys') ->with('foo', 'login_token') - ->will($this->returnValue(['anothertoken'])); + ->willReturn(['anothertoken']); $this->config->expects($this->never()) ->method('deleteUserValue') ->with('foo', 'login_token', $token); @@ -794,11 +794,11 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with('foo') - ->will($this->returnValue(null)); + ->willReturn(null); $this->config->expects($this->never()) ->method('getUserKeys') ->with('foo', 'login_token') - ->will($this->returnValue(['anothertoken'])); + ->willReturn(['anothertoken']); $this->tokenProvider->expects($this->never()) ->method('renewSessionToken'); @@ -814,10 +814,10 @@ class SessionTest extends \Test\TestCase { } public function testActiveUserAfterSetSession() { - $users = array( + $users = [ 'foo' => new User('foo', null, $this->createMock(EventDispatcherInterface::class)), 'bar' => new User('bar', null, $this->createMock(EventDispatcherInterface::class)) - ); + ]; $manager = $this->getMockBuilder('\OC\User\Manager') ->disableOriginalConstructor() @@ -825,9 +825,9 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->any()) ->method('get') - ->will($this->returnCallback(function ($uid) use ($users) { + ->willReturnCallback(function ($uid) use ($users) { return $users[$uid]; - })); + }); $session = new Memory(''); $session->set('user_id', 'foo'); @@ -873,10 +873,10 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with($uid) - ->will($this->returnValue($user)); + ->willReturn($user); $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $this->tokenProvider->expects($this->once()) ->method('getToken') ->with($password) @@ -914,10 +914,10 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with($uid) - ->will($this->returnValue($user)); + ->willReturn($user); $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $this->tokenProvider->expects($this->once()) ->method('getToken') ->with($password) @@ -959,18 +959,18 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with($uid) - ->will($this->returnValue($user)); + ->willReturn($user); $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $this->tokenProvider->expects($this->once()) ->method('getToken') ->with($password) - ->will($this->returnValue($token)); + ->willReturn($token); $this->tokenProvider->expects($this->once()) ->method('getPassword') ->with($token, $password) - ->will($this->returnValue($realPassword)); + ->willReturn($realPassword); $this->tokenProvider->expects($this->once()) ->method('generateToken') @@ -994,7 +994,7 @@ class SessionTest extends \Test\TestCase { $manager->expects($this->once()) ->method('get') ->with($uid) - ->will($this->returnValue(null)); + ->willReturn(null); $this->assertFalse($userSession->createSessionToken($request, $uid, $loginName, $password)); } @@ -1021,18 +1021,18 @@ class SessionTest extends \Test\TestCase { $request->expects($this->once()) ->method('getHeader') ->with('Authorization') - ->will($this->returnValue('Bearer xxxxx')); + ->willReturn('Bearer xxxxx'); $this->tokenProvider->expects($this->once()) ->method('getToken') ->with('xxxxx') - ->will($this->returnValue($token)); + ->willReturn($token); $manager->expects($this->once()) ->method('get') ->with('fritz0') - ->will($this->returnValue($user)); + ->willReturn($user); $user->expects($this->once()) ->method('isEnabled') - ->will($this->returnValue(false)); + ->willReturn(false); $userSession->tryTokenLogin($request); } @@ -1055,23 +1055,23 @@ class SessionTest extends \Test\TestCase { $session->expects($this->once()) ->method('get') ->with('app_password') - ->will($this->returnValue('APP-PASSWORD')); + ->willReturn('APP-PASSWORD'); $tokenProvider->expects($this->once()) ->method('getToken') ->with('APP-PASSWORD') - ->will($this->returnValue($token)); + ->willReturn($token); $timeFactory->expects($this->once()) ->method('getTime') - ->will($this->returnValue(1000)); // more than 5min since last check + ->willReturn(1000); // more than 5min since last check $tokenProvider->expects($this->once()) ->method('getPassword') ->with($token, 'APP-PASSWORD') - ->will($this->returnValue('123456')); + ->willReturn('123456'); $userManager->expects($this->never()) ->method('checkPassword'); $user->expects($this->once()) ->method('isEnabled') - ->will($this->returnValue(false)); + ->willReturn(false); $tokenProvider->expects($this->once()) ->method('invalidateToken') ->with('APP-PASSWORD'); @@ -1099,14 +1099,14 @@ class SessionTest extends \Test\TestCase { $session->expects($this->once()) ->method('get') ->with('app_password') - ->will($this->returnValue('APP-PASSWORD')); + ->willReturn('APP-PASSWORD'); $tokenProvider->expects($this->once()) ->method('getToken') ->with('APP-PASSWORD') - ->will($this->returnValue($token)); + ->willReturn($token); $timeFactory->expects($this->once()) ->method('getTime') - ->will($this->returnValue(1000)); // more than 5min since last check + ->willReturn(1000); // more than 5min since last check $tokenProvider->expects($this->once()) ->method('getPassword') ->with($token, 'APP-PASSWORD') @@ -1135,25 +1135,25 @@ class SessionTest extends \Test\TestCase { $session->expects($this->once()) ->method('get') ->with('app_password') - ->will($this->returnValue('APP-PASSWORD')); + ->willReturn('APP-PASSWORD'); $tokenProvider->expects($this->once()) ->method('getToken') ->with('APP-PASSWORD') - ->will($this->returnValue($token)); + ->willReturn($token); $timeFactory->expects($this->once()) ->method('getTime') - ->will($this->returnValue(1000)); // more than 5min since last check + ->willReturn(1000); // more than 5min since last check $tokenProvider->expects($this->once()) ->method('getPassword') ->with($token, 'APP-PASSWORD') - ->will($this->returnValue('123456')); + ->willReturn('123456'); $userManager->expects($this->once()) ->method('checkPassword') ->with('susan', '123456') ->willReturn(false); $user->expects($this->once()) ->method('isEnabled') - ->will($this->returnValue(true)); + ->willReturn(true); $tokenProvider->expects($this->never()) ->method('invalidateToken'); $tokenProvider->expects($this->once()) @@ -1179,11 +1179,11 @@ class SessionTest extends \Test\TestCase { $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $tokenProvider->expects($this->once()) ->method('getToken') ->with($sessionId) - ->will($this->returnValue($token)); + ->willReturn($token); $tokenProvider->expects($this->once()) ->method('setPassword') ->with($token, $sessionId, $password); @@ -1218,11 +1218,11 @@ class SessionTest extends \Test\TestCase { $session->expects($this->once()) ->method('getId') - ->will($this->returnValue($sessionId)); + ->willReturn($sessionId); $tokenProvider->expects($this->once()) ->method('getToken') ->with($sessionId) - ->will($this->returnValue($token)); + ->willReturn($token); $tokenProvider->expects($this->once()) ->method('setPassword') ->with($token, $sessionId, $password) @@ -1254,7 +1254,7 @@ class SessionTest extends \Test\TestCase { $mapper->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)); + ->willReturn($token); $mapper->expects($this->once()) ->method('update'); $request @@ -1273,7 +1273,7 @@ class SessionTest extends \Test\TestCase { $this->timeFactory ->expects($this->any()) ->method('getTime') - ->will($this->returnValue(100)); + ->willReturn(100); $manager->method('getByEmail') ->with('john') @@ -1308,7 +1308,7 @@ class SessionTest extends \Test\TestCase { $mapper->expects($this->any()) ->method('getToken') - ->will($this->returnValue($token)); + ->willReturn($token); $mapper->expects($this->never()) ->method('update'); $request @@ -1327,7 +1327,7 @@ class SessionTest extends \Test\TestCase { $this->timeFactory ->expects($this->any()) ->method('getTime') - ->will($this->returnValue(100)); + ->willReturn(100); $manager->method('getByEmail') ->with('john') @@ -1375,7 +1375,7 @@ class SessionTest extends \Test\TestCase { $this->session ->method('set') - ->will($this->returnCallback(function($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) { + ->willReturnCallback(function($k, $v) use (&$davAuthenticatedSet, &$lastPasswordConfirmSet) { switch ($k) { case Auth::DAV_AUTHENTICATED: $davAuthenticatedSet = $v; @@ -1386,7 +1386,7 @@ class SessionTest extends \Test\TestCase { default: throw new \Exception(); } - })); + }); $userSession = $this->getMockBuilder(Session::class) ->setConstructorArgs([ diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php index 8431f14f8a2..4e527addc6e 100644 --- a/tests/lib/User/UserTest.php +++ b/tests/lib/User/UserTest.php @@ -47,12 +47,12 @@ class UserTest extends TestCase { $backend->expects($this->once()) ->method('getDisplayName') ->with($this->equalTo('foo')) - ->will($this->returnValue('Foo')); + ->willReturn('Foo'); $backend->expects($this->any()) ->method('implementsActions') ->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME)) - ->will($this->returnValue(true)); + ->willReturn(true); $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('Foo', $user->getDisplayName()); @@ -69,12 +69,12 @@ class UserTest extends TestCase { $backend->expects($this->once()) ->method('getDisplayName') ->with($this->equalTo('foo')) - ->will($this->returnValue(' ')); + ->willReturn(' '); $backend->expects($this->any()) ->method('implementsActions') ->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME)) - ->will($this->returnValue(true)); + ->willReturn(true); $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('foo', $user->getDisplayName()); @@ -91,7 +91,7 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') ->with($this->equalTo(\OC\User\Backend::GET_DISPLAYNAME)) - ->will($this->returnValue(false)); + ->willReturn(false); $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('foo', $user->getDisplayName()); @@ -108,13 +108,13 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::SET_PASSWORD) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->setPassword('bar','')); @@ -130,7 +130,7 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(false)); + ->willReturn(false); $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->setPassword('bar','')); @@ -144,17 +144,17 @@ class UserTest extends TestCase { $backend->expects($this->once()) ->method('canChangeAvatar') ->with($this->equalTo('foo')) - ->will($this->returnValue(true)); + ->willReturn(true); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::PROVIDE_AVATAR) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->canChangeAvatar()); @@ -168,17 +168,17 @@ class UserTest extends TestCase { $backend->expects($this->once()) ->method('canChangeAvatar') ->with($this->equalTo('foo')) - ->will($this->returnValue(false)); + ->willReturn(false); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::PROVIDE_AVATAR) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->canChangeAvatar()); @@ -221,13 +221,13 @@ class UserTest extends TestCase { $backend->expects($this->at(0)) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::GET_HOME) { return true; } else { return false; } - })); + }); // important: getHome MUST be called before deleteUser because // once the user is deleted, getHome implementations might not @@ -235,7 +235,7 @@ class UserTest extends TestCase { $backend->expects($this->at(1)) ->method('getHome') ->with($this->equalTo('foo')) - ->will($this->returnValue('/home/foo')); + ->willReturn('/home/foo'); $backend->expects($this->at(2)) ->method('deleteUser') @@ -253,17 +253,17 @@ class UserTest extends TestCase { $backend->expects($this->once()) ->method('getHome') ->with($this->equalTo('foo')) - ->will($this->returnValue('/home/foo')); + ->willReturn('/home/foo'); $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::GET_HOME) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher); $this->assertEquals('/home/foo', $user->getHome()); @@ -286,18 +286,18 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(false)); + ->willReturn(false); $allConfig = $this->getMockBuilder(IConfig::class) ->disableOriginalConstructor() ->getMock(); $allConfig->expects($this->any()) ->method('getUserValue') - ->will($this->returnValue(true)); + ->willReturn(true); $allConfig->expects($this->any()) ->method('getSystemValue') ->with($this->equalTo('datadirectory')) - ->will($this->returnValue('arbitrary/path')); + ->willReturn('arbitrary/path'); $user = new User('foo', $backend, $this->dispatcher, null, $allConfig); $this->assertEquals('arbitrary/path/foo', $user->getHome()); @@ -311,13 +311,13 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::SET_PASSWORD) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->canChangePassword()); @@ -331,7 +331,7 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(false)); + ->willReturn(false); $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->canChangePassword()); @@ -345,13 +345,13 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::SET_DISPLAYNAME) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher); $this->assertTrue($user->canChangeDisplayName()); @@ -365,7 +365,7 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnValue(false)); + ->willReturn(false); $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->canChangeDisplayName()); @@ -379,13 +379,13 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::SET_DISPLAYNAME) { return true; } else { return false; } - })); + }); $backend->expects($this->once()) ->method('setDisplayName') @@ -408,13 +408,13 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::SET_DISPLAYNAME) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher); $this->assertFalse($user->setDisplayName(' ')); @@ -466,13 +466,13 @@ class UserTest extends TestCase { $backend->expects($this->any()) ->method('implementsActions') - ->will($this->returnCallback(function ($actions) { + ->willReturnCallback(function ($actions) { if ($actions === \OC\User\Backend::SET_PASSWORD) { return true; } else { return false; } - })); + }); $user = new User('foo', $backend, $this->dispatcher, $emitter); @@ -751,13 +751,13 @@ class UserTest extends TestCase { $config = $this->createMock(IConfig::class); $config->method('getUserValue') - ->will($this->returnCallback(function ($uid, $app, $key, $default) { + ->willReturnCallback(function ($uid, $app, $key, $default) { if ($uid === 'foo' && $app === 'login' && $key === 'lastLogin') { return 42; } else { return $default; } - })); + }); $user = new User('foo', $backend, $this->dispatcher, null, $config); $this->assertSame(42, $user->getLastLogin()); @@ -861,13 +861,13 @@ class UserTest extends TestCase { $config = $this->createMock(IConfig::class); $config->method('getUserValue') - ->will($this->returnCallback(function ($uid, $app, $key, $default) { + ->willReturnCallback(function ($uid, $app, $key, $default) { if ($uid === 'foo' && $app === 'settings' && $key === 'email') { return 'foo@bar.com'; } else { return $default; } - })); + }); $user = new User('foo', $backend, $this->dispatcher, null, $config); $this->assertSame('foo@bar.com', $user->getEMailAddress()); diff --git a/tests/lib/Util/Group/Dummy.php b/tests/lib/Util/Group/Dummy.php index 0681a317c28..f75aef5737e 100644 --- a/tests/lib/Util/Group/Dummy.php +++ b/tests/lib/Util/Group/Dummy.php @@ -35,7 +35,7 @@ use OC\Group\Backend; * dummy group backend, does not keep state, only for testing use */ class Dummy extends Backend { - private $groups=array(); + private $groups=[]; /** * Try to create a new group * @param string $gid The name of the group to create @@ -46,7 +46,7 @@ class Dummy extends Backend { */ public function createGroup($gid) { if(!isset($this->groups[$gid])) { - $this->groups[$gid]=array(); + $this->groups[$gid]=[]; return true; }else{ return false; @@ -136,7 +136,7 @@ class Dummy extends Backend { * if the user exists at all. */ public function getUserGroups($uid) { - $groups=array(); + $groups=[]; $allGroups=array_keys($this->groups); foreach($allGroups as $group) { if($this->inGroup($uid, $group)) { @@ -157,7 +157,7 @@ class Dummy extends Backend { if(empty($search)) { return array_keys($this->groups); } - $result = array(); + $result = []; foreach(array_keys($this->groups) as $group) { if(stripos($group, $search) !== false) { $result[] = $group; @@ -180,7 +180,7 @@ class Dummy extends Backend { $length = $limit < 0 ? null : $limit; return array_slice($this->groups[$gid], $offset, $length); } - $result = array(); + $result = []; foreach($this->groups[$gid] as $user) { if(stripos($user, $search) !== false) { $result[] = $user; @@ -188,7 +188,7 @@ class Dummy extends Backend { } return $result; }else{ - return array(); + return []; } } diff --git a/tests/lib/Util/User/Dummy.php b/tests/lib/Util/User/Dummy.php index 4771983e9bc..1d3c2d57b42 100644 --- a/tests/lib/Util/User/Dummy.php +++ b/tests/lib/Util/User/Dummy.php @@ -33,8 +33,8 @@ use OC\User\Backend; * dummy user backend, does not keep state, only for testing use */ class Dummy extends Backend implements \OCP\IUserBackend { - private $users = array(); - private $displayNames = array(); + private $users = []; + private $displayNames = []; /** * Create a new user @@ -127,7 +127,7 @@ class Dummy extends Backend implements \OCP\IUserBackend { if (empty($search)) { return array_keys($this->users); } - $result = array(); + $result = []; foreach (array_keys($this->users) as $user) { if (stripos($user, $search) !== false) { $result[] = $user; diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php index 3f956601ce4..e822c394930 100644 --- a/tests/lib/UtilCheckServerTest.php +++ b/tests/lib/UtilCheckServerTest.php @@ -30,9 +30,9 @@ class UtilCheckServerTest extends \Test\TestCase { $config->expects($this->any()) ->method('getValue') - ->will($this->returnCallback(function ($key, $default) use ($systemOptions) { + ->willReturnCallback(function ($key, $default) use ($systemOptions) { return isset($systemOptions[$key]) ? $systemOptions[$key] : $default; - })); + }); return $config; } @@ -55,9 +55,9 @@ class UtilCheckServerTest extends \Test\TestCase { * Test that checkServer() returns no errors in the regular case. */ public function testCheckServer() { - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true - ))); + ])); $this->assertEmpty($result); } @@ -72,9 +72,9 @@ class UtilCheckServerTest extends \Test\TestCase { // even though ".ocdata" is missing, the error isn't // triggered to allow setup to run - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => false - ))); + ])); $this->assertEmpty($result); } @@ -91,14 +91,14 @@ class UtilCheckServerTest extends \Test\TestCase { $oldCurrentVersion = $session->get('OC_Version'); // upgrade condition to simulate needUpgrade() === true - $session->set('OC_Version', array(6, 0, 0, 2)); + $session->set('OC_Version', [6, 0, 0, 2]); // even though ".ocdata" is missing, the error isn't // triggered to allow for upgrade - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => '6.0.0.1' - ))); + ])); $this->assertEmpty($result); // restore versions @@ -123,10 +123,10 @@ class UtilCheckServerTest extends \Test\TestCase { $result = \OC_Util::checkDataDirectoryValidity($this->datadir); $this->assertEquals(1, count($result)); - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); $this->assertCount(1, $result); } @@ -134,10 +134,10 @@ class UtilCheckServerTest extends \Test\TestCase { * Tests that no error is given when the datadir is writable */ public function testDataDirWritable() { - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); $this->assertEmpty($result); } @@ -148,10 +148,10 @@ class UtilCheckServerTest extends \Test\TestCase { $this->markTestSkipped('TODO: Disable because fails on drone'); chmod($this->datadir, 0300); - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => true, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); $this->assertCount(1, $result); } @@ -160,10 +160,10 @@ class UtilCheckServerTest extends \Test\TestCase { */ public function testDataDirNotWritableSetup() { chmod($this->datadir, 0300); - $result = \OC_Util::checkServer($this->getConfig(array( + $result = \OC_Util::checkServer($this->getConfig([ 'installed' => false, 'version' => implode('.', \OCP\Util::getVersion()) - ))); + ])); chmod($this->datadir, 0700); //needed for cleanup $this->assertEmpty($result); } diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php index a5ddd50ab27..4d8432294fb 100644 --- a/tests/lib/UtilTest.php +++ b/tests/lib/UtilTest.php @@ -187,18 +187,18 @@ class UtilTest extends \Test\TestCase { ->expects($this->at(0)) ->method('getAppValue') ->with('core', 'shareapi_exclude_groups', 'no') - ->will($this->returnValue('yes')); + ->willReturn('yes'); $config ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'shareapi_exclude_groups_list') - ->will($this->returnValue(json_encode($excludedGroups))); + ->willReturn(json_encode($excludedGroups)); $groupManager ->expects($this->at(0)) ->method('getUserGroupIds') ->with($user) - ->will($this->returnValue($membership)); + ->willReturn($membership); $result = \OC_Util::isSharingDisabledForUser($config, $groupManager, $user); @@ -206,16 +206,16 @@ class UtilTest extends \Test\TestCase { } public function dataProviderForTestIsSharingDisabledForUser() { - return array( + return [ // existing groups, groups the user belong to, groups excluded from sharing, expected result - array(array('g1', 'g2', 'g3'), array(), array('g1'), false), - array(array('g1', 'g2', 'g3'), array(), array(), false), - array(array('g1', 'g2', 'g3'), array('g2'), array('g1'), false), - array(array('g1', 'g2', 'g3'), array('g2'), array(), false), - array(array('g1', 'g2', 'g3'), array('g1', 'g2'), array('g1'), false), - array(array('g1', 'g2', 'g3'), array('g1', 'g2'), array('g1', 'g2'), true), - array(array('g1', 'g2', 'g3'), array('g1', 'g2'), array('g1', 'g2', 'g3'), true), - ); + [['g1', 'g2', 'g3'], [], ['g1'], false], + [['g1', 'g2', 'g3'], [], [], false], + [['g1', 'g2', 'g3'], ['g2'], ['g1'], false], + [['g1', 'g2', 'g3'], ['g2'], [], false], + [['g1', 'g2', 'g3'], ['g1', 'g2'], ['g1'], false], + [['g1', 'g2', 'g3'], ['g1', 'g2'], ['g1', 'g2'], true], + [['g1', 'g2', 'g3'], ['g1', 'g2'], ['g1', 'g2', 'g3'], true], + ]; } /** @@ -233,9 +233,9 @@ class UtilTest extends \Test\TestCase { $appManager = $this->createMock(IAppManager::class); $appManager->expects($this->any()) ->method('isEnabledForUser') - ->will($this->returnCallback(function($appId) use ($enabledApps){ + ->willReturnCallback(function($appId) use ($enabledApps){ return in_array($appId, $enabledApps); - })); + }); Dummy_OC_Util::$appManager = $appManager; // need to set a user id to make sure enabled apps are read from cache @@ -250,32 +250,32 @@ class UtilTest extends \Test\TestCase { } function defaultAppsProvider() { - return array( + return [ // none specified, default to files - array( + [ '', 'index.php/apps/files/', - array('files'), - ), + ['files'], + ], // unexisting or inaccessible app specified, default to files - array( + [ 'unexist', 'index.php/apps/files/', - array('files'), - ), + ['files'], + ], // non-standard app - array( + [ 'calendar', 'index.php/apps/calendar/', - array('files', 'calendar'), - ), + ['files', 'calendar'], + ], // non-standard app with fallback - array( + [ 'contacts,calendar', 'index.php/apps/calendar/', - array('files', 'calendar'), - ), - ); + ['files', 'calendar'], + ], + ]; } public function testGetDefaultPageUrlWithRedirectUrlWithoutFrontController() { @@ -319,14 +319,14 @@ class UtilTest extends \Test\TestCase { $this->assertFalse(\OCP\Util::needUpgrade()); $config->setSystemValue('version', '7.0.0.0'); - \OC::$server->getSession()->set('OC_Version', array(7, 0, 0, 1)); - self::invokePrivate(new \OCP\Util, 'needUpgradeCache', array(null)); + \OC::$server->getSession()->set('OC_Version', [7, 0, 0, 1]); + self::invokePrivate(new \OCP\Util, 'needUpgradeCache', [null]); $this->assertTrue(\OCP\Util::needUpgrade()); $config->setSystemValue('version', $oldConfigVersion); \OC::$server->getSession()->set('OC_Version', $oldSessionVersion); - self::invokePrivate(new \OCP\Util, 'needUpgradeCache', array(null)); + self::invokePrivate(new \OCP\Util, 'needUpgradeCache', [null]); $this->assertFalse(\OCP\Util::needUpgrade()); } |