本文整理汇总了PHP中Test\TestCase::invokePrivate方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::invokePrivate方法的具体用法?PHP TestCase::invokePrivate怎么用?PHP TestCase::invokePrivate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test\TestCase
的用法示例。
在下文中一共展示了TestCase::invokePrivate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invokePrivate
/**
* Allows us to test private methods/properties
*
* @param $object
* @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())
{
return parent::invokePrivate($object, $methodName, $parameters);
}
示例2: tearDown
protected function tearDown()
{
\OC_User::setUserId($this->user);
foreach ($this->storages as $storage) {
$cache = $storage->getCache();
$ids = $cache->getAll();
$cache->clear();
}
if ($this->tempStorage && !\OC_Util::runningOnWindows()) {
system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir()));
}
$this->logout();
$this->userObject->delete();
$this->groupObject->delete();
$mountProviderCollection = \OC::$server->getMountProviderCollection();
\Test\TestCase::invokePrivate($mountProviderCollection, 'providers', [[]]);
parent::tearDown();
}
示例3: testLockMoveMountPoint
/**
* Test locks when moving a mount point
*/
public function testLockMoveMountPoint()
{
$this->loginAsUser('test');
$subStorage = $this->getMockBuilder('\\OC\\Files\\Storage\\Temporary')->setMethods([])->getMock();
$mount = $this->getMock('\\Test\\TestMoveableMountPoint', ['moveMount'], [$subStorage, $this->user . '/files/substorage']);
$mountProvider = $this->getMock('\\OCP\\Files\\Config\\IMountProvider');
$mountProvider->expects($this->once())->method('getMountsForUser')->will($this->returnValue([$mount]));
$mountProviderCollection = \OC::$server->getMountProviderCollection();
$mountProviderCollection->registerProvider($mountProvider);
$view = new \OC\Files\View('/' . $this->user . '/files/');
$view->mkdir('subdir');
$sourcePath = 'substorage';
$targetPath = 'subdir/substorage_moved';
$mount->expects($this->once())->method('moveMount')->will($this->returnCallback(function ($target) use($mount, $view, $sourcePath, $targetPath, &$lockTypeSourceDuring, &$lockTypeTargetDuring, &$lockTypeSharedRootDuring) {
$lockTypeSourceDuring = $this->getFileLockType($view, $sourcePath, true);
$lockTypeTargetDuring = $this->getFileLockType($view, $targetPath, true);
$lockTypeSharedRootDuring = $this->getFileLockType($view, $sourcePath, false);
$mount->setMountPoint($target);
return true;
}));
$this->connectMockHooks('rename', $view, $sourcePath, $lockTypeSourcePre, $lockTypeSourcePost, true);
$this->connectMockHooks('rename', $view, $targetPath, $lockTypeTargetPre, $lockTypeTargetPost, true);
// in pre-hook, mount point is still on $sourcePath
$this->connectMockHooks('rename', $view, $sourcePath, $lockTypeSharedRootPre, $dummy, false);
// in post-hook, mount point is now on $targetPath
$this->connectMockHooks('rename', $view, $targetPath, $dummy, $lockTypeSharedRootPost, false);
$this->assertNull($this->getFileLockType($view, $sourcePath, false), 'Shared storage root not locked before operation');
$this->assertNull($this->getFileLockType($view, $sourcePath, true), 'Source path not locked before operation');
$this->assertNull($this->getFileLockType($view, $targetPath, true), 'Target path not locked before operation');
$view->rename($sourcePath, $targetPath);
$this->assertEquals(ILockingProvider::LOCK_SHARED, $lockTypeSourcePre, 'Source path locked properly during pre-hook');
$this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeSourceDuring, 'Source path locked properly during operation');
$this->assertEquals(ILockingProvider::LOCK_SHARED, $lockTypeSourcePost, 'Source path locked properly during post-hook');
$this->assertEquals(ILockingProvider::LOCK_SHARED, $lockTypeTargetPre, 'Target path locked properly during pre-hook');
$this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeTargetDuring, 'Target path locked properly during operation');
$this->assertEquals(ILockingProvider::LOCK_SHARED, $lockTypeTargetPost, 'Target path locked properly during post-hook');
$this->assertNull($lockTypeSharedRootPre, 'Shared storage root not locked during pre-hook');
$this->assertNull($lockTypeSharedRootDuring, 'Shared storage root not locked during move');
$this->assertNull($lockTypeSharedRootPost, 'Shared storage root not locked during post-hook');
$this->assertNull($this->getFileLockType($view, $sourcePath, false), 'Shared storage root not locked after operation');
$this->assertNull($this->getFileLockType($view, $sourcePath, true), 'Source path not locked after operation');
$this->assertNull($this->getFileLockType($view, $targetPath, true), 'Target path not locked after operation');
\Test\TestCase::invokePrivate($mountProviderCollection, 'providers', [[]]);
}