Skip to content

Commit 12fe368

Browse files
committed
Fix tests
1 parent bfabd90 commit 12fe368

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"doctrine/data-fixtures": "^1.2.2",
3737
"doctrine/doctrine-bundle": "^1.8",
3838
"doctrine/doctrine-cache-bundle": "^1.3.5",
39-
"doctrine/mongodb-odm": "^2.0@beta",
40-
"doctrine/mongodb-odm-bundle": "^4.0@beta",
39+
"doctrine/mongodb-odm": "^2.0@rc",
40+
"doctrine/mongodb-odm-bundle": "^4.0@rc",
4141
"doctrine/orm": "^2.6.3",
4242
"elasticsearch/elasticsearch": "^6.0",
4343
"friendsofsymfony/user-bundle": "^2.2@dev",
@@ -53,7 +53,7 @@
5353
"phpstan/phpstan-doctrine": "^0.11",
5454
"phpstan/phpstan-phpunit": "^0.11",
5555
"phpstan/phpstan-symfony": "^0.11",
56-
"phpunit/phpunit": "^8.0.0",
56+
"phpunit/phpunit": "^7.5.2 || ^8.0.0",
5757
"psr/log": "^1.0",
5858
"ramsey/uuid": "^3.7",
5959
"ramsey/uuid-doctrine": "^1.4",
@@ -71,7 +71,7 @@
7171
"symfony/expression-language": "^3.4 || ^4.0",
7272
"symfony/finder": "^3.4 || ^4.0",
7373
"symfony/form": "^3.4 || ^4.0",
74-
"symfony/framework-bundle": "^4.3",
74+
"symfony/framework-bundle": "^4.3.2",
7575
"symfony/http-client": "^4.3",
7676
"symfony/mercure-bundle": "*",
7777
"symfony/messenger": "^4.3",

tests/Bridge/Symfony/Bundle/Test/ApiTestCaseTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515

1616
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase;
1717
use PHPUnit\Framework\ExpectationFailedException;
18+
use PHPUnit\Runner\Version;
1819

1920
class ApiTestCaseTest extends ApiTestCase
2021
{
2122
public function testAssertJsonContains(): void
2223
{
24+
if (version_compare(Version::id(), '8.0.0', '<')) {
25+
$this->markTestSkipped('Requires PHPUnit 8');
26+
}
27+
2328
self::createClient()->request('GET', '/');
2429
$this->assertJsonContains(['@context' => '/contexts/Entrypoint']);
2530
}
@@ -61,12 +66,20 @@ public function testAssertMatchesJsonSchema(): void
6166

6267
public function testAssertArraySubsetPassesStrictConfig(): void
6368
{
69+
if (version_compare(Version::id(), '8.0.0', '<')) {
70+
$this->markTestSkipped('Requires PHPUnit 8');
71+
}
72+
6473
$this->expectException(ExpectationFailedException::class);
6574
$this->assertArraySubset(['bar' => 0], ['bar' => '0'], true);
6675
}
6776

6877
public function testAssertArraySubsetDoesNothingForValidScenario(): void
6978
{
79+
if (version_compare(Version::id(), '8.0.0', '<')) {
80+
$this->markTestSkipped('Requires PHPUnit 8');
81+
}
82+
7083
$this->assertArraySubset([1, 2], [1, 2, 3]);
7184
}
7285
}

tests/Bridge/Symfony/Bundle/Test/ClientTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Response;
1818
use Doctrine\ORM\EntityManagerInterface;
1919
use Doctrine\ORM\Tools\SchemaTool;
20+
use PHPUnit\Runner\Version;
2021
use Symfony\Component\HttpKernel\Profiler\Profile;
2122

2223
class ClientTest extends ApiTestCase
@@ -86,6 +87,10 @@ public function authBasicProvider(): iterable
8687

8788
public function testComplexScenario(): void
8889
{
90+
if (version_compare(Version::id(), '8.0.0', '<')) {
91+
$this->markTestSkipped('Requires PHPUnit 8');
92+
}
93+
8994
self::createClient()->request('GET', '/secured_dummies', ['auth_basic' => ['dunglas', 'kevin']]);
9095
$this->assertResponseIsSuccessful();
9196
$this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');

tests/Bridge/Symfony/Bundle/Test/Constraint/ArraySubsetTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use PHPUnit\Framework\ExpectationFailedException;
2121
use PHPUnit\Framework\SelfDescribing;
2222
use PHPUnit\Framework\TestCase;
23+
use PHPUnit\Runner\Version;
2324
use ReflectionClass;
2425
use SebastianBergmann\RecursionContext\InvalidArgumentException;
2526
use Traversable;
@@ -33,8 +34,15 @@
3334
*
3435
* @see https://github.com/sebastianbergmann/phpunit/issues/3494
3536
*/
36-
final class ArraySubsetTest extends TestCase
37+
class ArraySubsetTest extends TestCase
3738
{
39+
protected function setUp(): void
40+
{
41+
if (version_compare(Version::id(), '8.0.0', '<')) {
42+
$this->markTestSkipped('Requires PHPUnit 8');
43+
}
44+
}
45+
3846
/**
3947
* @return mixed[]
4048
*/

tests/Bridge/Symfony/Bundle/Test/Constraint/MatchesJsonSchemaTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@
1616
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Constraint\MatchesJsonSchema;
1717
use PHPUnit\Framework\ExpectationFailedException;
1818
use PHPUnit\Framework\TestCase;
19+
use PHPUnit\Runner\Version;
1920

2021
class MatchesJsonSchemaTest extends TestCase
2122
{
23+
protected function setUp(): void
24+
{
25+
if (version_compare(Version::id(), '8.0.0', '<')) {
26+
$this->markTestSkipped('Requires PHPUnit 8');
27+
}
28+
}
29+
2230
public function testAdditionalFailureDescription(): void
2331
{
2432
$jsonSchema = <<<JSON

0 commit comments

Comments
 (0)