diff options
author | provokateurin <kate@provokateurin.de> | 2024-09-19 11:10:31 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-09-19 14:21:20 +0200 |
commit | 9836e9b16484582d309c8437ab46d82e34956941 (patch) | |
tree | d3da87bb7dfd1a8877ed25072ecf609def844089 /tests/lib/Archive | |
parent | 8c60ffa0f21414e6e671c567d664a9b9e5253e26 (diff) | |
download | nextcloud-server-9836e9b16484582d309c8437ab46d82e34956941.tar.gz nextcloud-server-9836e9b16484582d309c8437ab46d82e34956941.zip |
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'tests/lib/Archive')
-rw-r--r-- | tests/lib/Archive/TestBase.php | 44 | ||||
-rw-r--r-- | tests/lib/Archive/ZIPTest.php | 2 |
2 files changed, 23 insertions, 23 deletions
diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php index 3f2d8c9561e..fda485d2dc1 100644 --- a/tests/lib/Archive/TestBase.php +++ b/tests/lib/Archive/TestBase.php @@ -28,10 +28,10 @@ abstract class TestBase extends \Test\TestCase { $this->instance = $this->getExisting(); $allFiles = $this->instance->getFiles(); $expected = ['lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt']; - $this->assertEquals(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files'); + $this->assertEquals(4, count($allFiles), 'only found ' . count($allFiles) . ' out of 4 expected files'); foreach ($expected as $file) { - $this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive'); - $this->assertTrue($this->instance->fileExists($file), 'file '.$file.' does not exist in archive'); + $this->assertContains($file, $allFiles, 'cant find ' . $file . ' in archive'); + $this->assertTrue($this->instance->fileExists($file), 'file ' . $file . ' does not exist in archive'); } $this->assertFalse($this->instance->fileExists('non/existing/file')); @@ -39,21 +39,21 @@ abstract class TestBase extends \Test\TestCase { $expected = ['lorem.txt','logo-wide.png', 'dir/']; $this->assertEquals(3, count($rootContent)); foreach ($expected as $file) { - $this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive'); + $this->assertContains($file, $rootContent, 'cant find ' . $file . ' in archive'); } $dirContent = $this->instance->getFolder('dir/'); $expected = ['lorem.txt']; $this->assertEquals(1, count($dirContent)); foreach ($expected as $file) { - $this->assertContains($file, $dirContent, 'cant find '. $file . ' in archive'); + $this->assertContains($file, $dirContent, 'cant find ' . $file . ' in archive'); } } public function testContent(): void { $this->instance = $this->getExisting(); - $dir = \OC::$SERVERROOT.'/tests/data'; - $textFile = $dir.'/lorem.txt'; + $dir = \OC::$SERVERROOT . '/tests/data'; + $textFile = $dir . '/lorem.txt'; $this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt')); $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt'); @@ -62,8 +62,8 @@ abstract class TestBase extends \Test\TestCase { } public function testWrite(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; - $textFile = $dir.'/lorem.txt'; + $dir = \OC::$SERVERROOT . '/tests/data'; + $textFile = $dir . '/lorem.txt'; $this->instance = $this->getNew(); $this->assertEquals(0, count($this->instance->getFiles())); $this->instance->addFile('lorem.txt', $textFile); @@ -77,24 +77,24 @@ abstract class TestBase extends \Test\TestCase { } public function testReadStream(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getExisting(); $fh = $this->instance->getStream('lorem.txt', 'r'); $this->assertTrue((bool)$fh); $content = fread($fh, $this->instance->filesize('lorem.txt')); fclose($fh); - $this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content); + $this->assertEquals(file_get_contents($dir . '/lorem.txt'), $content); } public function testWriteStream(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getNew(); $fh = $this->instance->getStream('lorem.txt', 'w'); - $source = fopen($dir.'/lorem.txt', 'r'); + $source = fopen($dir . '/lorem.txt', 'r'); \OCP\Files::streamCopy($source, $fh); fclose($source); fclose($fh); $this->assertTrue($this->instance->fileExists('lorem.txt')); - $this->assertEquals(file_get_contents($dir.'/lorem.txt'), $this->instance->getFile('lorem.txt')); + $this->assertEquals(file_get_contents($dir . '/lorem.txt'), $this->instance->getFile('lorem.txt')); } public function testFolder(): void { $this->instance = $this->getNew(); @@ -108,19 +108,19 @@ abstract class TestBase extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('/test/')); } public function testExtract(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getExisting(); $tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $this->instance->extract($tmpDir); - $this->assertEquals(true, file_exists($tmpDir.'lorem.txt')); - $this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt')); - $this->assertEquals(true, file_exists($tmpDir.'logo-wide.png')); - $this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt')); + $this->assertEquals(true, file_exists($tmpDir . 'lorem.txt')); + $this->assertEquals(true, file_exists($tmpDir . 'dir/lorem.txt')); + $this->assertEquals(true, file_exists($tmpDir . 'logo-wide.png')); + $this->assertEquals(file_get_contents($dir . '/lorem.txt'), file_get_contents($tmpDir . 'lorem.txt')); \OCP\Files::rmdirr($tmpDir); } public function testMoveRemove(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; - $textFile = $dir.'/lorem.txt'; + $dir = \OC::$SERVERROOT . '/tests/data'; + $textFile = $dir . '/lorem.txt'; $this->instance = $this->getNew(); $this->instance->addFile('lorem.txt', $textFile); $this->assertFalse($this->instance->fileExists('target.txt')); @@ -132,7 +132,7 @@ abstract class TestBase extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('target.txt')); } public function testRecursive(): void { - $dir = \OC::$SERVERROOT.'/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; $this->instance = $this->getNew(); $this->instance->addRecursive('/dir', $dir); $this->assertTrue($this->instance->fileExists('/dir/lorem.txt')); diff --git a/tests/lib/Archive/ZIPTest.php b/tests/lib/Archive/ZIPTest.php index 62467ca230e..25707e4b051 100644 --- a/tests/lib/Archive/ZIPTest.php +++ b/tests/lib/Archive/ZIPTest.php @@ -16,6 +16,6 @@ class ZIPTest extends TestBase { } protected function getNew() { - return new ZIP(\OC::$server->getTempManager()->getTempBaseDir().'/newArchive.zip'); + return new ZIP(\OC::$server->getTempManager()->getTempBaseDir() . '/newArchive.zip'); } } |