Skip to content

Commit 242ff15

Browse files
committed
Remove symfony/phpunit-bridge
1 parent 3a53b87 commit 242ff15

File tree

5 files changed

+13
-32
lines changed

5 files changed

+13
-32
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
},
2222
"require-dev": {
2323
"doctrine/coding-standard": "^12.0",
24+
"phpunit/phpunit": "^9.6",
2425
"rector/rector": "^1.1",
2526
"squizlabs/php_codesniffer": "^3.7",
26-
"symfony/phpunit-bridge": "^7.1",
2727
"vimeo/psalm": "^5.13"
2828
},
2929
"replace": {

tests/GridFS/BucketFunctionalTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,6 @@ public function testDanglingOpenWritableStream(): void
871871
}
872872

873873
$code = <<<'PHP'
874-
require '%s';
875874
require '%s';
876875
$client = MongoDB\Tests\FunctionalTestCase::createTestClient();
877876
$database = $client->selectDatabase(getenv('MONGODB_DATABASE') ?: 'phplib_test');
@@ -888,8 +887,6 @@ public function testDanglingOpenWritableStream(): void
888887
sprintf(
889888
$code,
890889
__DIR__ . '/../../vendor/autoload.php',
891-
// Include the PHPUnit autoload file to ensure PHPUnit classes can be loaded
892-
__DIR__ . '/../../vendor/bin/.phpunit/phpunit/vendor/autoload.php',
893890
),
894891
),
895892
'2>&1',
@@ -914,7 +911,6 @@ public function testDanglingOpenWritableStreamWithGlobalStreamWrapperAlias(): vo
914911
}
915912

916913
$code = <<<'PHP'
917-
require '%s';
918914
require '%s';
919915
$client = MongoDB\Tests\FunctionalTestCase::createTestClient();
920916
$database = $client->selectDatabase(getenv('MONGODB_DATABASE') ?: 'phplib_test');
@@ -931,8 +927,6 @@ public function testDanglingOpenWritableStreamWithGlobalStreamWrapperAlias(): vo
931927
sprintf(
932928
$code,
933929
__DIR__ . '/../../vendor/autoload.php',
934-
// Include the PHPUnit autoload file to ensure PHPUnit classes can be loaded
935-
__DIR__ . '/../../vendor/bin/.phpunit/phpunit/vendor/autoload.php',
936930
),
937931
),
938932
'2>&1',

tests/SpecTests/DocumentsMatchConstraint.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use SebastianBergmann\Comparator\ComparisonFailure;
1414
use SebastianBergmann\Comparator\Factory;
1515
use stdClass;
16-
use Symfony\Bridge\PhpUnit\ConstraintTrait;
1716

