Skip to content

Commit

Permalink
Undo new unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
jvillafanez committed Oct 29, 2019
1 parent 753cc51 commit ea9a2b7
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions tests/lib/Files/ObjectStore/ObjectStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use OC\Files\Cache\Updater;
use OC\Files\ObjectStore\NoopScanner;
use OC\Files\ObjectStore\ObjectStoreStorage;
use OCP\Files\Cache\ICache;
use OCP\Files\NotFoundException;
use OCP\Files\ObjectStore\IObjectStore;
use OCP\Files\ObjectStore\IVersionedObjectStorage;
Expand Down Expand Up @@ -139,37 +138,15 @@ public function testMoveFromStorageWithSelf() {
}

public function testMoveFromStorageWithObjectStore() {
$sourceStorage = $this->getMockBuilder(ObjectStoreStorage::class)
->setMethods(['getCache'])
->setConstructorArgs(['objectstore' => $this->impl])
->getMock();
$sourceObjectStoreCache = $this->createMock(ICache::class);
$sourceObjectStoreCache->expects($this->never())->method('put');
$sourceObjectStoreCache->expects($this->never())->method('remove');
$sourceObjectStoreCache->expects($this->never())->method('move');
$sourceObjectStoreCache->expects($this->never())->method('update');
$sourceStorage->method('getCache')->willReturn($sourceObjectStoreCache);
$sourceStorage = new ObjectStoreStorage([
'objectstore' => $this->impl
]);

$this->objectStore = $this->getMockBuilder(ObjectStoreStorage::class)
->setMethods(['getUpdater', 'getCache'])
->setMethods(['getUpdater'])
->setConstructorArgs([['objectstore' => $this->impl]])
->getMock();

// only one "moveFromCache" operation is expected to hit the cache
$objectStoreCache = $this->createMock(ICache::class);
$objectStoreCache->expects($this->never())->method('put');
$objectStoreCache->expects($this->never())->method('remove');
$objectStoreCache->expects($this->never())->method('move');
$objectStoreCache->expects($this->never())->method('update');
$objectStoreCache->expects($this->once())
->method('moveFromCache')
->with(
$this->equalTo($sourceStorage),
$this->equalTo('text.txt'),
$this->equalTo('foo/bar.txt')
);
$this->objectstore->method('getCache')->willReturn($objectStoreCache);

$updater = $this->createMock(Updater::class);
$this->objectStore->expects($this->once())->method('getUpdater')->willReturn($updater);
$sourceInternalPath = 'text.txt';
Expand Down

0 comments on commit ea9a2b7

Please sign in to comment.