diff options
Diffstat (limited to 'tests')
24 files changed, 126 insertions, 73 deletions
diff --git a/tests/core/command/encryption/disabletest.php b/tests/core/command/encryption/disabletest.php index 26c814a9c4e..dfd06e2e26e 100644 --- a/tests/core/command/encryption/disabletest.php +++ b/tests/core/command/encryption/disabletest.php @@ -80,6 +80,6 @@ class DisableTest extends TestCase { ->with('core', 'encryption_enabled', 'no'); } - \Test_Helper::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } } diff --git a/tests/core/command/encryption/enabletest.php b/tests/core/command/encryption/enabletest.php index 377d0e2a528..e2357464aa1 100644 --- a/tests/core/command/encryption/enabletest.php +++ b/tests/core/command/encryption/enabletest.php @@ -114,6 +114,6 @@ class EnableTest extends TestCase { ->method('writeln') ->with($this->stringContains($expectedDefaultModuleString)); - \Test_Helper::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } } diff --git a/tests/core/command/encryption/setdefaultmoduletest.php b/tests/core/command/encryption/setdefaultmoduletest.php index e2a61dd10f6..3230a57db07 100644 --- a/tests/core/command/encryption/setdefaultmoduletest.php +++ b/tests/core/command/encryption/setdefaultmoduletest.php @@ -87,6 +87,6 @@ class SetDefaultModuleTest extends TestCase { ->method('writeln') ->with($this->stringContains($expectedString)); - \Test_Helper::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } } diff --git a/tests/core/command/user/deletetest.php b/tests/core/command/user/deletetest.php index bfcf031b719..99822ec6589 100644 --- a/tests/core/command/user/deletetest.php +++ b/tests/core/command/user/deletetest.php @@ -83,7 +83,7 @@ class DeleteTest extends TestCase { ->method('writeln') ->with($this->stringContains($expectedString)); - \Test_Helper::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } public function testInvalidUser() { @@ -101,6 +101,6 @@ class DeleteTest extends TestCase { ->method('writeln') ->with($this->stringContains('User does not exist')); - \Test_Helper::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } } diff --git a/tests/core/command/user/lastseentest.php b/tests/core/command/user/lastseentest.php index 7eda6fb27ed..84805f5c072 100644 --- a/tests/core/command/user/lastseentest.php +++ b/tests/core/command/user/lastseentest.php @@ -82,7 +82,7 @@ class LastSeenTest extends TestCase { ->method('writeln') ->with($this->stringContains($expectedString)); - \Test_Helper::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } public function testInvalidUser() { @@ -100,6 +100,6 @@ class LastSeenTest extends TestCase { ->method('writeln') ->with($this->stringContains('User does not exist')); - \Test_Helper::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); + self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); } } diff --git a/tests/lib/activitymanager.php b/tests/lib/activitymanager.php index d3263fa2ede..a35daeaf494 100644 --- a/tests/lib/activitymanager.php +++ b/tests/lib/activitymanager.php @@ -156,7 +156,7 @@ class Test_ActivityManager extends \Test\TestCase { */ public function testGetUserFromTokenThrowInvalidToken($token, $users) { $this->mockRSSToken($token, $token, $users); - \Test_Helper::invokePrivate($this->activityManager, 'getUserFromToken'); + self::invokePrivate($this->activityManager, 'getUserFromToken'); } public function getUserFromTokenData() { diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index 282d13a3397..a4bf3519bfc 100644 --- a/tests/lib/appframework/http/RequestTest.php +++ b/tests/lib/appframework/http/RequestTest.php @@ -797,7 +797,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertNull(\Test_Helper::invokePrivate($request, 'getOverwriteHost')); + $this->assertNull(self::invokePrivate($request, 'getOverwriteHost')); } public function testGetOverwriteHostWithOverwrite() { @@ -824,7 +824,7 @@ class RequestTest extends \Test\TestCase { $this->stream ); - $this->assertSame('www.owncloud.org', \Test_Helper::invokePrivate($request, 'getOverwriteHost')); + $this->assertSame('www.owncloud.org', self::invokePrivate($request, 'getOverwriteHost')); } public function testGetPathInfoWithSetEnv() { diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/encryption/keys/storage.php index 45cd272cca0..4fec24094fd 100644 --- a/tests/lib/encryption/keys/storage.php +++ b/tests/lib/encryption/keys/storage.php @@ -361,7 +361,46 @@ class StorageTest extends TestCase { 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/'), + ); + } + /** + * @dataProvider dataTestGetPathToKeys + * + * @param string $path + * @param boolean $systemWideMountPoint + * @param string $expected + */ + public function testGetPathToKeys($path, $systemWideMountPoint, $expected) { + + $this->util->expects($this->any()) + ->method('getUidAndFilename') + ->will($this->returnCallback(array($this, 'getUidAndFilenameCallback'))); + $this->util->expects($this->any()) + ->method('isSystemWideMountPoint') + ->willReturn($systemWideMountPoint); + + $this->assertSame($expected, + \Test_Helper::invokePrivate($this->storage, 'getPathToKeys', [$path]) + ); + } + + public function dataTestGetPathToKeys() { + return array( + array('/user1/files/source.txt', false, '/user1/files_encryption/keys/files/source.txt/'), + array('/user1/files/source.txt', true, '/files_encryption/keys/files/source.txt/') ); } @@ -382,7 +421,7 @@ class StorageTest extends TestCase { '/user1/files_encryption', '/user1'); - \Test_Helper::invokePrivate($this->storage, 'keySetPreparation', array('/user1/files_encryption/keys/foo')); + self::invokePrivate($this->storage, 'keySetPreparation', array('/user1/files_encryption/keys/foo')); } public function mkdirCallback() { diff --git a/tests/lib/encryption/managertest.php b/tests/lib/encryption/managertest.php index 3b1e07ffd69..249f63a81d2 100644 --- a/tests/lib/encryption/managertest.php +++ b/tests/lib/encryption/managertest.php @@ -127,7 +127,7 @@ class ManagerTest extends TestCase { $en0 = $this->manager->getEncryptionModule('ID0'); $this->assertEquals('ID0', $en0->getId()); - $en0 = \Test_Helper::invokePrivate($this->manager, 'getDefaultEncryptionModule'); + $en0 = self::invokePrivate($this->manager, 'getDefaultEncryptionModule'); $this->assertEquals('ID0', $en0->getId()); $this->assertEquals('ID0', $this->manager->getDefaultEncryptionModuleId()); diff --git a/tests/lib/files/pathverificationtest.php b/tests/lib/files/pathverificationtest.php index 65342c7799e..b59aceba7b1 100644 --- a/tests/lib/files/pathverificationtest.php +++ b/tests/lib/files/pathverificationtest.php @@ -94,7 +94,7 @@ class PathVerification extends \Test\TestCase { $storage = new Local(['datadir' => '']); $fileName = " 123{$fileName}456 "; - \Test_Helper::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); + self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); } public function providesInvalidCharsWindows() { @@ -151,7 +151,7 @@ class PathVerification extends \Test\TestCase { $storage = new Local(['datadir' => '']); $fileName = " 123{$fileName}456 "; - \Test_Helper::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); + self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); } public function providesInvalidCharsPosix() { @@ -200,7 +200,7 @@ class PathVerification extends \Test\TestCase { public function testPathVerificationReservedNamesWindows($fileName) { $storage = new Local(['datadir' => '']); - \Test_Helper::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); + self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); } public function providesReservedNamesWindows() { @@ -236,8 +236,8 @@ class PathVerification extends \Test\TestCase { public function testPathVerificationValidPaths($fileName) { $storage = new Local(['datadir' => '']); - \Test_Helper::invokePrivate($storage, 'verifyPosixPath', [$fileName]); - \Test_Helper::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); + self::invokePrivate($storage, 'verifyPosixPath', [$fileName]); + self::invokePrivate($storage, 'verifyWindowsPath', [$fileName]); // nothing thrown $this->assertTrue(true); } diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/files/storage/wrapper/encryption.php index d286978d926..520091df42d 100644 --- a/tests/lib/files/storage/wrapper/encryption.php +++ b/tests/lib/files/storage/wrapper/encryption.php @@ -355,7 +355,7 @@ class Encryption extends \Test\Files\Storage\Storage { } $this->assertSame($expected, - \Test_Helper::invokePrivate($this->instance, 'copyKeys', ['/source', '/target']) + self::invokePrivate($this->instance, 'copyKeys', ['/source', '/target']) ); } diff --git a/tests/lib/helper.php b/tests/lib/helper.php index 03c6dacde64..bd527de160d 100644 --- a/tests/lib/helper.php +++ b/tests/lib/helper.php @@ -509,28 +509,9 @@ class Test_Helper extends \Test\TestCase { * @param $methodName * @param array $parameters * @return mixed + * @deprecated Please extend \Test\TestCase and use self::invokePrivate() then */ public static function invokePrivate($object, $methodName, array $parameters = array()) { - $reflection = new ReflectionClass(get_class($object)); - - if ($reflection->hasMethod($methodName)) { - $method = $reflection->getMethod($methodName); - - $method->setAccessible(true); - - return $method->invokeArgs($object, $parameters); - } elseif ($reflection->hasProperty($methodName)) { - $property = $reflection->getProperty($methodName); - - $property->setAccessible(true); - - if (!empty($parameters)) { - $property->setValue($object, array_pop($parameters)); - } - - return $property->getValue($object); - } - - return false; + return parent::invokePrivate($object, $methodName, $parameters); } } diff --git a/tests/lib/http/client/clienttest.php b/tests/lib/http/client/clienttest.php index bd909769b09..c76fe0532a7 100644 --- a/tests/lib/http/client/clienttest.php +++ b/tests/lib/http/client/clienttest.php @@ -47,7 +47,7 @@ class ClientTest extends \Test\TestCase { ->method('getSystemValue') ->with('proxyuserpwd', null) ->willReturn(null); - $this->assertSame('', \Test_Helper::invokePrivate($this->client, 'getProxyUri')); + $this->assertSame('', self::invokePrivate($this->client, 'getProxyUri')); } public function testGetProxyUriProxyHostEmptyPassword() { @@ -61,7 +61,7 @@ class ClientTest extends \Test\TestCase { ->method('getSystemValue') ->with('proxyuserpwd', null) ->willReturn(null); - $this->assertSame('foo', \Test_Helper::invokePrivate($this->client, 'getProxyUri')); + $this->assertSame('foo', self::invokePrivate($this->client, 'getProxyUri')); } public function testGetProxyUriProxyHostWithPassword() { @@ -75,7 +75,7 @@ class ClientTest extends \Test\TestCase { ->method('getSystemValue') ->with('proxyuserpwd', null) ->willReturn('username:password'); - $this->assertSame('username:password@foo', \Test_Helper::invokePrivate($this->client, 'getProxyUri')); + $this->assertSame('username:password@foo', self::invokePrivate($this->client, 'getProxyUri')); } public function testGet() { diff --git a/tests/lib/mail/mailer.php b/tests/lib/mail/mailer.php index 7e5e689741a..21565f9ffb5 100644 --- a/tests/lib/mail/mailer.php +++ b/tests/lib/mail/mailer.php @@ -35,7 +35,7 @@ class MailerTest extends TestCase { } public function testGetMailInstance() { - $this->assertEquals(\Swift_MailTransport::newInstance(), \Test_Helper::invokePrivate($this->mailer, 'getMailinstance')); + $this->assertEquals(\Swift_MailTransport::newInstance(), self::invokePrivate($this->mailer, 'getMailinstance')); } public function testGetSendMailInstanceSendMail() { @@ -45,7 +45,7 @@ class MailerTest extends TestCase { ->with('mail_smtpmode', 'sendmail') ->will($this->returnValue('sendmail')); - $this->assertEquals(\Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'), \Test_Helper::invokePrivate($this->mailer, 'getSendMailInstance')); + $this->assertEquals(\Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'), self::invokePrivate($this->mailer, 'getSendMailInstance')); } public function testGetSendMailInstanceSendMailQmail() { @@ -55,11 +55,11 @@ class MailerTest extends TestCase { ->with('mail_smtpmode', 'sendmail') ->will($this->returnValue('qmail')); - $this->assertEquals(\Swift_SendmailTransport::newInstance('/var/qmail/bin/sendmail -bs'), \Test_Helper::invokePrivate($this->mailer, 'getSendMailInstance')); + $this->assertEquals(\Swift_SendmailTransport::newInstance('/var/qmail/bin/sendmail -bs'), self::invokePrivate($this->mailer, 'getSendMailInstance')); } public function testGetInstanceDefault() { - $this->assertInstanceOf('\Swift_MailTransport', \Test_Helper::invokePrivate($this->mailer, 'getInstance')); + $this->assertInstanceOf('\Swift_MailTransport', self::invokePrivate($this->mailer, 'getInstance')); } public function testGetInstancePhp() { @@ -68,7 +68,7 @@ class MailerTest extends TestCase { ->method('getSystemValue') ->will($this->returnValue('php')); - $this->assertInstanceOf('\Swift_MailTransport', \Test_Helper::invokePrivate($this->mailer, 'getInstance')); + $this->assertInstanceOf('\Swift_MailTransport', self::invokePrivate($this->mailer, 'getInstance')); } public function testGetInstanceSendmail() { @@ -77,7 +77,7 @@ class MailerTest extends TestCase { ->method('getSystemValue') ->will($this->returnValue('sendmail')); - $this->assertInstanceOf('\Swift_SendmailTransport', \Test_Helper::invokePrivate($this->mailer, 'getInstance')); + $this->assertInstanceOf('\Swift_SendmailTransport', self::invokePrivate($this->mailer, 'getInstance')); } public function testCreateMessage() { diff --git a/tests/lib/mail/message.php b/tests/lib/mail/message.php index c75cc18b650..8ee3c33627c 100644 --- a/tests/lib/mail/message.php +++ b/tests/lib/mail/message.php @@ -42,7 +42,7 @@ class MessageTest extends TestCase { * @dataProvider mailAddressProvider */ public function testConvertAddresses($unconverted, $expected) { - $this->assertSame($expected, \Test_Helper::invokePrivate($this->message, 'convertAddresses', array($unconverted))); + $this->assertSame($expected, self::invokePrivate($this->message, 'convertAddresses', array($unconverted))); } public function testSetFrom() { diff --git a/tests/lib/ocsclienttest.php b/tests/lib/ocsclienttest.php index f4bf1536291..ca8a2a2a2e8 100644 --- a/tests/lib/ocsclienttest.php +++ b/tests/lib/ocsclienttest.php @@ -76,7 +76,7 @@ class OCSClientTest extends \Test\TestCase { ->method('getSystemValue') ->with('appstoreurl', 'https://api.owncloud.com/v1') ->will($this->returnValue('https://api.owncloud.com/v1')); - $this->assertSame('https://api.owncloud.com/v1', Test_Helper::invokePrivate($this->ocsClient, 'getAppStoreUrl')); + $this->assertSame('https://api.owncloud.com/v1', self::invokePrivate($this->ocsClient, 'getAppStoreUrl')); } public function testGetCategoriesDisabledAppStore() { diff --git a/tests/lib/repair/cleantags.php b/tests/lib/repair/cleantags.php index 75bbbd07503..b455aa870fb 100644 --- a/tests/lib/repair/cleantags.php +++ b/tests/lib/repair/cleantags.php @@ -64,15 +64,15 @@ class CleanTags extends \Test\TestCase { $this->assertEntryCount('*PREFIX*vcategory_to_object', 4, 'Assert tag entries count before repair step'); $this->assertEntryCount('*PREFIX*vcategory', 4, 'Assert tag categories count before repair step'); - \Test_Helper::invokePrivate($this->repair, 'deleteOrphanFileEntries'); + self::invokePrivate($this->repair, 'deleteOrphanFileEntries'); $this->assertEntryCount('*PREFIX*vcategory_to_object', 3, 'Assert tag entries count after cleaning file entries'); $this->assertEntryCount('*PREFIX*vcategory', 4, 'Assert tag categories count after cleaning file entries'); - \Test_Helper::invokePrivate($this->repair, 'deleteOrphanTagEntries'); + self::invokePrivate($this->repair, 'deleteOrphanTagEntries'); $this->assertEntryCount('*PREFIX*vcategory_to_object', 2, 'Assert tag entries count after cleaning tag entries'); $this->assertEntryCount('*PREFIX*vcategory', 4, 'Assert tag categories count after cleaning tag entries'); - \Test_Helper::invokePrivate($this->repair, 'deleteOrphanCategoryEntries'); + self::invokePrivate($this->repair, 'deleteOrphanCategoryEntries'); $this->assertEntryCount('*PREFIX*vcategory_to_object', 2, 'Assert tag entries count after cleaning category entries'); $this->assertEntryCount('*PREFIX*vcategory', 2, 'Assert tag categories count after cleaning category entries'); } diff --git a/tests/lib/security/hasher.php b/tests/lib/security/hasher.php index 330789c67a0..a6f7df5b79f 100644 --- a/tests/lib/security/hasher.php +++ b/tests/lib/security/hasher.php @@ -11,7 +11,7 @@ use OC\Security\Hasher; /** * Class HasherTest */ -class HasherTest extends \PHPUnit_Framework_TestCase { +class HasherTest extends \Test\TestCase { /** * @return array @@ -70,14 +70,15 @@ class HasherTest extends \PHPUnit_Framework_TestCase { ); } - - /** @var Hasher */ protected $hasher; + /** @var \OCP\IConfig */ protected $config; protected function setUp() { + parent::setUp(); + $this->config = $this->getMockBuilder('\OCP\IConfig') ->disableOriginalConstructor()->getMock(); @@ -93,7 +94,7 @@ class HasherTest extends \PHPUnit_Framework_TestCase { * @dataProvider versionHashProvider */ function testSplitHash($hash, $expected) { - $relativePath = \Test_Helper::invokePrivate($this->hasher, 'splitHash', array($hash)); + $relativePath = self::invokePrivate($this->hasher, 'splitHash', array($hash)); $this->assertSame($expected, $relativePath); } diff --git a/tests/lib/setup.php b/tests/lib/setup.php index caaeec08fb3..79ca0c0be90 100644 --- a/tests/lib/setup.php +++ b/tests/lib/setup.php @@ -120,7 +120,7 @@ class Test_OC_Setup extends \Test\TestCase { * If it hasn't this test will fail. */ public function testHtaccessIsCurrent() { - $result = Test_Helper::invokePrivate( + $result = self::invokePrivate( $this->setupClass, 'isCurrentHtaccess' ); diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 5909102f797..f03ed43e7fc 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -1051,7 +1051,7 @@ class Test_Share extends \Test\TestCase { */ function testRemoveProtocolFromUrl($url, $expectedResult) { $share = new \OC\Share\Share(); - $result = \Test_Helper::invokePrivate($share, 'removeProtocolFromUrl', array($url)); + $result = self::invokePrivate($share, 'removeProtocolFromUrl', array($url)); $this->assertSame($expectedResult, $result); } diff --git a/tests/lib/tempmanager.php b/tests/lib/tempmanager.php index 72741d0dec6..0fa025d44c8 100644 --- a/tests/lib/tempmanager.php +++ b/tests/lib/tempmanager.php @@ -154,7 +154,7 @@ class TempManager extends \Test\TestCase { public function testBuildFileNameWithPostfix() { $logger = $this->getMock('\Test\NullLogger'); - $tmpManager = \Test_Helper::invokePrivate( + $tmpManager = self::invokePrivate( $this->getManager($logger), 'buildFileNameWithSuffix', ['/tmp/myTemporaryFile', 'postfix'] @@ -165,7 +165,7 @@ class TempManager extends \Test\TestCase { public function testBuildFileNameWithoutPostfix() { $logger = $this->getMock('\Test\NullLogger'); - $tmpManager = \Test_Helper::invokePrivate( + $tmpManager = self::invokePrivate( $this->getManager($logger), 'buildFileNameWithSuffix', ['/tmp/myTemporaryFile', ''] @@ -176,7 +176,7 @@ class TempManager extends \Test\TestCase { public function testBuildFileNameWithSuffixPathTraversal() { $logger = $this->getMock('\Test\NullLogger'); - $tmpManager = \Test_Helper::invokePrivate( + $tmpManager = self::invokePrivate( $this->getManager($logger), 'buildFileNameWithSuffix', ['foo', '../Traversal\\../FileName'] diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php index d8595c83a91..8551edab71f 100644 --- a/tests/lib/testcase.php +++ b/tests/lib/testcase.php @@ -50,6 +50,38 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { } /** + * Allows us to test private methods/properties + * + * @param $object + * @param $methodName + * @param array $parameters + * @return mixed + */ + protected static function invokePrivate($object, $methodName, array $parameters = array()) { + $reflection = new \ReflectionClass(get_class($object)); + + if ($reflection->hasMethod($methodName)) { + $method = $reflection->getMethod($methodName); + + $method->setAccessible(true); + + return $method->invokeArgs($object, $parameters); + } elseif ($reflection->hasProperty($methodName)) { + $property = $reflection->getProperty($methodName); + + $property->setAccessible(true); + + if (!empty($parameters)) { + $property->setValue($object, array_pop($parameters)); + } + + return $property->getValue($object); + } + + return false; + } + + /** * Returns a unique identifier as uniqid() is not reliable sometimes * * @param string $prefix diff --git a/tests/settings/controller/CheckSetupControllerTest.php b/tests/settings/controller/CheckSetupControllerTest.php index b21e78c831d..b39d13ac26b 100644 --- a/tests/settings/controller/CheckSetupControllerTest.php +++ b/tests/settings/controller/CheckSetupControllerTest.php @@ -81,7 +81,7 @@ class CheckSetupControllerTest extends TestCase { ->will($this->returnValue(false)); $this->assertFalse( - \Test_Helper::invokePrivate( + self::invokePrivate( $this->checkSetupController, 'isInternetConnectionWorking' ) @@ -109,7 +109,7 @@ class CheckSetupControllerTest extends TestCase { $this->assertTrue( - \Test_Helper::invokePrivate( + self::invokePrivate( $this->checkSetupController, 'isInternetConnectionWorking' ) @@ -134,7 +134,7 @@ class CheckSetupControllerTest extends TestCase { ->will($this->returnValue($client)); $this->assertFalse( - \Test_Helper::invokePrivate( + self::invokePrivate( $this->checkSetupController, 'isInternetConnectionWorking' ) @@ -162,7 +162,7 @@ class CheckSetupControllerTest extends TestCase { ->will($this->returnValue($client)); $this->assertFalse( - \Test_Helper::invokePrivate( + self::invokePrivate( $this->checkSetupController, 'isInternetConnectionWorking' ) @@ -176,7 +176,7 @@ class CheckSetupControllerTest extends TestCase { ->will($this->returnValue(null)); $this->assertFalse( - \Test_Helper::invokePrivate( + self::invokePrivate( $this->checkSetupController, 'isMemcacheConfigured' ) @@ -190,7 +190,7 @@ class CheckSetupControllerTest extends TestCase { ->will($this->returnValue('SomeProvider')); $this->assertTrue( - \Test_Helper::invokePrivate( + self::invokePrivate( $this->checkSetupController, 'isMemcacheConfigured' ) @@ -239,7 +239,7 @@ class CheckSetupControllerTest extends TestCase { 'dataDirectoryProtected' => true, 'isMemcacheConfigured' => true, 'memcacheDocs' => 'http://doc.owncloud.org/server/go.php?to=admin-performance', - 'isUrandomAvailable' => \Test_Helper::invokePrivate($this->checkSetupController, 'isUrandomAvailable'), + 'isUrandomAvailable' => self::invokePrivate($this->checkSetupController, 'isUrandomAvailable'), 'securityDocs' => 'https://doc.owncloud.org/server/8.1/admin_manual/configuration_server/hardening.html', ] ); diff --git a/tests/settings/controller/userscontrollertest.php b/tests/settings/controller/userscontrollertest.php index e70b235f603..5f98cf21c04 100644 --- a/tests/settings/controller/userscontrollertest.php +++ b/tests/settings/controller/userscontrollertest.php @@ -1290,7 +1290,7 @@ class UsersControllerTest extends \Test\TestCase { list($user, $expectedResult) = $this->mockUser(); - $result = \Test_Helper::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); + $result = self::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); $this->assertEquals($expectedResult, $result); } @@ -1327,7 +1327,7 @@ class UsersControllerTest extends \Test\TestCase { ) ->will($this->returnValue('1')); - $result = \Test_Helper::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); + $result = self::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); $this->assertEquals($expectedResult, $result); } @@ -1345,7 +1345,7 @@ class UsersControllerTest extends \Test\TestCase { $expectedResult['isRestoreDisabled'] = true; - $result = \Test_Helper::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); + $result = self::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); $this->assertEquals($expectedResult, $result); } @@ -1384,7 +1384,7 @@ class UsersControllerTest extends \Test\TestCase { $expectedResult['isRestoreDisabled'] = true; - $result = \Test_Helper::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); + $result = self::invokePrivate($this->container['UsersController'], 'formatUserForIndex', [$user]); $this->assertEquals($expectedResult, $result); } |