1817
use function array_values;
1918
use function get_debug_type;
@@ -36,8 +35,6 @@
3635
*/
3736
class DocumentsMatchConstraint extends Constraint
3837
{
39-
use ConstraintTrait;
40-
4138
/**
4239
* TODO: This is not currently used, but was preserved from the design of
4340
* TestCase::assertMatchesDocument(), which would sort keys and then compare
@@ -65,7 +62,7 @@ public function __construct(array|object $value, private bool $ignoreExtraKeysIn
6562
$this->comparatorFactory = Factory::getInstance();
6663
}
6764

68-
private function doEvaluate($other, $description = '', $returnResult = false)
65+
public function evaluate($other, string $description = '', bool $returnResult = false): ?bool
6966
{
7067
/* TODO: If ignoreExtraKeys and sortKeys are both false, then we may be
7168
* able to skip preparation, convert both documents to extended JSON,
@@ -198,7 +195,7 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $
198195
}
199196
}
200197

201-
private function doAdditionalFailureDescription($other)
198+
protected function additionalFailureDescription($other): string
202199
{
203200
if ($this->lastFailure === null) {
204201
return '';
@@ -207,12 +204,12 @@ private function doAdditionalFailureDescription($other)
207204
return $this->lastFailure->getMessage();
208205
}
209206

210-
private function doFailureDescription($other)
207+
protected function failureDescription($other): string
211208
{
212209
return 'two BSON objects are equal';
213210
}
214211

215-
private function doMatches($other)
212+
protected function matches($other): bool
216213
{
217214
/* TODO: If ignoreExtraKeys and sortKeys are both false, then we may be
218215
* able to skip preparation, convert both documents to extended JSON,
@@ -232,7 +229,7 @@ private function doMatches($other)
232229
return true;
233230
}
234231

235-
private function doToString()
232+
public function toString(): string
236233
{
237234
return 'matches ' . $this->exporter()->export($this->value);
238235
}

tests/UnifiedSpecTests/Constraint/IsBsonType.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use PHPUnit\Framework\Constraint\Constraint;
2424
use PHPUnit\Framework\Constraint\LogicalOr;
2525
use RuntimeException;
26-
use Symfony\Bridge\PhpUnit\ConstraintTrait;
2726

2827
use function array_keys;
2928
use function array_map;
@@ -40,8 +39,6 @@
4039

4140
final class IsBsonType extends Constraint
4241
{
43-
use ConstraintTrait;
44-
4542
private static array $types = [
4643
'double',
4744
'string',
@@ -88,7 +85,7 @@ public static function anyOf(string ...$types): Constraint
8885
return LogicalOr::fromConstraints(...array_map(fn ($type) => new self($type), $types));
8986
}
9087

91-
private function doMatches($other): bool
88+
protected function matches($other): bool
9289
{
9390
return match ($this->type) {
9491
'double' => is_float($other),
@@ -118,7 +115,7 @@ private function doMatches($other): bool
118115
};
119116
}
120117

121-
private function doToString(): string
118+
public function toString(): string
122119
{
123120
return sprintf('is of BSON type "%s"', $this->type);
124121
}

tests/UnifiedSpecTests/Constraint/Matches.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use RuntimeException;
1414
use SebastianBergmann\Comparator\ComparisonFailure;
1515
use SebastianBergmann\Comparator\Factory;
16-
use Symfony\Bridge\PhpUnit\ConstraintTrait;
1716

1817
use function array_keys;
1918
use function count;
@@ -49,8 +48,6 @@
4948
*/
5049
class Matches extends Constraint
5150
{
52-
use ConstraintTrait;
53-
5451
private mixed $value;
5552

5653
private bool $allowExtraRootKeys;
@@ -69,7 +66,7 @@ public function __construct($value, private ?EntityMap $entityMap = null, $allow
6966
$this->comparatorFactory = Factory::getInstance();
7067
}
7168

72-
private function doEvaluate($other, $description = '', $returnResult = false)
69+
public function evaluate($other, $description = '', $returnResult = false): ?bool
7370
{
7471
$other = self::prepare($other);
7572
$success = false;
@@ -321,8 +318,7 @@ private function assertMatchesOperator(BSONDocument $operator, $actual, string $
321318
throw new LogicException('unsupported operator: ' . $name);
322319
}
323320

324-
/** @see ConstraintTrait */
325-
private function doAdditionalFailureDescription($other)
321+
protected function additionalFailureDescription($other): string
326322
{
327323
if ($this->lastFailure === null) {
328324
return '';
@@ -331,14 +327,12 @@ private function doAdditionalFailureDescription($other)
331327
return $this->lastFailure->getMessage();
332328
}
333329

334-
/** @see ConstraintTrait */
335-
private function doFailureDescription($other)
330+
protected function failureDescription($other): string
336331
{
337332
return 'expected value matches actual value';
338333
}
339334

340-
/** @see ConstraintTrait */
341-
private function doMatches($other)
335+
protected function matches($other): bool
342336
{
343337
$other = self::prepare($other);
344338

@@ -351,8 +345,7 @@ private function doMatches($other)
351345
return true;
352346
}
353347

354-
/** @see ConstraintTrait */
355-
private function doToString()
348+
public function toString(): string
356349
{
357350
return 'matches ' . $this->exporter()->export($this->value);
358351
}

0 commit comments

Comments
 (0)