diff options
Diffstat (limited to 'tests/lib/Files/ViewTest.php')
-rw-r--r-- | tests/lib/Files/ViewTest.php | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 57050059375..5f3116e7b24 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -1169,11 +1169,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 +1220,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 +1597,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); @@ -1617,11 +1617,11 @@ class ViewTest extends \Test\TestCase { ]); $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'); @@ -1846,13 +1846,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 +1890,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 +1929,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 +1990,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 { @@ -2102,7 +2102,7 @@ class ViewTest extends \Test\TestCase { $storage->expects($this->any()) ->method('filemtime') - ->will($this->returnValue(123456789)); + ->willReturn(123456789); $sourcePath = 'original.txt'; $targetPath = 'target.txt'; @@ -2113,14 +2113,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 +2166,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); @@ -2282,7 +2282,7 @@ class ViewTest extends \Test\TestCase { $storage2->expects($this->any()) ->method('filemtime') - ->will($this->returnValue(123456789)); + ->willReturn(123456789); $sourcePath = 'original.txt'; $targetPath = 'substorage/target.txt'; @@ -2296,14 +2296,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); @@ -2343,7 +2343,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 +2354,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 +2408,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( |