Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-30638: Upgrade ezsystems/ezplatform-solr-search-engine to use Symfony 4 components #140

Merged
merged 4 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']);
Expand All @@ -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);
Expand Down
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
"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"
"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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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 [];
}
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class AggregateCriterionVisitorPassTest extends AbstractCompilerPassTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setDefinition(
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class AggregateFacetBuilderVisitorPassTest extends AbstractCompilerPassTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setDefinition(
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class AggregateSortClauseVisitorPassTest extends AbstractCompilerPassTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setDefinition(
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ public function testGetEntryEndpoint()
);
}

/**
* @expectedException \RuntimeException
*/
public function testGetEntryEndpointThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
$entryEndpoints = array();

$endpointResolver = $this->getEndpointResolver($entryEndpoints);
Expand Down Expand Up @@ -920,7 +918,6 @@ public function providerForTestGetSearchTargetsThrowsRuntimeException()

/**
* @dataProvider providerForTestGetSearchTargetsThrowsRuntimeException
* @expectedException \RuntimeException
*
* @param string[] $endpointMap
* @param null|string $defaultEndpoint
Expand All @@ -935,6 +932,8 @@ public function testGetSearchTargetsThrowsRuntimeException(
$languageSettings,
$message
) {
$this->expectException(RuntimeException::class);

$endpointResolver = $this->getEndpointResolver(
array(),
$endpointMap,
Expand Down Expand Up @@ -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(),
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/Search/Gateway/EndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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']);
}
}
4 changes: 2 additions & 2 deletions tests/lib/Slot/RemoveTranslationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down