PHPLIB-462: Add compatibility traits for the TestCase class

parent 4fed85fc
<?php
namespace MongoDB\Tests\Compat;
use PHPUnit\Framework\Assert;
use ReflectionClass;
use Symfony\Bridge\PhpUnit\Legacy\PolyfillAssertTrait as SymfonyPolyfillAssertTrait;
$r = new ReflectionClass(Assert::class);
if (! $r->hasMethod('assertEqualsWithDelta')) {
/**
* @internal
*/
trait PolyfillAssertTrait
{
use SymfonyPolyfillAssertTrait;
}
} else {
/**
* @internal
*/
trait PolyfillAssertTrait
{
}
}
...@@ -7,6 +7,7 @@ use MongoDB\Driver\ReadPreference; ...@@ -7,6 +7,7 @@ use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern; use MongoDB\Driver\WriteConcern;
use MongoDB\Model\BSONArray; use MongoDB\Model\BSONArray;
use MongoDB\Model\BSONDocument; use MongoDB\Model\BSONDocument;
use MongoDB\Tests\Compat\PolyfillAssertTrait;
use PHPUnit\Framework\TestCase as BaseTestCase; use PHPUnit\Framework\TestCase as BaseTestCase;
use InvalidArgumentException; use InvalidArgumentException;
use ReflectionClass; use ReflectionClass;
...@@ -15,6 +16,8 @@ use Traversable; ...@@ -15,6 +16,8 @@ use Traversable;
abstract class TestCase extends BaseTestCase abstract class TestCase extends BaseTestCase
{ {
use PolyfillAssertTrait;
/** /**
* Return the connection URI. * Return the connection URI.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment