diff --git a/.gitattributes b/.gitattributes index c47225a..69a7d65 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,15 +1,12 @@ -.editorconfig export-ignore -.gitattributes export-ignore -/.github/ export-ignore -.gitignore export-ignore -/.php_cs export-ignore -/.scrutinizer.yml export-ignore -/.styleci.yml export-ignore -/.travis.yml export-ignore -/behat.yml.dist export-ignore -/features/ export-ignore -/phpspec.ci.yml export-ignore -/phpspec.yml.dist export-ignore -/phpunit.xml.dist export-ignore -/spec/ export-ignore -/tests/ export-ignore +/.github/ export-ignore +/doc/ export-ignore +/tests/ export-ignore +/.editorconfig export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.php export-ignore +/CODE_OF_CONDUCT.md export-ignore +/CONTRIBUTING.md export-ignore +/phpstan.neon.dist export-ignore +/phpstan-baseline.neon export-ignore +/phpunit.xml.dist export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfb1cf1..7565418 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,109 +1,109 @@ name: CI -on: [push, pull_request] +on: [ push, pull_request ] concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: - phpstan: - name: PHPStan - runs-on: ubuntu-latest - env: - php-version: 8.2 - steps: - - name: "Setup PHP" - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ env.php-version }} - tools: flex + phpstan: + name: PHPStan + runs-on: ubuntu-latest + env: + php-version: 8.2 + steps: + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.php-version }} + tools: flex - - name: "Checkout code" - uses: actions/checkout@v4 + - name: "Checkout code" + uses: actions/checkout@v4 - - name: "Install Composer dependencies" - uses: "ramsey/composer-install@v2" - with: - composer-options: "--optimize-autoloader" + - name: "Install Composer dependencies" + uses: "ramsey/composer-install@v3" + with: + composer-options: "--optimize-autoloader" - - name: "Run PHPStan" - run: | - vendor/bin/simple-phpunit --version - vendor/bin/phpstan analyse --no-progress + - name: "Run PHPStan" + run: | + vendor/bin/simple-phpunit --version + vendor/bin/phpstan analyse --no-progress - php-cs-fixer: - name: PHP-CS-Fixer - runs-on: ubuntu-latest - env: - php-version: 8.2 - steps: - - name: "Setup PHP" - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ env.php-version }} - tools: flex, cs2pr + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-latest + env: + php-version: 8.2 + steps: + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ env.php-version }} + tools: flex, cs2pr - - name: "Checkout code" - uses: actions/checkout@v4 + - name: "Checkout code" + uses: actions/checkout@v4 - - name: "Install Composer dependencies" - uses: "ramsey/composer-install@v2" - with: - composer-options: "--optimize-autoloader" + - name: "Install Composer dependencies" + uses: "ramsey/composer-install@v3" + with: + composer-options: "--optimize-autoloader" - - name: "Run PHP-CS-Fixer" - run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr + - name: "Run PHP-CS-Fixer" + run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr - phpunit: - name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }}) (${{ matrix.dependencies }}) - runs-on: ubuntu-latest - strategy: - max-parallel: 10 - fail-fast: true - matrix: - dependencies: ['highest'] - php: ['7.4', '8.0', '8.1', '8.2'] - include: - - php: '7.4' - sf_version: '4.4.*' - dependencies: 'lowest' - - php: '7.4' - sf_version: '4.4.*' - - php: '7.4' - sf_version: '5.4.*' - dependencies: 'lowest' - - php: '8.0' - sf_version: '5.4.*' - - php: '8.1' - sf_version: '5.4.*' - - php: '8.0' - sf_version: '6.0.*' - - php: '8.1' - sf_version: '6.0.*' - - php: '8.2' - sf_version: '6.2.*' - - php: '8.2' - sf_version: '6.4.*' - - php: '8.2' - sf_version: '7.0.*' - steps: - - name: "Setup PHP" - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - tools: flex - coverage: none + phpunit: + name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }}) (${{ matrix.dependencies }}) + runs-on: ubuntu-latest + strategy: + max-parallel: 10 + fail-fast: false + matrix: + dependencies: ['highest'] + php: [ '7.4', '8.0', '8.1', '8.2' ] + sf_version: [ '4.4.*', '5.4.*', '6.4.*', '7.0.*' ] +# include: +# - php: '7.4' +# sf_version: '4.4.*' +# dependencies: 'lowest' +# - php: '7.4' +# sf_version: '5.4.*' +# dependencies: 'lowest' + exclude: + - php: '7.4' + sf_version: '4.4.*' + - php: '7.4' + sf_version: '6.4.*' + - php: '8.0' + sf_version: '6.4.*' + - php: '7.4' + sf_version: '7.0.*' + - php: '8.0' + sf_version: '7.0.*' + - php: '8.1' + sf_version: '7.0.*' + steps: + - name: "Checkout code" + uses: actions/checkout@v4 - - name: "Checkout code" - uses: actions/checkout@v4 + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: flex + coverage: none - - name: "Install Composer dependencies" - uses: "ramsey/composer-install@v2" - with: - composer-options: "--optimize-autoloader" - dependency-versions: "${{ matrix.dependencies }}" + - name: "Install Composer dependencies" + env: + SYMFONY_REQUIRE: ${{ matrix.sf_version }} + uses: "ramsey/composer-install@v3" + with: + composer-options: "--optimize-autoloader" + dependency-versions: "${{ matrix.dependencies }}" - - name: "Run tests" - env: - SYMFONY_DEPRECATIONS_HELPER: 'max[self]=3&max[indirect]=1' - run: ./vendor/bin/simple-phpunit -v + - name: "Run tests" + env: + SYMFONY_DEPRECATIONS_HELPER: 'ignoreFile=./tests/baseline-ignore' + run: ./vendor/bin/simple-phpunit -v diff --git a/.gitignore b/.gitignore index 83bf107..09c376e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ composer.lock -composer.phar phpunit.xml vendor/ -.php_cs.cache .php-cs-fixer.cache .phpunit.result.cache diff --git a/composer.json b/composer.json index 2cba9b9..830303a 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,10 @@ { "name": "willdurand/geocoder-bundle", "description": "Integration of Geocoder into Symfony", - "keywords": ["geocoding", "geocoder"], + "keywords": [ + "geocoding", + "geocoder" + ], "type": "symfony-bundle", "license": "MIT", "authors": [ @@ -15,17 +18,17 @@ "geocoder-php/plugin": "^1.5", "php-http/curl-client": "^2.3", "php-http/discovery": "^1.14", - "symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/options-resolver": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/console": "^4.4 || ^5.4 || ^6.4 || ^7.0", + "symfony/framework-bundle": "^4.4 || ^5.4 || ^6.4 || ^7.0", + "symfony/options-resolver": "^4.4 || ^5.4 || ^6.4 || ^7.0", "willdurand/geocoder": "^4.6" }, "require-dev": { "doctrine/annotations": "^1.11.1 || ^2.0", "doctrine/doctrine-bundle": "^2.3", - "doctrine/orm": "~2.8", + "doctrine/orm": "^2.8", "fakerphp/faker": "^1.20", - "friendsofphp/php-cs-fixer": "^3.13", + "friendsofphp/php-cs-fixer": "^3.0", "geocoder-php/algolia-places-provider": "^0.4", "geocoder-php/arcgis-online-provider": "^4.4", "geocoder-php/bing-maps-provider": "^4.3", @@ -58,15 +61,17 @@ "geoip/geoip": "~1.17", "nyholm/nsa": "^1.3", "nyholm/psr7": "^1.5", - "nyholm/symfony-bundle-test": "dev-master", - "php-http/mock-client": "^1.6", + "nyholm/symfony-bundle-test": "^2.0 || ^3.0", "php-http/message": "^1.13", + "php-http/mock-client": "^1.6", "phpstan/phpstan": "^1.9.2", "psr/http-client": "^1.0", + "psr/simple-cache": "^1.0 || ^2.0", "symfony/cache": "^4.4 || ^5.0 || ^6.0 || ^7.0", "symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0", - "symfony/phpunit-bridge": "^5.2 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^6.1", "symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0", + "symfony/var-exporter": "^5.0 || ^6.0 || ^7.0", "symfony/yaml": "^4.4 || ^5.0 || ^6.0 || ^7.0" }, "conflict": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ac33fcc..864b650 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -55,11 +55,6 @@ parameters: count: 1 path: src/DependencyInjection/BazingaGeocoderExtension.php - - - message: "#^Cannot cast mixed to int\\.$#" - count: 2 - path: src/DependencyInjection/BazingaGeocoderExtension.php - - message: "#^Cannot cast mixed to string\\.$#" count: 1 @@ -82,7 +77,7 @@ parameters: - message: "#^Parameter \\#1 \\$id of class Symfony\\\\Component\\\\DependencyInjection\\\\Reference constructor expects string, mixed given\\.$#" - count: 3 + count: 1 path: src/DependencyInjection/BazingaGeocoderExtension.php - @@ -121,12 +116,12 @@ parameters: path: src/DependencyInjection/BazingaGeocoderExtension.php - - message: "#^Cannot call method end\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#" + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:end\\(\\)\\.$#" count: 2 path: src/DependencyInjection/Configuration.php - - message: "#^Cannot call method variableNode\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#" + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:variableNode\\(\\)\\.$#" count: 1 path: src/DependencyInjection/Configuration.php @@ -140,11 +135,6 @@ parameters: count: 1 path: src/Doctrine/ORM/GeocoderListener.php - - - message: "#^Method Bazinga\\\\GeocoderBundle\\\\Plugin\\\\FakeIpPlugin\\:\\:handleQuery\\(\\) return type with generic interface Http\\\\Promise\\\\Promise does not specify its types\\: T$#" - count: 1 - path: src/Plugin/FakeIpPlugin.php - - message: "#^Parameter \\#1 \\$text of method Geocoder\\\\Query\\\\GeocodeQuery\\:\\:withText\\(\\) expects string, string\\|null given\\.$#" count: 1 @@ -155,11 +145,6 @@ parameters: count: 1 path: src/Plugin/FakeIpPlugin.php - - - message: "#^Method Bazinga\\\\GeocoderBundle\\\\Plugin\\\\ProfilingPlugin\\:\\:handleQuery\\(\\) return type with generic interface Http\\\\Promise\\\\Promise does not specify its types\\: T$#" - count: 1 - path: src/Plugin/ProfilingPlugin.php - - message: "#^Parameter \\#1 \\$accountId of class GeoIp2\\\\WebService\\\\Client constructor expects int, int\\|null given\\.$#" count: 1 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 85c1a78..5d36cb5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,28 +1,31 @@ - + + + src + + + ./tests - - - src - - - - + diff --git a/src/DataCollector/GeocoderDataCollector.php b/src/DataCollector/GeocoderDataCollector.php index 688932f..0a8ec82 100644 --- a/src/DataCollector/GeocoderDataCollector.php +++ b/src/DataCollector/GeocoderDataCollector.php @@ -47,7 +47,7 @@ public function reset() /** * @return void */ - public function collect(Request $request, Response $response, \Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null) { if (!empty($this->data['queries'])) { // To avoid collection more that once. diff --git a/src/DependencyInjection/BazingaGeocoderExtension.php b/src/DependencyInjection/BazingaGeocoderExtension.php index a48ac76..9ea854a 100644 --- a/src/DependencyInjection/BazingaGeocoderExtension.php +++ b/src/DependencyInjection/BazingaGeocoderExtension.php @@ -30,9 +30,9 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * @author William Durand . diff --git a/src/Plugin/FakeIpPlugin.php b/src/Plugin/FakeIpPlugin.php index 64a8f5c..e45ff2d 100644 --- a/src/Plugin/FakeIpPlugin.php +++ b/src/Plugin/FakeIpPlugin.php @@ -30,7 +30,7 @@ class FakeIpPlugin implements Plugin private ?string $replacement; private ?Generator $faker = null; - public function __construct(?string $needle, string $replacement = null, bool $useFaker = false) + public function __construct(?string $needle, ?string $replacement = null, bool $useFaker = false) { $this->needle = $needle; $this->replacement = $replacement; diff --git a/src/ProviderFactory/AbstractFactory.php b/src/ProviderFactory/AbstractFactory.php index 069ca66..83da203 100644 --- a/src/ProviderFactory/AbstractFactory.php +++ b/src/ProviderFactory/AbstractFactory.php @@ -32,7 +32,7 @@ abstract class AbstractFactory implements ProviderFactoryInterface protected ?ClientInterface $httpClient; - public function __construct(ClientInterface $httpClient = null) + public function __construct(?ClientInterface $httpClient = null) { $this->httpClient = $httpClient; } diff --git a/src/Validator/Constraint/Address.php b/src/Validator/Constraint/Address.php index 36cfe12..29a0484 100644 --- a/src/Validator/Constraint/Address.php +++ b/src/Validator/Constraint/Address.php @@ -16,7 +16,6 @@ /** * @Annotation - * * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) * * @author Tomas Norkūnas @@ -50,7 +49,7 @@ class Address extends Constraint /** * @param string[]|null $options */ - public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) + public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, $payload = null) { parent::__construct($options, $groups, $payload); diff --git a/tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php b/tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php index 4328bda..0b7f3f7 100644 --- a/tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php +++ b/tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php @@ -34,7 +34,7 @@ protected function tearDown(): void $reflection = new \ReflectionObject($this->compilerPass); $prop = $reflection->getProperty('factoryServiceIds'); $prop->setAccessible(true); - $prop->setValue([]); + $prop->setValue(null, []); } public function testProcessThrows(): void diff --git a/tests/Functional/BundleInitializationTest.php b/tests/Functional/BundleInitializationTest.php index c393c77..aeaba3a 100644 --- a/tests/Functional/BundleInitializationTest.php +++ b/tests/Functional/BundleInitializationTest.php @@ -55,6 +55,10 @@ public function testInitBundle(): void { $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -70,6 +74,10 @@ public function testBundleWithOneProviderConfiguration(): void $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/simple.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -85,6 +93,10 @@ public function testBundleWithCachedProvider(): void $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/cache.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -102,6 +114,10 @@ public function testCacheLifetimeCanBeNull(): void $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/cache_without_lifetime.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -127,6 +143,10 @@ public function testBundleWithPluginsYml(): void $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/service_plugin.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -144,6 +164,10 @@ public function testBundleWithPluginXml(): void $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/service_plugin.xml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -160,6 +184,10 @@ public function testBundleHasRegisteredDumpers(): void { $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); diff --git a/tests/Functional/CustomTestKernel.php b/tests/Functional/CustomTestKernel.php index 393172c..0f7e5ea 100644 --- a/tests/Functional/CustomTestKernel.php +++ b/tests/Functional/CustomTestKernel.php @@ -80,7 +80,7 @@ protected function getKernelParameters(): array /** * @internal */ - public function setAnnotatedClassCache(array $annotatedClasses) + public function setAnnotatedClassCache(array $annotatedClasses): void { file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', sprintf('getContainerClass(); $buildDir = $this->warmupDir ?: $this->getBuildDir(); diff --git a/tests/Functional/GeocoderListenerTest.php b/tests/Functional/GeocoderListenerTest.php index 3d42e85..d1b7f64 100644 --- a/tests/Functional/GeocoderListenerTest.php +++ b/tests/Functional/GeocoderListenerTest.php @@ -20,14 +20,18 @@ use Bazinga\GeocoderBundle\Tests\PublicServicePass; use Doctrine\Bundle\DoctrineBundle\ConnectionFactory; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; +use Doctrine\ORM\Configuration; use Doctrine\ORM\Tools\SchemaTool; use Http\Message\RequestMatcher\RequestMatcher; use Http\Mock\Client; use Nyholm\BundleTest\TestKernel; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\StreamInterface; +use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\KernelInterface; /** @@ -37,7 +41,9 @@ final class GeocoderListenerTest extends KernelTestCase { protected function tearDown(): void { - $em = self::getContainer()->get('doctrine.orm.entity_manager'); + $container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container; + + $em = $container->get('doctrine.orm.entity_manager'); $tool = new SchemaTool($em); $tool->dropSchema($em->getMetadataFactory()->getAllMetadata()); @@ -65,6 +71,24 @@ protected static function createKernel(array $options = []): KernelInterface 'report_fields_where_declared' => true, ], ]); + + if (method_exists(Configuration::class, 'setLazyGhostObjectEnabled') && Kernel::VERSION_ID >= 60100) { + $container->prependExtensionConfig('doctrine', [ + 'orm' => [ + 'enable_lazy_ghost_objects' => true, + ], + ]); + } + + if (class_exists(EntityValueResolver::class)) { + $container->prependExtensionConfig('doctrine', [ + 'orm' => [ + 'controller_resolver' => [ + 'auto_mapping' => false, + ], + ], + ]); + } }); } $kernel->handleOptions($options); @@ -78,32 +102,46 @@ public function testPersistForProperty(): void $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/listener.yml'); $kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); - $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); + $container = $kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container; $httpClient = $container->get(Client::class); $httpClient->on(new RequestMatcher(), function (RequestInterface $request) { if ('https://nominatim.openstreetmap.org/search?format=jsonv2&q=Berlin%2C%20Germany&addressdetails=1&extratags=1&limit=5' === (string) $request->getUri()) { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[{"place_id":159647018,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62422,"lat":"52.5170365","lon":"13.3888599","category":"boundary","type":"administrative","place_rank":8,"importance":0.7875390282491362,"addresstype":"city","name":"Berlin","display_name":"Berlin, Deutschland","address":{"city":"Berlin","ISO3166-2-lvl4":"DE-BE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "35", "email": "info@berlin.de", "place": "city", "capital": "yes", "website": "http://www.berlin.de", "de:place": "city", "ref:nuts": "DE3;DE30;DE300", "wikidata": "Q64", "wikipedia": "de:Berlin", "population": "3769962", "ref:LOCODE": "DEBER", "ref:nuts:1": "DE3", "ref:nuts:2": "DE30", "ref:nuts:3": "DE300", "state_code": "BE", "name:prefix": "Land und Kreisfreie Stadt", "linked_place": "city", "official_status": "Land", "contact:facebook": "http://www.facebook.com/Berlin", "name:prefix:city": "Kreisfreie Stadt", "openGeoDB:loc_id": "14356", "capital_ISO3166-1": "yes", "name:prefix:state": "Land", "source:population": "https://download.statistik-berlin-brandenburg.de/fa93e3bd19a2e885/a5ecfb2fff6a/SB_A01-05-00_2020h02_BE.pdf", "license_plate_code": "B", "official_status:de": "Land", "official_status:en": "State", "official_status:ru": "земля", "geographical_region": "Barnim;Berliner Urstromtal;Teltow;Nauener Platte", "blind:description:de": "Auf www.berlinfuerblinde.de gibt es einen kostenlosen Audioguide und weitere Informationen.", "de:regionalschluessel": "110000000000", "openGeoDB:postal_codes": "10178,10115,10117,10119,10179,10243,10245,10247,10249,10315,10317,10318,10319,10365,10367,10369,10405,10407,10409,10435,10437,10439,10551,10553,10555,10557,10559,10585,10587,10589,10623,10625,10627,10629,10707,10709,10711,10713,10715,10717,10719,10777,10", "report_problems:website": "https://ordnungsamt.berlin.de/", "TMC:cid_58:tabcd_1:Class": "Area", "openGeoDB:license_plate_code": "B", "TMC:cid_58:tabcd_1:LCLversion": "12.0", "openGeoDB:telephone_area_code": "030", "TMC:cid_58:tabcd_1:LocationCode": "266", "de:amtlicher_gemeindeschluessel": "11000000", "openGeoDB:community_identification_number": "11000000"},"boundingbox":["52.3382448","52.6755087","13.0883450","13.7611609"]}]'); + $response = $this->createMock(ResponseInterface::class); $response->expects(self::once()) ->method('getStatusCode') ->willReturn(200); $response->expects(self::once()) ->method('getBody') - ->willReturn('[{"place_id":159647018,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62422,"lat":"52.5170365","lon":"13.3888599","category":"boundary","type":"administrative","place_rank":8,"importance":0.7875390282491362,"addresstype":"city","name":"Berlin","display_name":"Berlin, Deutschland","address":{"city":"Berlin","ISO3166-2-lvl4":"DE-BE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "35", "email": "info@berlin.de", "place": "city", "capital": "yes", "website": "http://www.berlin.de", "de:place": "city", "ref:nuts": "DE3;DE30;DE300", "wikidata": "Q64", "wikipedia": "de:Berlin", "population": "3769962", "ref:LOCODE": "DEBER", "ref:nuts:1": "DE3", "ref:nuts:2": "DE30", "ref:nuts:3": "DE300", "state_code": "BE", "name:prefix": "Land und Kreisfreie Stadt", "linked_place": "city", "official_status": "Land", "contact:facebook": "http://www.facebook.com/Berlin", "name:prefix:city": "Kreisfreie Stadt", "openGeoDB:loc_id": "14356", "capital_ISO3166-1": "yes", "name:prefix:state": "Land", "source:population": "https://download.statistik-berlin-brandenburg.de/fa93e3bd19a2e885/a5ecfb2fff6a/SB_A01-05-00_2020h02_BE.pdf", "license_plate_code": "B", "official_status:de": "Land", "official_status:en": "State", "official_status:ru": "земля", "geographical_region": "Barnim;Berliner Urstromtal;Teltow;Nauener Platte", "blind:description:de": "Auf www.berlinfuerblinde.de gibt es einen kostenlosen Audioguide und weitere Informationen.", "de:regionalschluessel": "110000000000", "openGeoDB:postal_codes": "10178,10115,10117,10119,10179,10243,10245,10247,10249,10315,10317,10318,10319,10365,10367,10369,10405,10407,10409,10435,10437,10439,10551,10553,10555,10557,10559,10585,10587,10589,10623,10625,10627,10629,10707,10709,10711,10713,10715,10717,10719,10777,10", "report_problems:website": "https://ordnungsamt.berlin.de/", "TMC:cid_58:tabcd_1:Class": "Area", "openGeoDB:license_plate_code": "B", "TMC:cid_58:tabcd_1:LCLversion": "12.0", "openGeoDB:telephone_area_code": "030", "TMC:cid_58:tabcd_1:LocationCode": "266", "de:amtlicher_gemeindeschluessel": "11000000", "openGeoDB:community_identification_number": "11000000"},"boundingbox":["52.3382448","52.6755087","13.0883450","13.7611609"]}]'); + ->willReturn($stream); return $response; } if ('https://nominatim.openstreetmap.org/search?format=jsonv2&q=Paris%2C%20France&addressdetails=1&extratags=1&limit=5' === (string) $request->getUri()) { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[{"place_id":115350921,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":7444,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":15,"importance":0.8317101715588673,"addresstype":"suburb","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"suburb":"Paris","city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"capital": "yes", "wikidata": "Q90", "ref:INSEE": "75056", "wikipedia": "fr:Paris", "population": "2187526", "ref:FR:MGP": "T1", "source:population": "INSEE 2020"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114827617,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":71525,"lat":"48.8534951","lon":"2.3483915","category":"boundary","type":"administrative","place_rank":12,"importance":0.8317101715588673,"addresstype":"city","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"rank": "0", "capital": "yes", "ref:nuts": "FR101", "wikidata": "Q90", "ref:INSEE": "75", "wikipedia": "fr:Paris", "is_capital": "country", "population": "2165423", "ref:nuts:3": "FR101", "linked_place": "city", "source:name:oc": "ieo-bdtopoc", "contact:website": "http://www.paris.fr", "population:date": "2019", "capital_ISO3166-1": "yes", "source:population": "INSEE 2022"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114994164,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":1641193,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":14,"importance":0.4283953917728152,"addresstype":"city_district","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"wikidata": "Q2863958", "ref:INSEE": "751", "wikipedia": "fr:Arrondissement de Paris"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]}]'); + $response = $this->createMock(ResponseInterface::class); $response->expects(self::once()) ->method('getStatusCode') ->willReturn(200); $response->expects(self::once()) ->method('getBody') - ->willReturn('[{"place_id":115350921,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":7444,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":15,"importance":0.8317101715588673,"addresstype":"suburb","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"suburb":"Paris","city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"capital": "yes", "wikidata": "Q90", "ref:INSEE": "75056", "wikipedia": "fr:Paris", "population": "2187526", "ref:FR:MGP": "T1", "source:population": "INSEE 2020"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114827617,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":71525,"lat":"48.8534951","lon":"2.3483915","category":"boundary","type":"administrative","place_rank":12,"importance":0.8317101715588673,"addresstype":"city","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"rank": "0", "capital": "yes", "ref:nuts": "FR101", "wikidata": "Q90", "ref:INSEE": "75", "wikipedia": "fr:Paris", "is_capital": "country", "population": "2165423", "ref:nuts:3": "FR101", "linked_place": "city", "source:name:oc": "ieo-bdtopoc", "contact:website": "http://www.paris.fr", "population:date": "2019", "capital_ISO3166-1": "yes", "source:population": "INSEE 2022"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114994164,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":1641193,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":14,"importance":0.4283953917728152,"addresstype":"city_district","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"wikidata": "Q2863958", "ref:INSEE": "751", "wikipedia": "fr:Arrondissement de Paris"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]}]'); + ->willReturn($stream); return $response; } @@ -141,32 +179,46 @@ public function testPersistForGetter(): void $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/listener.yml'); $kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); - $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); + $container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container; $httpClient = $container->get(Client::class); $httpClient->on(new RequestMatcher(), function (RequestInterface $request) { if ('https://nominatim.openstreetmap.org/search?format=jsonv2&q=Berlin%2C%20Germany&addressdetails=1&extratags=1&limit=5' === (string) $request->getUri()) { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[{"place_id":159647018,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62422,"lat":"52.5170365","lon":"13.3888599","category":"boundary","type":"administrative","place_rank":8,"importance":0.7875390282491362,"addresstype":"city","name":"Berlin","display_name":"Berlin, Deutschland","address":{"city":"Berlin","ISO3166-2-lvl4":"DE-BE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "35", "email": "info@berlin.de", "place": "city", "capital": "yes", "website": "http://www.berlin.de", "de:place": "city", "ref:nuts": "DE3;DE30;DE300", "wikidata": "Q64", "wikipedia": "de:Berlin", "population": "3769962", "ref:LOCODE": "DEBER", "ref:nuts:1": "DE3", "ref:nuts:2": "DE30", "ref:nuts:3": "DE300", "state_code": "BE", "name:prefix": "Land und Kreisfreie Stadt", "linked_place": "city", "official_status": "Land", "contact:facebook": "http://www.facebook.com/Berlin", "name:prefix:city": "Kreisfreie Stadt", "openGeoDB:loc_id": "14356", "capital_ISO3166-1": "yes", "name:prefix:state": "Land", "source:population": "https://download.statistik-berlin-brandenburg.de/fa93e3bd19a2e885/a5ecfb2fff6a/SB_A01-05-00_2020h02_BE.pdf", "license_plate_code": "B", "official_status:de": "Land", "official_status:en": "State", "official_status:ru": "земля", "geographical_region": "Barnim;Berliner Urstromtal;Teltow;Nauener Platte", "blind:description:de": "Auf www.berlinfuerblinde.de gibt es einen kostenlosen Audioguide und weitere Informationen.", "de:regionalschluessel": "110000000000", "openGeoDB:postal_codes": "10178,10115,10117,10119,10179,10243,10245,10247,10249,10315,10317,10318,10319,10365,10367,10369,10405,10407,10409,10435,10437,10439,10551,10553,10555,10557,10559,10585,10587,10589,10623,10625,10627,10629,10707,10709,10711,10713,10715,10717,10719,10777,10", "report_problems:website": "https://ordnungsamt.berlin.de/", "TMC:cid_58:tabcd_1:Class": "Area", "openGeoDB:license_plate_code": "B", "TMC:cid_58:tabcd_1:LCLversion": "12.0", "openGeoDB:telephone_area_code": "030", "TMC:cid_58:tabcd_1:LocationCode": "266", "de:amtlicher_gemeindeschluessel": "11000000", "openGeoDB:community_identification_number": "11000000"},"boundingbox":["52.3382448","52.6755087","13.0883450","13.7611609"]}]'); + $response = $this->createMock(ResponseInterface::class); $response->expects(self::once()) ->method('getStatusCode') ->willReturn(200); $response->expects(self::once()) ->method('getBody') - ->willReturn('[{"place_id":159647018,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62422,"lat":"52.5170365","lon":"13.3888599","category":"boundary","type":"administrative","place_rank":8,"importance":0.7875390282491362,"addresstype":"city","name":"Berlin","display_name":"Berlin, Deutschland","address":{"city":"Berlin","ISO3166-2-lvl4":"DE-BE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "35", "email": "info@berlin.de", "place": "city", "capital": "yes", "website": "http://www.berlin.de", "de:place": "city", "ref:nuts": "DE3;DE30;DE300", "wikidata": "Q64", "wikipedia": "de:Berlin", "population": "3769962", "ref:LOCODE": "DEBER", "ref:nuts:1": "DE3", "ref:nuts:2": "DE30", "ref:nuts:3": "DE300", "state_code": "BE", "name:prefix": "Land und Kreisfreie Stadt", "linked_place": "city", "official_status": "Land", "contact:facebook": "http://www.facebook.com/Berlin", "name:prefix:city": "Kreisfreie Stadt", "openGeoDB:loc_id": "14356", "capital_ISO3166-1": "yes", "name:prefix:state": "Land", "source:population": "https://download.statistik-berlin-brandenburg.de/fa93e3bd19a2e885/a5ecfb2fff6a/SB_A01-05-00_2020h02_BE.pdf", "license_plate_code": "B", "official_status:de": "Land", "official_status:en": "State", "official_status:ru": "земля", "geographical_region": "Barnim;Berliner Urstromtal;Teltow;Nauener Platte", "blind:description:de": "Auf www.berlinfuerblinde.de gibt es einen kostenlosen Audioguide und weitere Informationen.", "de:regionalschluessel": "110000000000", "openGeoDB:postal_codes": "10178,10115,10117,10119,10179,10243,10245,10247,10249,10315,10317,10318,10319,10365,10367,10369,10405,10407,10409,10435,10437,10439,10551,10553,10555,10557,10559,10585,10587,10589,10623,10625,10627,10629,10707,10709,10711,10713,10715,10717,10719,10777,10", "report_problems:website": "https://ordnungsamt.berlin.de/", "TMC:cid_58:tabcd_1:Class": "Area", "openGeoDB:license_plate_code": "B", "TMC:cid_58:tabcd_1:LCLversion": "12.0", "openGeoDB:telephone_area_code": "030", "TMC:cid_58:tabcd_1:LocationCode": "266", "de:amtlicher_gemeindeschluessel": "11000000", "openGeoDB:community_identification_number": "11000000"},"boundingbox":["52.3382448","52.6755087","13.0883450","13.7611609"]}]'); + ->willReturn($stream); return $response; } if ('https://nominatim.openstreetmap.org/search?format=jsonv2&q=Paris%2C%20France&addressdetails=1&extratags=1&limit=5' === (string) $request->getUri()) { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[{"place_id":115350921,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":7444,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":15,"importance":0.8317101715588673,"addresstype":"suburb","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"suburb":"Paris","city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"capital": "yes", "wikidata": "Q90", "ref:INSEE": "75056", "wikipedia": "fr:Paris", "population": "2187526", "ref:FR:MGP": "T1", "source:population": "INSEE 2020"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114827617,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":71525,"lat":"48.8534951","lon":"2.3483915","category":"boundary","type":"administrative","place_rank":12,"importance":0.8317101715588673,"addresstype":"city","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"rank": "0", "capital": "yes", "ref:nuts": "FR101", "wikidata": "Q90", "ref:INSEE": "75", "wikipedia": "fr:Paris", "is_capital": "country", "population": "2165423", "ref:nuts:3": "FR101", "linked_place": "city", "source:name:oc": "ieo-bdtopoc", "contact:website": "http://www.paris.fr", "population:date": "2019", "capital_ISO3166-1": "yes", "source:population": "INSEE 2022"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114994164,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":1641193,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":14,"importance":0.4283953917728152,"addresstype":"city_district","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"wikidata": "Q2863958", "ref:INSEE": "751", "wikipedia": "fr:Arrondissement de Paris"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]}]'); + $response = $this->createMock(ResponseInterface::class); $response->expects(self::once()) ->method('getStatusCode') ->willReturn(200); $response->expects(self::once()) ->method('getBody') - ->willReturn('[{"place_id":115350921,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":7444,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":15,"importance":0.8317101715588673,"addresstype":"suburb","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"suburb":"Paris","city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"capital": "yes", "wikidata": "Q90", "ref:INSEE": "75056", "wikipedia": "fr:Paris", "population": "2187526", "ref:FR:MGP": "T1", "source:population": "INSEE 2020"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114827617,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":71525,"lat":"48.8534951","lon":"2.3483915","category":"boundary","type":"administrative","place_rank":12,"importance":0.8317101715588673,"addresstype":"city","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"rank": "0", "capital": "yes", "ref:nuts": "FR101", "wikidata": "Q90", "ref:INSEE": "75", "wikipedia": "fr:Paris", "is_capital": "country", "population": "2165423", "ref:nuts:3": "FR101", "linked_place": "city", "source:name:oc": "ieo-bdtopoc", "contact:website": "http://www.paris.fr", "population:date": "2019", "capital_ISO3166-1": "yes", "source:population": "INSEE 2022"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]},{"place_id":114994164,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":1641193,"lat":"48.8588897","lon":"2.3200410217200766","category":"boundary","type":"administrative","place_rank":14,"importance":0.4283953917728152,"addresstype":"city_district","name":"Paris","display_name":"Paris, Île-de-France, France métropolitaine, France","address":{"city_district":"Paris","city":"Paris","ISO3166-2-lvl6":"FR-75","state":"Île-de-France","ISO3166-2-lvl4":"FR-IDF","region":"France métropolitaine","country":"France","country_code":"fr"},"extratags":{"wikidata": "Q2863958", "ref:INSEE": "751", "wikipedia": "fr:Arrondissement de Paris"},"boundingbox":["48.8155755","48.9021560","2.2241220","2.4697602"]}]'); + ->willReturn($stream); return $response; } @@ -204,9 +256,13 @@ public function testPersistForInvalidGetter(): void $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/listener.yml'); $kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); - $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); + $container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container; $em = $container->get('doctrine.orm.entity_manager'); @@ -229,9 +285,13 @@ public function testPersistForEmptyProperty(): void $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/listener.yml'); $kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); - $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); + $container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container; $em = $container->get('doctrine.orm.entity_manager'); @@ -254,9 +314,13 @@ public function testDoesNotGeocodeIfAddressNotChanged(): void $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/listener.yml'); $kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); - $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); + $container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container; $httpRequests = 0; $httpClient = $container->get(Client::class); @@ -267,13 +331,23 @@ public function testDoesNotGeocodeIfAddressNotChanged(): void ->willReturn(200); if ('https://nominatim.openstreetmap.org/search?format=jsonv2&q=Frankfurt%2C%20Germany&addressdetails=1&extratags=1&limit=5' === (string) $request->getUri() && 0 === $httpRequests) { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[{"place_id":152571305,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62400,"lat":"50.1106444","lon":"8.6820917","category":"boundary","type":"administrative","place_rank":12,"importance":0.6941325622496303,"addresstype":"city","name":"Frankfurt am Main","display_name":"Frankfurt am Main, Hessen, Deutschland","address":{"city":"Frankfurt am Main","state":"Hessen","ISO3166-2-lvl4":"DE-HE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "112", "flag": "File:Flag of Frankfurt am Main.svg", "logo": "File:Frankfurt am Main logo.svg", "de:place": "city", "nickname": "Europastadt", "wikidata": "Q1794", "wikipedia": "de:Frankfurt am Main", "population": "701350", "ref:LOCODE": "DEFRA", "ref:nuts:3": "DE712", "border_type": "county", "name:prefix": "Stadt", "nickname:de": "Europastadt", "nickname:la": "Urbem Europaeam", "nickname:nl": "Bankfurt", "coat_of_arms": "File:Wappen Frankfurt am Main.svg", "linked_place": "city", "wikimedia_commons": "Category:Frankfurt am Main", "license_plate_code": "F", "de:regionalschluessel": "064120000000", "TMC:cid_58:tabcd_1:Class": "Area", "TMC:cid_58:tabcd_1:LCLversion": "9.00", "TMC:cid_58:tabcd_1:LocationCode": "414", "de:amtlicher_gemeindeschluessel": "06412000"},"boundingbox":["50.0153529","50.2271424","8.4727605","8.8004049"]},{"place_id":160849350,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62523,"lat":"52.3412273","lon":"14.549452","category":"boundary","type":"administrative","place_rank":12,"importance":0.5626903004005709,"addresstype":"city","name":"Frankfurt (Oder)","display_name":"Frankfurt (Oder), Brandenburg, Deutschland","address":{"city":"Frankfurt (Oder)","state":"Brandenburg","ISO3166-2-lvl4":"DE-BB","country":"Deutschland","country_code":"de"},"extratags":{"ele": "28", "place": "city", "website": "https://www.frankfurt-oder.de/", "de:place": "city", "wikidata": "Q4024", "wikipedia": "de:Frankfurt (Oder)", "population": "61969", "ref:LOCODE": "DEFFO", "ref:nuts:3": "DE403", "name:prefix": "Kreisfreie Stadt", "linked_place": "town", "license_plate_code": "FF", "telephone_area_code": "0335", "de:regionalschluessel": "120530000000", "TMC:cid_58:tabcd_1:Class": "Area", "TMC:cid_58:tabcd_1:LCLversion": "8.00", "TMC:cid_58:tabcd_1:LocationCode": "415", "de:amtlicher_gemeindeschluessel": "12053000"},"boundingbox":["52.2528709","52.3980721","14.3948254","14.6013644"]}]'); + $response->expects(self::once()) ->method('getBody') - ->willReturn('[{"place_id":152571305,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62400,"lat":"50.1106444","lon":"8.6820917","category":"boundary","type":"administrative","place_rank":12,"importance":0.6941325622496303,"addresstype":"city","name":"Frankfurt am Main","display_name":"Frankfurt am Main, Hessen, Deutschland","address":{"city":"Frankfurt am Main","state":"Hessen","ISO3166-2-lvl4":"DE-HE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "112", "flag": "File:Flag of Frankfurt am Main.svg", "logo": "File:Frankfurt am Main logo.svg", "de:place": "city", "nickname": "Europastadt", "wikidata": "Q1794", "wikipedia": "de:Frankfurt am Main", "population": "701350", "ref:LOCODE": "DEFRA", "ref:nuts:3": "DE712", "border_type": "county", "name:prefix": "Stadt", "nickname:de": "Europastadt", "nickname:la": "Urbem Europaeam", "nickname:nl": "Bankfurt", "coat_of_arms": "File:Wappen Frankfurt am Main.svg", "linked_place": "city", "wikimedia_commons": "Category:Frankfurt am Main", "license_plate_code": "F", "de:regionalschluessel": "064120000000", "TMC:cid_58:tabcd_1:Class": "Area", "TMC:cid_58:tabcd_1:LCLversion": "9.00", "TMC:cid_58:tabcd_1:LocationCode": "414", "de:amtlicher_gemeindeschluessel": "06412000"},"boundingbox":["50.0153529","50.2271424","8.4727605","8.8004049"]},{"place_id":160849350,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62523,"lat":"52.3412273","lon":"14.549452","category":"boundary","type":"administrative","place_rank":12,"importance":0.5626903004005709,"addresstype":"city","name":"Frankfurt (Oder)","display_name":"Frankfurt (Oder), Brandenburg, Deutschland","address":{"city":"Frankfurt (Oder)","state":"Brandenburg","ISO3166-2-lvl4":"DE-BB","country":"Deutschland","country_code":"de"},"extratags":{"ele": "28", "place": "city", "website": "https://www.frankfurt-oder.de/", "de:place": "city", "wikidata": "Q4024", "wikipedia": "de:Frankfurt (Oder)", "population": "61969", "ref:LOCODE": "DEFFO", "ref:nuts:3": "DE403", "name:prefix": "Kreisfreie Stadt", "linked_place": "town", "license_plate_code": "FF", "telephone_area_code": "0335", "de:regionalschluessel": "120530000000", "TMC:cid_58:tabcd_1:Class": "Area", "TMC:cid_58:tabcd_1:LCLversion": "8.00", "TMC:cid_58:tabcd_1:LocationCode": "415", "de:amtlicher_gemeindeschluessel": "12053000"},"boundingbox":["52.2528709","52.3980721","14.3948254","14.6013644"]}]'); + ->willReturn($stream); } else { + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[]'); + $response->expects(self::once()) ->method('getBody') - ->willReturn('[]'); + ->willReturn($stream); } ++$httpRequests; diff --git a/tests/Functional/Helper/CacheHelperV8.php b/tests/Functional/Helper/CacheHelperV8.php index a8fd141..939ef94 100644 --- a/tests/Functional/Helper/CacheHelperV8.php +++ b/tests/Functional/Helper/CacheHelperV8.php @@ -23,7 +23,7 @@ public function get(string $key, mixed $default = null): mixed { } - public function set(string $key, mixed $value, int|\DateInterval $ttl = null): bool + public function set(string $key, mixed $value, int|\DateInterval|null $ttl = null): bool { return true; } @@ -43,7 +43,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable return []; } - public function setMultiple(iterable $values, int|\DateInterval $ttl = null): bool + public function setMultiple(iterable $values, int|\DateInterval|null $ttl = null): bool { return true; } diff --git a/tests/Functional/PluginInteractionTest.php b/tests/Functional/PluginInteractionTest.php index 2164cd6..87e32f4 100644 --- a/tests/Functional/PluginInteractionTest.php +++ b/tests/Functional/PluginInteractionTest.php @@ -50,6 +50,10 @@ public function testCachePluginUsesIpFromFakeIpPlugin(): void $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/cache_symfony.yml'); $kernel->addTestConfig(__DIR__.'/config/geo_plugin_fakeip_with_cache_cn.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $kernel->setClearCacheAfterShutdown(false); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -64,6 +68,10 @@ public function testCachePluginUsesIpFromFakeIpPlugin(): void $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/cache_symfony.yml'); $kernel->addTestConfig(__DIR__.'/config/geo_plugin_fakeip_with_cache_fr.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $kernel->setClearCacheAfterShutdown(false); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); diff --git a/tests/Functional/ProviderFactoryTest.php b/tests/Functional/ProviderFactoryTest.php index cee7666..382303a 100644 --- a/tests/Functional/ProviderFactoryTest.php +++ b/tests/Functional/ProviderFactoryTest.php @@ -82,6 +82,10 @@ public function testProviderConfiguration(string $class, array $serviceNames): v $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) use ($class) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/provider/'.strtolower(substr($class, strrpos($class, '\\') + 1)).'.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); @@ -140,11 +144,19 @@ public function testProviderConfigurationWithDeprecatedHttplugClientOption(): vo $kernel = self::bootKernel(['config' => static function (TestKernel $kernel) { $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->addTestConfig(__DIR__.'/config/deprecated_httplug_client_option.yml'); + + if ($kernel::VERSION_ID >= 50000) { + $kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml'); + } }]); $container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer(); - $this->expectDeprecation('Since willdurand/geocoder-bundle 5.19: The option "httplug_client" is deprecated, use "http_client" instead.'); + if ($kernel::VERSION_ID >= 50000) { + $this->expectDeprecation('Since willdurand/geocoder-bundle 5.19: The option "httplug_client" is deprecated, use "http_client" instead.'); + } else { + $this->expectDeprecation('willdurand/geocoder-bundle'); + } self::assertTrue($container->has('bazinga_geocoder.provider.acme')); $container->get('bazinga_geocoder.provider.acme'); diff --git a/tests/Functional/config/framework.yml b/tests/Functional/config/framework.yml index d745002..727de01 100644 --- a/tests/Functional/config/framework.yml +++ b/tests/Functional/config/framework.yml @@ -2,7 +2,6 @@ framework: http_method_override: false secret: 6825c711ef47cfc1530d322b62adac3e2c43844c session: - storage_factory_id: session.storage.factory.mock_file cookie_secure: auto cookie_samesite: lax handler_id: null diff --git a/tests/Functional/config/framework_sf5.yml b/tests/Functional/config/framework_sf5.yml new file mode 100644 index 0000000..048fe59 --- /dev/null +++ b/tests/Functional/config/framework_sf5.yml @@ -0,0 +1,5 @@ +framework: + session: + storage_factory_id: session.storage.factory.mock_file + router: + utf8: true diff --git a/tests/Functional/config/framework_sf6.yml b/tests/Functional/config/framework_sf6.yml new file mode 100644 index 0000000..810703a --- /dev/null +++ b/tests/Functional/config/framework_sf6.yml @@ -0,0 +1,9 @@ +framework: + annotations: false + handle_all_throwables: true + php_errors: + log: true + session: + storage_factory_id: session.storage.factory.mock_file + router: + utf8: true diff --git a/tests/Functional/config/listener.yml b/tests/Functional/config/listener.yml index 6e6aa96..1091a06 100644 --- a/tests/Functional/config/listener.yml +++ b/tests/Functional/config/listener.yml @@ -1,3 +1,15 @@ +doctrine: + dbal: + default_connection: default + connections: + default: + driver: pdo_sqlite + path: '%kernel.cache_dir%/test.sqlite' + orm: + auto_generate_proxy_classes: true + naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware + auto_mapping: false + bazinga_geocoder: profiling: enabled: false @@ -8,4 +20,5 @@ bazinga_geocoder: http_client: '@Http\Mock\Client' services: - Http\Mock\Client: ~ + Http\Mock\Client: + public: true diff --git a/tests/Functional/config/listener_php7.yml b/tests/Functional/config/listener_php7.yml index 7d6903e..da02623 100644 --- a/tests/Functional/config/listener_php7.yml +++ b/tests/Functional/config/listener_php7.yml @@ -1,14 +1,5 @@ doctrine: - dbal: - default_connection: default - connections: - default: - driver: pdo_sqlite - path: '%kernel.cache_dir%/test.sqlite' orm: - auto_generate_proxy_classes: true - naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware - auto_mapping: true mappings: App: is_bundle: false diff --git a/tests/Functional/config/listener_php8.yml b/tests/Functional/config/listener_php8.yml index 90efa68..8673226 100644 --- a/tests/Functional/config/listener_php8.yml +++ b/tests/Functional/config/listener_php8.yml @@ -1,16 +1,5 @@ doctrine: - dbal: - default_connection: default - connections: - default: - driver: pdo_sqlite - path: '%kernel.cache_dir%/test.sqlite' orm: - auto_generate_proxy_classes: true - validate_xml_mapping: true - report_fields_where_declared: true - naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware - auto_mapping: true mappings: App: is_bundle: false diff --git a/tests/PublicServicePass.php b/tests/PublicServicePass.php index 8f430b6..69abc3c 100644 --- a/tests/PublicServicePass.php +++ b/tests/PublicServicePass.php @@ -31,7 +31,7 @@ public function __construct(string $regex = '|.*|') $this->regex = $regex; } - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { foreach ($container->getDefinitions() as $id => $definition) { if (preg_match($this->regex, $id)) { diff --git a/tests/Validator/Constraint/AddressValidatorTest.php b/tests/Validator/Constraint/AddressValidatorTest.php index f250a83..268aa4a 100644 --- a/tests/Validator/Constraint/AddressValidatorTest.php +++ b/tests/Validator/Constraint/AddressValidatorTest.php @@ -19,6 +19,7 @@ use Http\Mock\Client; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\StreamInterface; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; @@ -32,23 +33,33 @@ protected function createValidator(): AddressValidator $httpClient->on($requestMatcher, function (RequestInterface $request) { switch ((string) $request->getUri()) { case 'https://nominatim.openstreetmap.org/search?format=jsonv2&q=Berlin%2C%20Germany&addressdetails=1&extratags=1&limit=5': + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[{"place_id":159647018,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62422,"lat":"52.5170365","lon":"13.3888599","category":"boundary","type":"administrative","place_rank":8,"importance":0.7875390282491362,"addresstype":"city","name":"Berlin","display_name":"Berlin, Deutschland","address":{"city":"Berlin","ISO3166-2-lvl4":"DE-BE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "35", "email": "info@berlin.de", "place": "city", "capital": "yes", "website": "http://www.berlin.de", "de:place": "city", "ref:nuts": "DE3;DE30;DE300", "wikidata": "Q64", "wikipedia": "de:Berlin", "population": "3769962", "ref:LOCODE": "DEBER", "ref:nuts:1": "DE3", "ref:nuts:2": "DE30", "ref:nuts:3": "DE300", "state_code": "BE", "name:prefix": "Land und Kreisfreie Stadt", "linked_place": "city", "official_status": "Land", "contact:facebook": "http://www.facebook.com/Berlin", "name:prefix:city": "Kreisfreie Stadt", "openGeoDB:loc_id": "14356", "capital_ISO3166-1": "yes", "name:prefix:state": "Land", "source:population": "https://download.statistik-berlin-brandenburg.de/fa93e3bd19a2e885/a5ecfb2fff6a/SB_A01-05-00_2020h02_BE.pdf", "license_plate_code": "B", "official_status:de": "Land", "official_status:en": "State", "official_status:ru": "земля", "geographical_region": "Barnim;Berliner Urstromtal;Teltow;Nauener Platte", "blind:description:de": "Auf www.berlinfuerblinde.de gibt es einen kostenlosen Audioguide und weitere Informationen.", "de:regionalschluessel": "110000000000", "openGeoDB:postal_codes": "10178,10115,10117,10119,10179,10243,10245,10247,10249,10315,10317,10318,10319,10365,10367,10369,10405,10407,10409,10435,10437,10439,10551,10553,10555,10557,10559,10585,10587,10589,10623,10625,10627,10629,10707,10709,10711,10713,10715,10717,10719,10777,10", "report_problems:website": "https://ordnungsamt.berlin.de/", "TMC:cid_58:tabcd_1:Class": "Area", "openGeoDB:license_plate_code": "B", "TMC:cid_58:tabcd_1:LCLversion": "12.0", "openGeoDB:telephone_area_code": "030", "TMC:cid_58:tabcd_1:LocationCode": "266", "de:amtlicher_gemeindeschluessel": "11000000", "openGeoDB:community_identification_number": "11000000"},"boundingbox":["52.3382448","52.6755087","13.0883450","13.7611609"]}]'); + $response = $this->createMock(ResponseInterface::class); $response->expects(self::once()) ->method('getStatusCode') ->willReturn(200); $response->expects(self::once()) ->method('getBody') - ->willReturn('[{"place_id":159647018,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright","osm_type":"relation","osm_id":62422,"lat":"52.5170365","lon":"13.3888599","category":"boundary","type":"administrative","place_rank":8,"importance":0.7875390282491362,"addresstype":"city","name":"Berlin","display_name":"Berlin, Deutschland","address":{"city":"Berlin","ISO3166-2-lvl4":"DE-BE","country":"Deutschland","country_code":"de"},"extratags":{"ele": "35", "email": "info@berlin.de", "place": "city", "capital": "yes", "website": "http://www.berlin.de", "de:place": "city", "ref:nuts": "DE3;DE30;DE300", "wikidata": "Q64", "wikipedia": "de:Berlin", "population": "3769962", "ref:LOCODE": "DEBER", "ref:nuts:1": "DE3", "ref:nuts:2": "DE30", "ref:nuts:3": "DE300", "state_code": "BE", "name:prefix": "Land und Kreisfreie Stadt", "linked_place": "city", "official_status": "Land", "contact:facebook": "http://www.facebook.com/Berlin", "name:prefix:city": "Kreisfreie Stadt", "openGeoDB:loc_id": "14356", "capital_ISO3166-1": "yes", "name:prefix:state": "Land", "source:population": "https://download.statistik-berlin-brandenburg.de/fa93e3bd19a2e885/a5ecfb2fff6a/SB_A01-05-00_2020h02_BE.pdf", "license_plate_code": "B", "official_status:de": "Land", "official_status:en": "State", "official_status:ru": "земля", "geographical_region": "Barnim;Berliner Urstromtal;Teltow;Nauener Platte", "blind:description:de": "Auf www.berlinfuerblinde.de gibt es einen kostenlosen Audioguide und weitere Informationen.", "de:regionalschluessel": "110000000000", "openGeoDB:postal_codes": "10178,10115,10117,10119,10179,10243,10245,10247,10249,10315,10317,10318,10319,10365,10367,10369,10405,10407,10409,10435,10437,10439,10551,10553,10555,10557,10559,10585,10587,10589,10623,10625,10627,10629,10707,10709,10711,10713,10715,10717,10719,10777,10", "report_problems:website": "https://ordnungsamt.berlin.de/", "TMC:cid_58:tabcd_1:Class": "Area", "openGeoDB:license_plate_code": "B", "TMC:cid_58:tabcd_1:LCLversion": "12.0", "openGeoDB:telephone_area_code": "030", "TMC:cid_58:tabcd_1:LocationCode": "266", "de:amtlicher_gemeindeschluessel": "11000000", "openGeoDB:community_identification_number": "11000000"},"boundingbox":["52.3382448","52.6755087","13.0883450","13.7611609"]}]'); + ->willReturn($stream); return $response; case 'https://nominatim.openstreetmap.org/search?format=jsonv2&q=Bifrost%2C%20Nine%20Realms&addressdetails=1&extratags=1&limit=5': + $stream = $this->createMock(StreamInterface::class); + $stream->expects(self::once()) + ->method('__toString') + ->willReturn('[]'); + $response = $this->createMock(ResponseInterface::class); $response->expects(self::once()) ->method('getStatusCode') ->willReturn(200); $response->expects(self::once()) ->method('getBody') - ->willReturn('[]'); + ->willReturn($stream); return $response; } diff --git a/tests/baseline-ignore b/tests/baseline-ignore new file mode 100644 index 0000000..062b597 --- /dev/null +++ b/tests/baseline-ignore @@ -0,0 +1,12 @@ +%Bazinga\\GeocoderBundle\\ProviderFactory\\GeoIPsFactory is deprecated since 5.6, to be removed in 6.0% +%Bazinga\\GeocoderBundle\\ProviderFactory\\MapzenFactory is deprecated since 5.6, to be removed in 6.0% +%Since doctrine/doctrine-bundle 2.11: Not setting "enable_lazy_ghost_objects" to true is deprecated% +%Not configuring a schema manager factory is deprecated. Use Doctrine\\DBAL\\Schema\\DefaultSchemaManagerFactory which is going to be the default in DBAL 4% +%Doctrine\\DBAL\\Configuration::setSQLLogger is deprecated, use setMiddlewares\(\) and Logging\\Middleware instead% +%Accessing Doctrine\\Common\\Lexer\\Token properties via ArrayAccess is deprecated, use the value, type or position property instead% +%Doctrine\\DBAL\\Connection::getEventManager is deprecated% +%DebugStack is deprecated% +%In ORM 3.0, the AttributeDriver will report fields for the classes where they are declared% +%Class "Nyholm\\Psr7\\Factory\\HttplugFactory" is deprecated since version 1.8, use "Nyholm\\Psr7\\Factory\\Psr17Factory" instead% +%Not enabling lazy ghost objects is deprecated and will not be supported in Doctrine ORM 3.0% +%Since doctrine/doctrine-bundle 2.11: Not setting "doctrine.orm.enable_lazy_ghost_objects" to true is deprecated% diff --git a/tests/bootstrap.php b/tests/bootstrap.php index abb3231..d0cb708 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -19,11 +19,3 @@ require_once __DIR__.'/../vendor/geoip/geoip/src/geoip.inc'; require_once __DIR__.'/../vendor/geoip/geoip/src/geoipcity.inc'; - -if (!is_bool($loader)) { - $loader->add('Doctrine\Tests', __DIR__.'/../vendor/doctrine/orm/tests'); -} else { - echo "Warning: Doctrine\Tests could not be added to the autoloader. \n"; - // Fake class - class_alias('\PHPUnit\Framework\TestCase', 'Doctrine\Tests\OrmTestCase'); -}