Skip to content

Commit 749b8f2

Browse files
thePanzMarkus Kalkbrenner
authored and
Markus Kalkbrenner
committed
Update to phpunit v6.5 (solariumphp#557)
* Require phpunit v6.5 and PHP v7 * Update tests to use TestCase * Fix ClientTest tests * Updated tests for phpunit v6.5 * Updated assertSame and removed copyright info from tests * Fixed CS * Removed php 5.6 from travis tests * Added php 7.2 to travis * Removed commented code * Updated Readme * Updated CHANGELOG * Updated CS * Updated tests and phpunit.dist{,.travis} (bootstrap.php is not needed anymore) * Updated tests, removed unused coverage
1 parent fde56db commit 749b8f2

File tree

200 files changed

+3103
-8255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+3103
-8255
lines changed

.travis.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ language: php
33
dist: trusty
44

55
php:
6+
- 7.2
67
- 7.1
78
- 7.0
8-
- 5.6
9-
- hhvm
9+
# hhvm removed as it is not fully compatible with php7
10+
# - hhvm
1011
- nightly
1112

1213
env:
13-
# - SYMFONY_VERSION=2.3.* SOLR_VERSION=6.6.1
14-
# - SYMFONY_VERSION=2.7.* SOLR_VERSION=6.6.1
1514
- SYMFONY_VERSION=2.8.* SOLR_VERSION=6.6.2
1615
- SYMFONY_VERSION=3.0.* SOLR_VERSION=6.6.2
1716
- SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
@@ -42,10 +41,6 @@ matrix:
4241
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
4342
- php: 7.0
4443
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=7.2.0
45-
- php: 5.6
46-
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
47-
- php: 5.6
48-
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=7.2.0
4944
- php: hhvm
5045
env: SYMFONY_VERSION=4.0.* SOLR_VERSION=6.6.2
5146
- php: hhvm

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## Unreleased
4+
### Changed
5+
- Updated PHPUnit to v6.5
6+
- Updated required PHP version to >= v7.0
7+
38
## 3.8.1 - 2017-02-02
49

510
- bugfix: restore PHP 5.3 compatibility (remove short array syntax)

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ Please see the docs for a more detailed description.
1111

1212
## Requirements
1313

14-
Solarium only supports PHP 5.6 and up.
14+
Solarium only supports PHP 7.0 and up.
15+
1516
It's highly recommended to have Curl enabled in your PHP environment. However if you don't have Curl available you can
1617
switch from using Curl (the default) to another client adapter. The other adapters don't support all the features of the
1718
Curl adapter.
@@ -20,6 +21,11 @@ Curl adapter.
2021

2122
The preferred way to install Solarium is by using Composer. Solarium is available on Packagist.
2223

24+
Example:
25+
```
26+
composer require solarium/solarium
27+
```
28+
2329
## More information
2430

2531
* Docs

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=5.6",
15+
"php": "^7.0",
1616
"symfony/event-dispatcher": "^2.7 || ^3.0 || ^4.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^3.7",
19+
"phpunit/phpunit": "^6.5",
2020
"squizlabs/php_codesniffer": "^1.4",
2121
"zendframework/zendframework1": "^1.12",
2222
"satooshi/php-coveralls": "^1.0",

library/Component/ResponseParser/Spellcheck.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public function parse($query, $spellcheck, $data)
7373
}
7474

7575
$suggestions = array();
76-
$correctlySpelled = null;
7776
$collations = array();
77+
$correctlySpelled = false;
7878

