From e1a55e5caa3de8df154d2b349f8459da77b61e4d Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Fri, 7 Jun 2019 10:45:11 +0200 Subject: [PATCH 1/4] Bumped PHP version to ^7.3 --- .travis.yml | 8 ++++---- composer.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d03281e31..39178c2b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,13 +10,13 @@ cache: matrix: include: - - php: 7.2 + - php: 7.3 env: TEST_CONFIG="phpunit.xml" - - php: 7.1 + - php: 7.3 env: TEST_CONFIG="phpunit-integration-legacy-solr.xml" SOLR_VERSION="6.4.2" CORES_SETUP="dedicated" - - php: 7.2 + - php: 7.3 env: TEST_CONFIG="phpunit-integration-legacy-solr.xml" SOLR_VERSION="6.5.1" CORES_SETUP="shared" - - php: 7.2 + - php: 7.3 env: TEST_CONFIG="phpunit-integration-legacy-solr.xml" SOLR_VERSION="6.6.5" CORES_SETUP="single" SOLR_CORES="collection1" # test only master and stable branches (+ Pull requests against those) diff --git a/composer.json b/composer.json index ec787ca10..6c6bd3415 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^7.1", + "php": "^7.3", "ezsystems/ezpublish-kernel": "^8.0@dev", "netgen/query-translator": "^1.0.2" }, From 26ee97a3145e0f603002a78db9bfddfd0baf1ee9 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Fri, 7 Jun 2019 10:47:34 +0200 Subject: [PATCH 2/4] Updated dependencies to Symfony 4 --- .../EzSystemsEzPlatformSolrSearchEngineExtension.php | 8 ++++---- composer.json | 11 ++++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bundle/DependencyInjection/EzSystemsEzPlatformSolrSearchEngineExtension.php b/bundle/DependencyInjection/EzSystemsEzPlatformSolrSearchEngineExtension.php index 1a78d5ee5..4b3fcc822 100644 --- a/bundle/DependencyInjection/EzSystemsEzPlatformSolrSearchEngineExtension.php +++ b/bundle/DependencyInjection/EzSystemsEzPlatformSolrSearchEngineExtension.php @@ -12,7 +12,7 @@ use EzSystems\EzPlatformSolrSearchEngine\FieldMapper\BoostFactorProvider; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\DefinitionDecorator; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -167,7 +167,7 @@ private function configureSearchServices(ContainerBuilder $container, $connectio $alias = $this->getAlias(); // Endpoint resolver - $endpointResolverDefinition = new DefinitionDecorator(self::ENDPOINT_RESOLVER_ID); + $endpointResolverDefinition = new ChildDefinition(self::ENDPOINT_RESOLVER_ID); $endpointResolverDefinition->replaceArgument(0, $connectionParams['entry_endpoints']); $endpointResolverDefinition->replaceArgument(1, $connectionParams['mapping']['translations']); $endpointResolverDefinition->replaceArgument(2, $connectionParams['mapping']['default']); @@ -176,13 +176,13 @@ private function configureSearchServices(ContainerBuilder $container, $connectio $container->setDefinition($endpointResolverId, $endpointResolverDefinition); // Core filter - $coreFilterDefinition = new DefinitionDecorator(self::CORE_FILTER_ID); + $coreFilterDefinition = new ChildDefinition(self::CORE_FILTER_ID); $coreFilterDefinition->replaceArgument(0, new Reference($endpointResolverId)); $coreFilterId = "$alias.connection.$connectionName.core_filter_id"; $container->setDefinition($coreFilterId, $coreFilterDefinition); // Gateway - $gatewayDefinition = new DefinitionDecorator(self::GATEWAY_ID); + $gatewayDefinition = new ChildDefinition(self::GATEWAY_ID); $gatewayDefinition->replaceArgument(1, new Reference($endpointResolverId)); $gatewayId = "$alias.connection.$connectionName.gateway_id"; $container->setDefinition($gatewayId, $gatewayDefinition); diff --git a/composer.json b/composer.json index 6c6bd3415..86fdc81c3 100644 --- a/composer.json +++ b/composer.json @@ -15,11 +15,16 @@ "require": { "php": "^7.3", "ezsystems/ezpublish-kernel": "^8.0@dev", - "netgen/query-translator": "^1.0.2" + "netgen/query-translator": "^1.0.2", + "symfony/http-kernel": "^4.3", + "symfony/dependency-injection": "^4.3", + "symfony/console": "^4.3", + "symfony/config": "^4.3", + "symfony/framework-bundle": "^4.3" }, "require-dev": { - "phpunit/phpunit": "^5.7||^7.5", - "matthiasnoback/symfony-dependency-injection-test": "~1.0||~3.1" + "phpunit/phpunit": "^8.1", + "matthiasnoback/symfony-dependency-injection-test": "^4.0" }, "autoload": { "psr-4": { From 1316ba911d011528cebbc4e0d8a6470f5cf9be07 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Fri, 7 Jun 2019 10:57:43 +0200 Subject: [PATCH 3/4] Aligned unit tests to PHPUnit 8 --- ...ublishEzPlatformSolrSearchEngineExtensionTest.php | 12 ++++++------ .../Compiler/AggregateCriterionVisitorPassTest.php | 4 ++-- .../AggregateFacetBuilderVisitorPassTest.php | 4 ++-- .../Compiler/AggregateSortClauseVisitorPassTest.php | 4 ++-- .../EndpointResolver/NativeEndpointResolverTest.php | 11 ++++------- tests/lib/Search/Gateway/EndpointTest.php | 6 +++--- tests/lib/Slot/RemoveTranslationTest.php | 4 ++-- 7 files changed, 21 insertions(+), 24 deletions(-) diff --git a/tests/bundle/DependencyInjection/EzPublishEzPlatformSolrSearchEngineExtensionTest.php b/tests/bundle/DependencyInjection/EzPublishEzPlatformSolrSearchEngineExtensionTest.php index 422ad9898..da0b79b47 100644 --- a/tests/bundle/DependencyInjection/EzPublishEzPlatformSolrSearchEngineExtensionTest.php +++ b/tests/bundle/DependencyInjection/EzPublishEzPlatformSolrSearchEngineExtensionTest.php @@ -12,6 +12,7 @@ use EzSystems\EzPlatformSolrSearchEngineBundle\DependencyInjection\EzSystemsEzPlatformSolrSearchEngineExtension; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; class EzPublishEzPlatformSolrSearchEngineExtensionTest extends AbstractExtensionTestCase { @@ -20,19 +21,19 @@ class EzPublishEzPlatformSolrSearchEngineExtensionTest extends AbstractExtension */ private $extension; - protected function setUp() + protected function setUp(): void { $this->extension = new EzSystemsEzPlatformSolrSearchEngineExtension(); parent::setUp(); } - protected function getContainerExtensions() + protected function getContainerExtensions(): array { return array($this->extension); } - protected function getMinimalConfiguration() + protected function getMinimalConfiguration(): array { return []; } @@ -149,11 +150,10 @@ public function testEndpoint($endpointName, $endpointValues, $expectedArgument) ); } - /** - * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException - */ public function testEndpointCoreRequired() { + $this->expectException(InvalidConfigurationException::class); + $this->load( array( 'endpoints' => array( diff --git a/tests/lib/Container/Compiler/AggregateCriterionVisitorPassTest.php b/tests/lib/Container/Compiler/AggregateCriterionVisitorPassTest.php index 18b9bb7f5..14a587958 100644 --- a/tests/lib/Container/Compiler/AggregateCriterionVisitorPassTest.php +++ b/tests/lib/Container/Compiler/AggregateCriterionVisitorPassTest.php @@ -18,7 +18,7 @@ class AggregateCriterionVisitorPassTest extends AbstractCompilerPassTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->setDefinition( @@ -33,7 +33,7 @@ protected function setUp() * * $container->addCompilerPass(new MyCompilerPass()); */ - protected function registerCompilerPass(ContainerBuilder $container) + protected function registerCompilerPass(ContainerBuilder $container): void { $container->addCompilerPass(new AggregateCriterionVisitorPass()); } diff --git a/tests/lib/Container/Compiler/AggregateFacetBuilderVisitorPassTest.php b/tests/lib/Container/Compiler/AggregateFacetBuilderVisitorPassTest.php index 3b73adc14..673e776ec 100644 --- a/tests/lib/Container/Compiler/AggregateFacetBuilderVisitorPassTest.php +++ b/tests/lib/Container/Compiler/AggregateFacetBuilderVisitorPassTest.php @@ -18,7 +18,7 @@ class AggregateFacetBuilderVisitorPassTest extends AbstractCompilerPassTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->setDefinition( @@ -37,7 +37,7 @@ protected function setUp() * * $container->addCompilerPass(new MyCompilerPass()); */ - protected function registerCompilerPass(ContainerBuilder $container) + protected function registerCompilerPass(ContainerBuilder $container): void { $container->addCompilerPass(new AggregateFacetBuilderVisitorPass()); } diff --git a/tests/lib/Container/Compiler/AggregateSortClauseVisitorPassTest.php b/tests/lib/Container/Compiler/AggregateSortClauseVisitorPassTest.php index 2af56d6fd..c4487488f 100644 --- a/tests/lib/Container/Compiler/AggregateSortClauseVisitorPassTest.php +++ b/tests/lib/Container/Compiler/AggregateSortClauseVisitorPassTest.php @@ -18,7 +18,7 @@ class AggregateSortClauseVisitorPassTest extends AbstractCompilerPassTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->setDefinition( @@ -33,7 +33,7 @@ protected function setUp() * * $container->addCompilerPass(new MyCompilerPass()); */ - protected function registerCompilerPass(ContainerBuilder $container) + protected function registerCompilerPass(ContainerBuilder $container): void { $container->addCompilerPass(new AggregateSortClauseVisitorPass()); } diff --git a/tests/lib/Search/Gateway/EndpointResolver/NativeEndpointResolverTest.php b/tests/lib/Search/Gateway/EndpointResolver/NativeEndpointResolverTest.php index cce585390..3c490c087 100644 --- a/tests/lib/Search/Gateway/EndpointResolver/NativeEndpointResolverTest.php +++ b/tests/lib/Search/Gateway/EndpointResolver/NativeEndpointResolverTest.php @@ -36,11 +36,9 @@ public function testGetEntryEndpoint() ); } - /** - * @expectedException \RuntimeException - */ public function testGetEntryEndpointThrowsRuntimeException() { + $this->expectException(RuntimeException::class); $entryEndpoints = array(); $endpointResolver = $this->getEndpointResolver($entryEndpoints); @@ -920,7 +918,6 @@ public function providerForTestGetSearchTargetsThrowsRuntimeException() /** * @dataProvider providerForTestGetSearchTargetsThrowsRuntimeException - * @expectedException \RuntimeException * * @param string[] $endpointMap * @param null|string $defaultEndpoint @@ -935,6 +932,8 @@ public function testGetSearchTargetsThrowsRuntimeException( $languageSettings, $message ) { + $this->expectException(RuntimeException::class); + $endpointResolver = $this->getEndpointResolver( array(), $endpointMap, @@ -1041,11 +1040,9 @@ public function testGetEndpoints( $this->assertEquals($expected, $endpoints); } - /** - * @expectedException \RuntimeException - */ public function testGetEndpointsThrowsRuntimeException() { + $this->expectException(RuntimeException::class); $endpointResolver = $this->getEndpointResolver( array(), array(), diff --git a/tests/lib/Search/Gateway/EndpointTest.php b/tests/lib/Search/Gateway/EndpointTest.php index 5539d75e9..69d257d09 100644 --- a/tests/lib/Search/Gateway/EndpointTest.php +++ b/tests/lib/Search/Gateway/EndpointTest.php @@ -10,6 +10,7 @@ */ namespace EzSystems\EzPlatformSolrSearchEngine\Tests\Search\Gateway; +use eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException; use EzSystems\EzPlatformSolrSearchEngine\Gateway\Endpoint; use EzSystems\EzPlatformSolrSearchEngine\Tests\Search\TestCase; @@ -91,11 +92,10 @@ public function testEndpointDsnParsingOverridesAllIfSet() $this->assertEquals($expected, $actual); } - /** - * @expectedException \eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException - */ public function testEndpointDsnParsingWithQuery() { + $this->expectException(PropertyNotFoundException::class); + $actual = new Endpoint(['dsn' => 'https://10.10.10.10:5434/jolr?query']); } } diff --git a/tests/lib/Slot/RemoveTranslationTest.php b/tests/lib/Slot/RemoveTranslationTest.php index b779c4a3c..9a477d8be 100644 --- a/tests/lib/Slot/RemoveTranslationTest.php +++ b/tests/lib/Slot/RemoveTranslationTest.php @@ -26,14 +26,14 @@ class RemoveTranslationTest extends TestCase /** * Check if required signal exists due to BC. */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!class_exists(RemoveTranslationSignal::class)) { self::markTestSkipped('RemoveTranslationSignal does not exist'); } } - public function setUp() + public function setUp(): void { parent::setUp(); From d17cfb95baf63fd2035b9b8f2e70c7f1268e9bb2 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Mon, 10 Jun 2019 16:36:03 +0200 Subject: [PATCH 4/4] Bumped PHPUnit version to 8.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 86fdc81c3..83ba0500b 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "symfony/framework-bundle": "^4.3" }, "require-dev": { - "phpunit/phpunit": "^8.1", + "phpunit/phpunit": "^8.2", "matthiasnoback/symfony-dependency-injection-test": "^4.0" }, "autoload": {