diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-09-17 19:20:13 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-09-17 19:20:13 +0200 |
commit | cfca7e7911568a7fd12c4c2116d77c126cff51ad (patch) | |
tree | af65e1238cfb6093d1ea5f0ecacb3fd05c8d0770 /tests | |
parent | 2bdc97741cd42843f85750421cba032942d860ed (diff) | |
download | nextcloud-server-cfca7e7911568a7fd12c4c2116d77c126cff51ad.tar.gz nextcloud-server-cfca7e7911568a7fd12c4c2116d77c126cff51ad.zip |
fix(tests): Fix most obvious errors in ObjectStore tests
Some are still failing
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests')
3 files changed, 60 insertions, 56 deletions
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php index 1915460777c..a0e18a5557b 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesDifferentBucketTest.php @@ -7,6 +7,8 @@ namespace Test\Files\ObjectStore; +use OC\Files\ObjectStore\StorageObjectStore; +use OC\Files\Storage\Temporary; use Test\Files\Storage\StoragesTest; /** diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php index 71011451a53..19a1f4b7bc5 100644 --- a/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php +++ b/tests/lib/Files/ObjectStore/ObjectStoreStoragesSameBucketTest.php @@ -7,6 +7,8 @@ namespace Test\Files\ObjectStore; +use OC\Files\ObjectStore\StorageObjectStore; +use OC\Files\Storage\Temporary; use Test\Files\Storage\StoragesTest; /** diff --git a/tests/lib/Files/Storage/StoragesTest.php b/tests/lib/Files/Storage/StoragesTest.php index a7578c24e3d..d157d288f2c 100644 --- a/tests/lib/Files/Storage/StoragesTest.php +++ b/tests/lib/Files/Storage/StoragesTest.php @@ -33,76 +33,76 @@ abstract class StoragesTest extends TestCase { public function testMoveFileFromStorage() { $source = 'source.txt'; $target = 'target.txt'; - $storage2->file_put_contents($source, 'foo'); + $this->storage2->file_put_contents($source, 'foo'); - $storage1->moveFromStorage($storage2, $source, $target); + $this->storage1->moveFromStorage($this->storage2, $source, $target); - $this->assertTrue($storage1->file_exists($target), $target.' was not created'); - $this->assertFalse($storage2->file_exists($source), $source.' still exists'); - $this->assertEquals('foo', $storage1->file_get_contents($target)); + $this->assertTrue($this->storage1->file_exists($target), $target.' was not created'); + $this->assertFalse($this->storage2->file_exists($source), $source.' still exists'); + $this->assertEquals('foo', $this->storage1->file_get_contents($target)); } public function testMoveDirectoryFromStorage() { - $storage2->mkdir('source'); - $storage2->file_put_contents('source/test1.txt', 'foo'); - $storage2->file_put_contents('source/test2.txt', 'qwerty'); - $storage2->mkdir('source/subfolder'); - $storage2->file_put_contents('source/subfolder/test.txt', 'bar'); - - $storage1->moveFromStorage($storage2, 'source', 'target'); - - $this->assertTrue($storage1->file_exists('target')); - $this->assertTrue($storage1->file_exists('target/test1.txt')); - $this->assertTrue($storage1->file_exists('target/test2.txt')); - $this->assertTrue($storage1->file_exists('target/subfolder')); - $this->assertTrue($storage1->file_exists('target/subfolder/test.txt')); - - $this->assertFalse($storage2->file_exists('source')); - $this->assertFalse($storage2->file_exists('source/test1.txt')); - $this->assertFalse($storage2->file_exists('source/test2.txt')); - $this->assertFalse($storage2->file_exists('source/subfolder')); - $this->assertFalse($storage2->file_exists('source/subfolder/test.txt')); - - $this->assertEquals('foo', $storage1->file_get_contents('target/test1.txt')); - $this->assertEquals('qwerty', $storage1->file_get_contents('target/test2.txt')); - $this->assertEquals('bar', $storage1->file_get_contents('target/subfolder/test.txt')); + $this->storage2->mkdir('source'); + $this->storage2->file_put_contents('source/test1.txt', 'foo'); + $this->storage2->file_put_contents('source/test2.txt', 'qwerty'); + $this->storage2->mkdir('source/subfolder'); + $this->storage2->file_put_contents('source/subfolder/test.txt', 'bar'); + + $this->storage1->moveFromStorage($this->storage2, 'source', 'target'); + + $this->assertTrue($this->storage1->file_exists('target')); + $this->assertTrue($this->storage1->file_exists('target/test1.txt')); + $this->assertTrue($this->storage1->file_exists('target/test2.txt')); + $this->assertTrue($this->storage1->file_exists('target/subfolder')); + $this->assertTrue($this->storage1->file_exists('target/subfolder/test.txt')); + + $this->assertFalse($this->storage2->file_exists('source')); + $this->assertFalse($this->storage2->file_exists('source/test1.txt')); + $this->assertFalse($this->storage2->file_exists('source/test2.txt')); + $this->assertFalse($this->storage2->file_exists('source/subfolder')); + $this->assertFalse($this->storage2->file_exists('source/subfolder/test.txt')); + + $this->assertEquals('foo', $this->storage1->file_get_contents('target/test1.txt')); + $this->assertEquals('qwerty', $this->storage1->file_get_contents('target/test2.txt')); + $this->assertEquals('bar', $this->storage1->file_get_contents('target/subfolder/test.txt')); } public function testCopyFileFromStorage() { $source = 'source.txt'; $target = 'target.txt'; - $storage2->file_put_contents($source, 'foo'); + $this->storage2->file_put_contents($source, 'foo'); - $storage1->copyFromStorage($storage2, $source, $target); + $this->storage1->copyFromStorage($this->storage2, $source, $target); - $this->assertTrue($storage1->file_exists($target), $target.' was not created'); - $this->assertTrue($storage2->file_exists($source), $source.' was deleted'); - $this->assertEquals('foo', $storage1->file_get_contents($target)); + $this->assertTrue($this->storage1->file_exists($target), $target.' was not created'); + $this->assertTrue($this->storage2->file_exists($source), $source.' was deleted'); + $this->assertEquals('foo', $this->storage1->file_get_contents($target)); } public function testCopyDirectoryFromStorage() { - $storage2->mkdir('source'); - $storage2->file_put_contents('source/test1.txt', 'foo'); - $storage2->file_put_contents('source/test2.txt', 'qwerty'); - $storage2->mkdir('source/subfolder'); - $storage2->file_put_contents('source/subfolder/test.txt', 'bar'); - - $storage1->copyFromStorage($storage2, 'source', 'target'); - - $this->assertTrue($storage1->file_exists('target')); - $this->assertTrue($storage1->file_exists('target/test1.txt')); - $this->assertTrue($storage1->file_exists('target/test2.txt')); - $this->assertTrue($storage1->file_exists('target/subfolder')); - $this->assertTrue($storage1->file_exists('target/subfolder/test.txt')); - - $this->assertTrue($storage2->file_exists('source')); - $this->assertTrue($storage2->file_exists('source/test1.txt')); - $this->assertTrue($storage2->file_exists('source/test2.txt')); - $this->assertTrue($storage2->file_exists('source/subfolder')); - $this->assertTrue($storage2->file_exists('source/subfolder/test.txt')); - - $this->assertEquals('foo', $storage1->file_get_contents('target/test1.txt')); - $this->assertEquals('qwerty', $storage1->file_get_contents('target/test2.txt')); - $this->assertEquals('bar', $storage1->file_get_contents('target/subfolder/test.txt')); + $this->storage2->mkdir('source'); + $this->storage2->file_put_contents('source/test1.txt', 'foo'); + $this->storage2->file_put_contents('source/test2.txt', 'qwerty'); + $this->storage2->mkdir('source/subfolder'); + $this->storage2->file_put_contents('source/subfolder/test.txt', 'bar'); + + $this->storage1->copyFromStorage($this->storage2, 'source', 'target'); + + $this->assertTrue($this->storage1->file_exists('target')); + $this->assertTrue($this->storage1->file_exists('target/test1.txt')); + $this->assertTrue($this->storage1->file_exists('target/test2.txt')); + $this->assertTrue($this->storage1->file_exists('target/subfolder')); + $this->assertTrue($this->storage1->file_exists('target/subfolder/test.txt')); + + $this->assertTrue($this->storage2->file_exists('source')); + $this->assertTrue($this->storage2->file_exists('source/test1.txt')); + $this->assertTrue($this->storage2->file_exists('source/test2.txt')); + $this->assertTrue($this->storage2->file_exists('source/subfolder')); + $this->assertTrue($this->storage2->file_exists('source/subfolder/test.txt')); + + $this->assertEquals('foo', $this->storage1->file_get_contents('target/test1.txt')); + $this->assertEquals('qwerty', $this->storage1->file_get_contents('target/test2.txt')); + $this->assertEquals('bar', $this->storage1->file_get_contents('target/subfolder/test.txt')); } } |