7979
foreach ($spellcheckResults as $key => $value) {
8080
switch ($key) {

library/Component/Result/Spellcheck/Result.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ class Result implements \IteratorAggregate, \Countable
6969
/**
7070
* Constructor.
7171
*
72-
* @param array $suggestions
73-
* @param array $collations
74-
* @param boolean $correctlySpelled
72+
* @param Suggestion[] $suggestions
73+
* @param Collation[] $collations
74+
* @param boolean $correctlySpelled
7575
*/
76-
public function __construct($suggestions, $collations, $correctlySpelled)
76+
public function __construct(array $suggestions, array $collations, bool $correctlySpelled)
7777
{
7878
$this->suggestions = $suggestions;
7979
$this->collations = $collations;

phpunit.xml.dist

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
backupGlobals="false"
44
backupStaticAttributes="false"
55
syntaxCheck="false"
6-
bootstrap="tests/bootstrap.php"
76
colors="true"
87
>
98

phpunit.xml.travis

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false" backupStaticAttributes="false" syntaxCheck="false" bootstrap="tests/bootstrap.php">
3-
2+
<phpunit
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
syntaxCheck="false"
6+
>
47
<testsuites>
58
<testsuite name="Solarium">
69
<directory suffix="Test.php">tests</directory>

tests/ClientTest.php

+2-30
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
11
<?php
2-
/**
3-
* Copyright 2011 Bas de Nooijer. All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without
6-
* modification, are permitted provided that the following conditions are met:
7-
*
8-
* 1. Redistributions of source code must retain the above copyright notice,
9-
* this list of conditions and the following disclaimer.
10-
*
11-
* 2. Redistributions in binary form must reproduce the above copyright notice,
12-
* this listof conditions and the following disclaimer in the documentation
13-
* and/or other materials provided with the distribution.
14-
*
15-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
16-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25-
* POSSIBILITY OF SUCH DAMAGE.
26-
*
27-
* The views and conclusions contained in the software and documentation are
28-
* those of the authors and should not be interpreted as representing official
29-
* policies, either expressed or implied, of the copyright holder.
30-
*/
312

323
namespace Solarium\Tests;
334

5+
use PHPUnit\Framework\TestCase;
346
use Solarium\Client;
357

36-
class ClientTest extends \PHPUnit_Framework_TestCase
8+
class ClientTest extends TestCase
379
{
3810
public function testVersion()
3911
{

tests/Component/ComponentTest.php

+3-31
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,12 @@
11
<?php
2-
/**
3-
* Copyright 2011 Bas de Nooijer. All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without
6-
* modification, are permitted provided that the following conditions are met:
7-
*
8-
* 1. Redistributions of source code must retain the above copyright notice,
9-
* this list of conditions and the following disclaimer.
10-
*
11-
* 2. Redistributions in binary form must reproduce the above copyright notice,
12-
* this listof conditions and the following disclaimer in the documentation
13-
* and/or other materials provided with the distribution.
14-
*
15-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
16-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25-
* POSSIBILITY OF SUCH DAMAGE.
26-
*
27-
* The views and conclusions contained in the software and documentation are
28-
* those of the authors and should not be interpreted as representing official
29-
* policies, either expressed or implied, of the copyright holder.
30-
*/
312

323
namespace Solarium\Tests\Component;
334

5+
use PHPUnit\Framework\TestCase;
346
use Solarium\Component\AbstractComponent;
357
use Solarium\QueryType\Select\Query\Query;
368

37-
class ComponentTest extends \PHPUnit_Framework_TestCase
9+
class ComponentTest extends TestCase
3810
{
3911
public function testGetType()
4012
{
@@ -44,7 +16,7 @@ public function testGetType()
4416

4517
public function testSetAndGetQueryInstance()
4618
{
47-
$query = new Query;
19+
$query = new Query();
4820
$component = new TestComponent();
4921
$component->setQueryInstance($query);
5022
$this->assertEquals($query, $component->getQueryInstance());

tests/Component/DebugTest.php

+7-39
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
11
<?php
2-
/**
3-
* Copyright 2011 Bas de Nooijer. All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without
6-
* modification, are permitted provided that the following conditions are met:
7-
*
8-
* 1. Redistributions of source code must retain the above copyright notice,
9-
* this list of conditions and the following disclaimer.
10-
*
11-
* 2. Redistributions in binary form must reproduce the above copyright notice,
12-
* this listof conditions and the following disclaimer in the documentation
13-
* and/or other materials provided with the distribution.
14-
*
15-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
16-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25-
* POSSIBILITY OF SUCH DAMAGE.
26-
*
27-
* The views and conclusions contained in the software and documentation are
28-
* those of the authors and should not be interpreted as representing official
29-
* policies, either expressed or implied, of the copyright holder.
30-
*/
312

323
namespace Solarium\Tests\Component;
334

5+
use PHPUnit\Framework\TestCase;
346
use Solarium\Component\ComponentAwareQueryInterface;
357
use Solarium\Component\Debug;
8+
use Solarium\Component\RequestBuilder\Debug as DebugBuilder;
9+
use Solarium\Component\ResponseParser\Debug as DebugParser;
3610

37-
class DebugTest extends \PHPUnit_Framework_TestCase
11+
class DebugTest extends TestCase
3812
{
3913
/**
4014
* @var Debug
@@ -43,7 +17,7 @@ class DebugTest extends \PHPUnit_Framework_TestCase
4317

4418
public function setUp()
4519
{
46-
$this->debug = new Debug;
20+
$this->debug = new Debug();
4721
}
4822

4923
public function testConfigMode()
@@ -67,18 +41,12 @@ public function testGetType()
6741

6842
public function testGetResponseParser()
6943
{
70-
$this->assertInstanceOf(
71-
'Solarium\Component\ResponseParser\Debug',
72-
$this->debug->getResponseParser()
73-
);
44+
$this->assertInstanceOf(DebugParser::class, $this->debug->getResponseParser());
7445
}
7546

7647
public function testGetRequestBuilder()
7748
{
78-
$this->assertInstanceOf(
79-
'Solarium\Component\RequestBuilder\Debug',
80-
$this->debug->getRequestBuilder()
81-
);
49+
$this->assertInstanceOf(DebugBuilder::class, $this->debug->getRequestBuilder());
8250
}
8351

8452
public function testSetAndGetExplainOther()

tests/Component/MoreLikeThisTest.php

+3-31
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,12 @@
11
<?php
2-
/**
3-
* Copyright 2011 Bas de Nooijer. All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without
6-
* modification, are permitted provided that the following conditions are met:
7-
*
8-
* 1. Redistributions of source code must retain the above copyright notice,
9-
* this list of conditions and the following disclaimer.
10-
*
11-
* 2. Redistributions in binary form must reproduce the above copyright notice,
12-
* this listof conditions and the following disclaimer in the documentation
13-
* and/or other materials provided with the distribution.
14-
*
15-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
16-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25-
* POSSIBILITY OF SUCH DAMAGE.
26-
*
27-
* The views and conclusions contained in the software and documentation are
28-
* those of the authors and should not be interpreted as representing official
29-
* policies, either expressed or implied, of the copyright holder.
30-
*/
312

323
namespace Solarium\Tests\Component;
334

5+
use PHPUnit\Framework\TestCase;
346
use Solarium\Component\ComponentAwareQueryInterface;
357
use Solarium\Component\MoreLikeThis;
368

37-
class MoreLikeThisTest extends \PHPUnit_Framework_TestCase
9+
class MoreLikeThisTest extends TestCase
3810
{
3911
/**
4012
* @var MoreLikeThis
@@ -43,7 +15,7 @@ class MoreLikeThisTest extends \PHPUnit_Framework_TestCase
4315

4416
public function setUp()
4517
{
46-
$this->mlt = new MoreLikeThis;
18+
$this->mlt = new MoreLikeThis();
4719
}
4820

4921
public function testConfigMode()
+3-32
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,13 @@
11
<?php
2-
/**
3-
* Copyright 2011 Bas de Nooijer. All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without
6-
* modification, are permitted provided that the following conditions are met:
7-
*
8-
* 1. Redistributions of source code must retain the above copyright notice,
9-
* this list of conditions and the following disclaimer.
10-
*
11-
* 2. Redistributions in binary form must reproduce the above copyright notice,
12-
* this listof conditions and the following disclaimer in the documentation
13-
* and/or other materials provided with the distribution.
14-
*
15-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
16-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25-
* POSSIBILITY OF SUCH DAMAGE.
26-
*
27-
* The views and conclusions contained in the software and documentation are
28-
* those of the authors and should not be interpreted as representing official
29-
* policies, either expressed or implied, of the copyright holder.
30-
*/
312

323
namespace Solarium\Tests\Component\RequestBuilder;
334

34-
use Solarium\Component\RequestBuilder\Debug as RequestBuilder;
5+
use PHPUnit\Framework\TestCase;
356
use Solarium\Component\Debug as Component;
7+
use Solarium\Component\RequestBuilder\Debug as RequestBuilder;
368
use Solarium\Core\Client\Request;
379

38-
class DebugTest extends \PHPUnit_Framework_TestCase
10+
class DebugTest extends TestCase
3911
{
4012
public function testBuildComponent()
4113
{
@@ -55,6 +27,5 @@ public function testBuildComponent()
5527
),
5628
$request->getParams()
5729
);
58-
5930
}
6031
}

0 commit comments

Comments
 (0)