Skip to content

Commit

Permalink
Support Solarium >= v5.x (nelmio#93)
Browse files Browse the repository at this point in the history
* require solarium >= 5.x 
* drop support for outdated Symfony versions
* drop support for php 7.1 (min. php version is 7.2)
  • Loading branch information
dmaicher authored and thePanz committed Oct 4, 2019
1 parent cdb4683 commit 3dffc78
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 19 deletions.
10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ matrix:
fast_finish: true
include:
- php: 7.3
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
- php: 7.1
env: SYMFONY_VERSION=2.8.*@dev
- php: 7.1
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.2
env: DEPENDENCIES=dev

before_install:
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev --no-update "symfony/symfony:$SYMFONY_VERSION"; fi
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi;

install: travis_retry composer update $COMPOSER_FLAGS

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
### Security

## [v4.0.0](https://github.com/nelmio/NelmioSolariumBundle/releases/tag/v4.0.0) - 2019-xx-xx
### Changed
- Removed support for PHP 7.1
- Removed support for unmaintained Symfony versions
- Removed support for Solarium < 5
### Fixed
- Fixed Symfony 4.4 deprecations

## [v3.0.0](https://github.com/nelmio/NelmioSolariumBundle/releases/tag/v3.0.0) - 2019-06-18
### Fixed
- Fixed documentation on Changelog
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Upgrading

## Upgrading from v3.x to v4.x
From version 4 on this bundle requires Solarium 5.
In case you were using a custom `path` option for endpoints you need to adjust it.

See https://solarium.readthedocs.io/en/stable/getting-started/#pitfall-when-upgrading-from-earlier-versions-to-5x

## Upgrading from v2.x to v3.x

### Endpoint configuration changes (v3.0.0)
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
}
],
"require": {
"php": "^7.1",
"symfony/framework-bundle": "^2.8 || ^3.0 || ^4.0",
"solarium/solarium": "^4.0 < 4.3.0"
"php": "^7.2",
"symfony/framework-bundle": "^3.4 || ^4.2",
"solarium/solarium": "^5.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.2"
"symfony/phpunit-bridge": "^4.3"
},
"autoload": {
"psr-4": {
Expand All @@ -29,7 +29,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
"dev-master": "4.x-dev"
}
}
}
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0" />
</php>
<testsuites>
<testsuite name="NelmioSolariumBundle Test Suite">
<directory>./tests/</directory>
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Configuration implements ConfigurationInterface
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('nelmio_solarium');

Expand All @@ -46,7 +46,7 @@ public function getConfigTreeBuilder()
->scalarNode('scheme')->defaultValue('http')->end()
->scalarNode('host')->defaultValue('127.0.0.1')->end()
->scalarNode('port')->defaultValue(8983)->end()
->scalarNode('path')->defaultValue('/solr')->end()
->scalarNode('path')->defaultValue('/')->end()
->scalarNode('core')->end()
->scalarNode('timeout')->defaultValue(5)->end()
->end()
Expand Down
2 changes: 1 addition & 1 deletion src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function collect(HttpRequest $request, HttpResponse $response, \Exception
);
}

public function getName()
public function getName(): string
{
return 'solr';
}
Expand Down
10 changes: 6 additions & 4 deletions tests/NelmioSolariumExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testLoadEmptyConfiguration()

$this->assertEquals('http', $endpoint->getScheme());
$this->assertEquals('127.0.0.1', $endpoint->getHost());
$this->assertEquals('/solr', $endpoint->getPath());
$this->assertEquals('', $endpoint->getPath());
$this->assertEquals(8983, $endpoint->getPort());
$this->assertEquals('5', $endpoint->getTimeout());
}
Expand All @@ -77,7 +77,7 @@ public function testNoClients()

$this->assertEquals('http', $endpoint->getScheme());
$this->assertEquals('127.0.0.1', $endpoint->getHost());
$this->assertEquals('/solr', $endpoint->getPath());
$this->assertEquals('', $endpoint->getPath());
$this->assertEquals(8983, $endpoint->getPort());
$this->assertEquals('5', $endpoint->getTimeout());
}
Expand Down Expand Up @@ -271,6 +271,7 @@ public function testDefaultEndpoint()
'host' => 'localhost',
'port' => 123,
'core' => 'core2',
'path' =>'/custom_prefix',
)
),
'clients' => array(
Expand Down Expand Up @@ -302,13 +303,16 @@ public function testDefaultEndpoint()
$this->assertEquals('localhost', $endpoints['endpoint1']->getHost());
$this->assertEquals(123, $endpoints['endpoint1']->getPort());
$this->assertEquals('core1', $endpoints['endpoint1']->getCore());
$this->assertEquals('http://localhost:123/solr/core1/', $endpoints['endpoint1']->getCoreBaseUri());

$this->assertTrue(isset($endpoints['endpoint2']));
$this->assertEquals('endpoint2', $endpoints['endpoint2']->getKey());
$this->assertEquals('http', $endpoints['endpoint2']->getScheme());
$this->assertEquals('localhost', $endpoints['endpoint2']->getHost());
$this->assertEquals(123, $endpoints['endpoint2']->getPort());
$this->assertEquals('core2', $endpoints['endpoint2']->getCore());
$this->assertEquals('/custom_prefix', $endpoints['endpoint2']->getPath());
$this->assertEquals('http://localhost:123/custom_prefix/solr/core2/', $endpoints['endpoint2']->getCoreBaseUri());
}

public function testClientRegistry()
Expand Down Expand Up @@ -411,7 +415,6 @@ public function testLoadBalancer()
/** @var Loadbalancer $loadBalancerPlugin */
$loadBalancerPlugin = $client->getPlugin('loadbalancer');
$this->assertInstanceOf(Loadbalancer::class, $loadBalancerPlugin);
$this->assertEquals($loadBalancerPlugin, $container->get('solarium.client.client1.load_balancer'));

$loadBalancedEndpoints = $loadBalancerPlugin->getEndpoints();
$this->assertCount(2, $loadBalancedEndpoints);
Expand All @@ -422,7 +425,6 @@ public function testLoadBalancer()
),
$loadBalancedEndpoints
);

}

private function createCompiledContainerForConfig($config, $debug = false, $extraServices = array())
Expand Down

0 comments on commit 3dffc78

Please sign in to comment.