diff options
Diffstat (limited to 'tests/lib/LargeFileHelperGetFileSizeTest.php')
-rw-r--r-- | tests/lib/LargeFileHelperGetFileSizeTest.php | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/tests/lib/LargeFileHelperGetFileSizeTest.php b/tests/lib/LargeFileHelperGetFileSizeTest.php index 6fa2555b6d0..fbf22f1eb87 100644 --- a/tests/lib/LargeFileHelperGetFileSizeTest.php +++ b/tests/lib/LargeFileHelperGetFileSizeTest.php @@ -1,14 +1,17 @@ <?php + /** - * Copyright (c) 2014 Andreas Fischer <bantu@owncloud.com> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace Test; use bantu\IniGetWrapper\IniGetWrapper; +use OC\LargeFileHelper; +use OCP\Server; +use OCP\Util; /** * Tests whether LargeFileHelper is able to determine file size at all. @@ -24,10 +27,10 @@ class LargeFileHelperGetFileSizeTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->helper = new \OC\LargeFileHelper(); + $this->helper = new LargeFileHelper(); } - public function dataFileNameProvider() { + public static function dataFileNameProvider(): array { $path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR; return [ @@ -36,16 +39,14 @@ class LargeFileHelperGetFileSizeTest extends TestCase { ]; } - /** - * @dataProvider dataFileNameProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataFileNameProvider')] public function XtestGetFileSizeViaCurl($filename, $fileSize) { if (!extension_loaded('curl')) { $this->markTestSkipped( 'The PHP curl extension is required for this test.' ); } - if (\OC::$server->get(IniGetWrapper::class)->getString('open_basedir') !== '') { + if (Server::get(IniGetWrapper::class)->getString('open_basedir') !== '') { $this->markTestSkipped( 'The PHP curl extension does not work with the file:// protocol when open_basedir is enabled.' ); @@ -56,14 +57,12 @@ class LargeFileHelperGetFileSizeTest extends TestCase { ); } - /** - * @dataProvider dataFileNameProvider - */ - public function testGetFileSizeViaExec($filename, $fileSize) { + #[\PHPUnit\Framework\Attributes\DataProvider('dataFileNameProvider')] + public function testGetFileSizeViaExec($filename, $fileSize): void { if (escapeshellarg('strängé') !== '\'strängé\'') { $this->markTestSkipped('Your escapeshell args removes accents'); } - if (!\OCP\Util::isFunctionEnabled('exec')) { + if (!Util::isFunctionEnabled('exec')) { $this->markTestSkipped( 'The exec() function needs to be enabled for this test.' ); @@ -74,10 +73,8 @@ class LargeFileHelperGetFileSizeTest extends TestCase { ); } - /** - * @dataProvider dataFileNameProvider - */ - public function testGetFileSizeNative($filename, $fileSize) { + #[\PHPUnit\Framework\Attributes\DataProvider('dataFileNameProvider')] + public function testGetFileSizeNative($filename, $fileSize): void { $this->assertSame( $fileSize, $this->helper->getFileSizeNative($filename) |