From 86833f88358e2ff1c3cdea613141441c6efb3eb9 Mon Sep 17 00:00:00 2001 From: Al Ganiev Date: Sun, 1 Dec 2024 23:15:58 +1000 Subject: [PATCH] deprecations fix --- .gitignore | 13 +++++- composer.json | 6 +++ phpunit.xml.dist | 41 ++++++++++--------- .../ElFinderConfigurationReaderTest.php | 16 ++++---- .../ConfigurationLoadTest.php | 8 ++-- tests/Loader/ElFinderLoaderTest.php | 2 +- 6 files changed, 52 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 535fc47..3af2493 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,15 @@ vendor .php-cs-fixer.cache clover.xml .vscode -.phpunit.result.cache \ No newline at end of file +.phpunit.result.cache +###> symfony/framework-bundle ### +/.env.local +/.env.local.php +/.env.*.local +/config/secrets/prod/prod.decrypt.private.php +/public/bundles/ +/var/ +/vendor/ +###< symfony/framework-bundle ### +/phpunit.xml +/bin \ No newline at end of file diff --git a/composer.json b/composer.json index 30c5e3a..f049a30 100644 --- a/composer.json +++ b/composer.json @@ -68,5 +68,11 @@ "branch-alias": { "dev-master": "13.0-dev" } + }, + "scripts": { + "auto-scripts": { + "cache:clear": "symfony-cmd", + "assets:install %PUBLIC_DIR%": "symfony-cmd" + } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fb1c3b7..4f48b2e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,20 +1,11 @@ - - - - ./ - - - ./src/Controller - ./src/Resources - ./tests - ./vendor - + + @@ -22,10 +13,11 @@ + + + + - - - ./tests @@ -34,4 +26,15 @@ + + + ./ + + + ./src/Controller + ./src/Resources + ./tests + ./vendor + + diff --git a/tests/Configuration/ElFinderConfigurationReaderTest.php b/tests/Configuration/ElFinderConfigurationReaderTest.php index 817da1f..a5635ab 100644 --- a/tests/Configuration/ElFinderConfigurationReaderTest.php +++ b/tests/Configuration/ElFinderConfigurationReaderTest.php @@ -32,13 +32,13 @@ private function getConfigurationReader($attributesObject) $containerMock ->expects($this->any()) ->method('get') - ->will($this->returnValueMap([ + ->willReturnMap([ [ 'elfinder.driver.local', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->elFinderVolumeMock, ], - ])); + ]); /** @var \Symfony\Component\HttpFoundation\RequestStack $requestStack|\PHPUnit_Framework_MockObject_MockObject */ $requestStack = $this->createMock('Symfony\Component\HttpFoundation\RequestStack'); @@ -48,22 +48,22 @@ private function getConfigurationReader($attributesObject) $requestObject ->expects($this->any()) ->method('getScheme') - ->will($this->returnValue('http')); + ->willReturn('http'); $requestObject ->expects($this->any()) ->method('getHttpHost') - ->will($this->returnValue('test.com')); + ->willReturn('test.com'); $requestObject ->expects($this->any()) ->method('getBaseUrl') - ->will($this->returnValue('/unit-test')); + ->willReturn('/unit-test'); $requestObject->attributes = $attributesObject; $requestStack ->expects($this->any()) ->method('getCurrentRequest') - ->will($this->returnValue($requestObject)); + ->willReturn($requestObject); $params = [ 'instances' => [ @@ -298,7 +298,7 @@ private function getDefaultAttributesObject() $attributesObject ->expects($this->any()) ->method('get') - ->will($this->returnValue('')); + ->willReturn(''); return $attributesObject; } @@ -311,7 +311,7 @@ private function getHomeFolderAwareAttributesObject() ->expects($this->any()) ->method('get') ->with($this->equalTo('homeFolder')) - ->will($this->returnValue('bob')); + ->willReturn('bob'); return $attributesObject; } diff --git a/tests/DependencyInjection/ConfigurationLoadTest.php b/tests/DependencyInjection/ConfigurationLoadTest.php index e355db0..ca1df89 100644 --- a/tests/DependencyInjection/ConfigurationLoadTest.php +++ b/tests/DependencyInjection/ConfigurationLoadTest.php @@ -5,6 +5,7 @@ use FM\ElfinderBundle\DependencyInjection\FMElfinderExtension; use FM\ElfinderBundle\DependencyInjection\Configuration; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; +use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; @@ -20,11 +21,8 @@ protected function getConfiguration(): ConfigurationInterface return new Configuration(); } - /** - * @dataProvider getSupportsAllConfigFormatsData - * @requires PHP 7 - */ - public function testSupportsAllConfigFormats($path) + #[DataProvider('getSupportsAllConfigFormatsData')] + public function testSupportsAllConfigFormats($path): void { $expectedConfiguration = [ 'configuration_provider' => 'app.configurator.custom', diff --git a/tests/Loader/ElFinderLoaderTest.php b/tests/Loader/ElFinderLoaderTest.php index fde2aaa..b10032b 100644 --- a/tests/Loader/ElFinderLoaderTest.php +++ b/tests/Loader/ElFinderLoaderTest.php @@ -16,7 +16,7 @@ public function setUp(): void $this->configuratorMock = $this->createMock(ElFinderConfigurationProviderInterface::class); $this->configuratorMock->expects($this->any()) ->method('getConfiguration') - ->will($this->returnValue(['parameters' => []])); + ->willReturn(['parameters' => []]); $this->loader = new ElFinderLoader($this->configuratorMock); $this->loader->setInstance('minimal'); }