Skip to content

Commit

Permalink
Upgrade PHPUnit from 9.5 to 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sidz committed Aug 7, 2024
1 parent 32b9cc1 commit 55feba9
Show file tree
Hide file tree
Showing 198 changed files with 1,203 additions and 2,575 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'@PhpCsFixer' => true,
'@PHPUnit75Migration:risky' => true,
'@PHPUnit100Migration:risky' => true,
'@PSR2' => true,
'@Symfony' => true,
'is_null' => true,
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"guzzlehttp/guzzle": "^7.2",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^9.5",
"symfony/phpunit-bridge": "^6.0"
"phpunit/phpunit": "^10.5"
},
"conflict": {
"guzzlehttp/psr7": "<2.0.0"
Expand Down
37 changes: 18 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
bootstrap="tests/bootstrap.php"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnIncomplete="true"
cacheDirectory="./build/cache/phpunit"
>
<coverage>
<include>
<directory>src/</directory>
</include>
<exclude>
<file>src/Query/Match.php</file>
</exclude>
</coverage>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<testsuites>
<testsuite name="default">
<directory>tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>

<testsuites>
<testsuite name="default">
<directory>tests/</directory>
</testsuite>
</testsuites>

</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @internal
*/
class AbstractSimpleAggregationTest extends BaseAggregationTest
class AbstractSimpleAggregationTestCase extends BaseAggregationTestCase
{
/**
* @var AbstractSimpleAggregation&MockObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
use Elastica\Query;
use Elastica\Query\Term;
use Elastica\Query\Terms;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class AdjacencyMatrixTest extends BaseAggregationTest
class AdjacencyMatrixTestCase extends BaseAggregationTestCase
{
/**
* @group unit
*/
#[Group('unit')]
public function testToArray(): void
{
$expected = [
Expand Down Expand Up @@ -58,9 +57,7 @@ public function testToArray(): void
$this->assertEquals($expected, $agg->toArray());
}

/**
* @group unit
*/
#[Group('unit')]
public function testToArraySeparator(): void
{
$expected = [
Expand All @@ -83,9 +80,7 @@ public function testToArraySeparator(): void
$this->assertEquals($expected, $agg->toArray());
}

/**
* @group functional
*/
#[Group('functional')]
public function testAdjacencyMatrixAggregation(): void
{
$agg = new AdjacencyMatrix('interactions');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
use Elastica\Aggregation\Cardinality;
use Elastica\Index;
use Elastica\Query;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class AggregationMetadataTest extends BaseAggregationTest
class AggregationMetadataTestCase extends BaseAggregationTestCase
{
/**
* @group functional
*/
#[Group('functional')]
public function testAggregationSimpleMetadata(): void
{
$aggName = 'mock';
Expand All @@ -32,9 +31,7 @@ public function testAggregationSimpleMetadata(): void
$this->assertEquals($metadata, $results['meta']);
}

/**
* @group functional
*/
#[Group('functional')]
public function testAggregationComplexMetadata(): void
{
$aggName = 'mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@

use Elastica\Aggregation\AutoDateHistogram;
use Elastica\Query;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class AutoDateHistogramTest extends BaseAggregationTest
class AutoDateHistogramTestCase extends BaseAggregationTestCase
{
/**
* @group unit
*/
#[Group('unit')]
public function testAvgBucketAggregation(): void
{
$aggregationKey = 'aggs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
use Elastica\Document;
use Elastica\Index;
use Elastica\Query;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class AvgBucketTest extends BaseAggregationTest
class AvgBucketTestCase extends BaseAggregationTestCase
{
/**
* @group functional
*/
#[Group('functional')]
public function testAvgBucketAggregation(): void
{
$query = Query::create([])
Expand All @@ -44,9 +43,7 @@ public function testAvgBucketAggregation(): void
$this->assertEquals(161.5, $results['avg_likes_by_page']['value']);
}

/**
* @group unit
*/
#[Group('unit')]
public function testConstructThroughSetters(): void
{
$aggregation = (new AvgBucket('avg_bucket', 'pages>avg_likes_by_page'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
use Elastica\Document;
use Elastica\Index;
use Elastica\Query;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class AvgTest extends BaseAggregationTest
class AvgTestCase extends BaseAggregationTestCase
{
/**
* @group functional
*/
#[Group('functional')]
public function testAvgAggregation(): void
{
$agg = new Avg('avg');
Expand All @@ -32,9 +31,7 @@ public function testAvgAggregation(): void
$this->assertEquals((5 + 8 + 1 + 3) / 4.0, $results['avg']['value']);
}

/**
* @group functional
*/
#[Group('functional')]
public function testAvgAggregationWithMissingValue(): void
{
$agg = new Avg('avg');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use Elastica\Test\Base;

abstract class BaseAggregationTest extends Base
abstract class BaseAggregationTestCase extends Base
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
use Elastica\Document;
use Elastica\Index;
use Elastica\Query;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class BucketScriptTest extends BaseAggregationTest
class BucketScriptTestCase extends BaseAggregationTestCase
{
/**
* @group functional
*/
#[Group('functional')]
public function testBucketScriptAggregation(): void
{
$bucketScriptAggregation = new BucketScript(
Expand Down Expand Up @@ -48,9 +47,7 @@ public function testBucketScriptAggregation(): void
$this->assertEquals(3.1, $results['buckets'][2]['result']['value']);
}

/**
* @group unit
*/
#[Group('unit')]
public function testConstructThroughSetters(): void
{
$serialDiffAgg = new BucketScript('bucket_scripted', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
use Elastica\Document;
use Elastica\Index;
use Elastica\Query;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class BucketSelectorTest extends BaseAggregationTest
class BucketSelectorTestCase extends BaseAggregationTestCase
{
/**
* @group unit
*/
#[Group('unit')]
public function testToArray(): void
{
$expected = [
Expand All @@ -44,9 +43,7 @@ public function testToArray(): void
$this->assertEquals($expected, $maxAgg->toArray());
}

/**
* @group functional
*/
#[Group('functional')]
public function testMaxAggregation(): void
{
$index = $this->_getIndexForTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
use Elastica\Index;
use Elastica\Mapping;
use Elastica\Query;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class CardinalityTest extends BaseAggregationTest
class CardinalityTestCase extends BaseAggregationTestCase
{
/**
* @group functional
*/
#[Group('functional')]
public function testCardinalityAggregation(): void
{
$agg = new Cardinality('cardinality');
Expand All @@ -30,9 +30,7 @@ public function testCardinalityAggregation(): void
$this->assertEquals(3, $results['value']);
}

/**
* @group functional
*/
#[Group('functional')]
public function testCardinalityAggregationWithMissing(): void
{
$agg = new Cardinality('cardinality');
Expand All @@ -46,7 +44,7 @@ public function testCardinalityAggregationWithMissing(): void
$this->assertEquals(4, $results['value']);
}

public function validPrecisionThresholdProvider(): array
public static function validPrecisionThresholdProvider(): array
{
return [
'negative-int' => [-140],
Expand All @@ -56,11 +54,8 @@ public function validPrecisionThresholdProvider(): array
];
}

/**
* @dataProvider validPrecisionThresholdProvider
*
* @group unit
*/
#[Group('unit')]
#[DataProvider('validPrecisionThresholdProvider')]
public function testPrecisionThreshold(int $threshold): void
{
$agg = new Cardinality('threshold');
Expand All @@ -70,11 +65,8 @@ public function testPrecisionThreshold(int $threshold): void
$this->assertIsInt($agg->getParam('precision_threshold'));
}

/**
* @dataProvider validRehashProvider
*
* @group unit
*/
#[Group('unit')]
#[DataProvider('validRehashProvider')]
public function testRehash(bool $rehash): void
{
$agg = new Cardinality('rehash');
Expand All @@ -84,7 +76,7 @@ public function testRehash(bool $rehash): void
$this->assertIsBool($agg->getParam('rehash'));
}

public function validRehashProvider(): array
public static function validRehashProvider(): array
{
return [
'true' => [true],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
use Elastica\Index;
use Elastica\Mapping;
use Elastica\Query;
use PHPUnit\Framework\Attributes\Group;

/**
* @internal
*/
class ChildrenTest extends BaseAggregationTest
class ChildrenTestCase extends BaseAggregationTestCase
{
/**
* @group functional
*/
#[Group('functional')]
public function testChildrenAggregation(): void
{
$agg = new Children('answer');
Expand All @@ -43,9 +42,7 @@ public function testChildrenAggregation(): void
$this->assertArrayHasKey('name', $childrenAggregations);
}

/**
* @group functional
*/
#[Group('functional')]
public function testChildrenAggregationCount(): void
{
$agg = new Children('answer');
Expand Down
Loading

0 comments on commit 55feba9

Please sign in to comment.