Skip to content

Commit

Permalink
deprecations fix
Browse files Browse the repository at this point in the history
  • Loading branch information
helios-ag committed Dec 1, 2024
1 parent 8251848 commit 86833f8
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 34 deletions.
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ vendor
.php-cs-fixer.cache
clover.xml
.vscode
.phpunit.result.cache
.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
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,11 @@
"branch-alias": {
"dev-master": "13.0-dev"
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
41 changes: 22 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
>
<coverage includeUncoveredFiles="true">
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./src/Controller</directory>
<directory>./src/Resources</directory>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<coverage>
<report>
<clover outputFile="./clover.xml"/>
</report>
</coverage>
<php>
<server name="KERNEL_DIR" value="./tests/Functional"/>
<ini name="error_reporting" value="-1"/>
<!-- ###+ symfony/framework-bundle ### -->
<env name="APP_ENV" value="dev"/>
<env name="APP_SECRET" value=""/>
<!-- ###- symfony/framework-bundle ### -->
</php>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<testsuites>
<testsuite name="FMElfinderBundle test suite">
<directory>./tests</directory>
Expand All @@ -34,4 +26,15 @@
<logging>
<!-- and this is where your report will be written -->
</logging>
<source>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./src/Controller</directory>
<directory>./src/Resources</directory>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</source>
</phpunit>
16 changes: 8 additions & 8 deletions tests/Configuration/ElFinderConfigurationReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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' => [
Expand Down Expand Up @@ -298,7 +298,7 @@ private function getDefaultAttributesObject()
$attributesObject
->expects($this->any())
->method('get')
->will($this->returnValue(''));
->willReturn('');

return $attributesObject;
}
Expand All @@ -311,7 +311,7 @@ private function getHomeFolderAwareAttributesObject()
->expects($this->any())
->method('get')
->with($this->equalTo('homeFolder'))
->will($this->returnValue('bob'));
->willReturn('bob');

return $attributesObject;
}
Expand Down
8 changes: 3 additions & 5 deletions tests/DependencyInjection/ConfigurationLoadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion tests/Loader/ElFinderLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 86833f8

Please sign in to comment.