diff --git a/composer.json b/composer.json index bd8e8506175..5c0bf595844 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ }, "require-dev": { "symfony/yaml": "~2.3|~3.0", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^6.0" }, "suggest": { "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" diff --git a/tests/Doctrine/Tests/DoctrineTestCase.php b/tests/Doctrine/Tests/DoctrineTestCase.php index e5ce27af91d..457f52f366c 100644 --- a/tests/Doctrine/Tests/DoctrineTestCase.php +++ b/tests/Doctrine/Tests/DoctrineTestCase.php @@ -2,9 +2,11 @@ namespace Doctrine\Tests; +use PHPUnit\Framework\TestCase; + /** * Base testcase class for all Doctrine testcases. */ -abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase +abstract class DoctrineTestCase extends TestCase { } diff --git a/tests/Doctrine/Tests/ORM/ConfigurationTest.php b/tests/Doctrine/Tests/ORM/ConfigurationTest.php index 1b0042064f3..df74c6df246 100644 --- a/tests/Doctrine/Tests/ORM/ConfigurationTest.php +++ b/tests/Doctrine/Tests/ORM/ConfigurationTest.php @@ -17,13 +17,13 @@ use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\Tests\Models\DDC753\DDC753CustomRepository; use ReflectionClass; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Tests for the Configuration object * @author Marco Pivetta */ -class ConfigurationTest extends PHPUnit_Framework_TestCase +class ConfigurationTest extends TestCase { /** * @var Configuration diff --git a/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php b/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php index 1e9f55d43ff..b8688d871db 100644 --- a/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php +++ b/tests/Doctrine/Tests/ORM/Decorator/EntityManagerDecoratorTest.php @@ -5,8 +5,9 @@ use Doctrine\ORM\Decorator\EntityManagerDecorator; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query\ResultSetMapping; +use PHPUnit\Framework\TestCase; -class EntityManagerDecoratorTest extends \PHPUnit_Framework_TestCase +class EntityManagerDecoratorTest extends TestCase { const VOID_METHODS = [ 'persist', diff --git a/tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php b/tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php index bc4979000e8..ec1cfbfc99c 100644 --- a/tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php +++ b/tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php @@ -3,13 +3,14 @@ namespace Doctrine\Tests\ORM; use Doctrine\ORM\EntityNotFoundException; +use PHPUnit\Framework\TestCase; /** * Tests for {@see \Doctrine\ORM\EntityNotFoundException} * * @covers \Doctrine\ORM\EntityNotFoundException */ -class EntityNotFoundExceptionTest extends \PHPUnit_Framework_TestCase +class EntityNotFoundExceptionTest extends TestCase { public function testFromClassNameAndIdentifier() { diff --git a/tests/Doctrine/Tests/ORM/Event/OnClassMetadataNotFoundEventArgsTest.php b/tests/Doctrine/Tests/ORM/Event/OnClassMetadataNotFoundEventArgsTest.php index 54f2feb0dd8..e5f62bd26ae 100644 --- a/tests/Doctrine/Tests/ORM/Event/OnClassMetadataNotFoundEventArgsTest.php +++ b/tests/Doctrine/Tests/ORM/Event/OnClassMetadataNotFoundEventArgsTest.php @@ -5,14 +5,14 @@ use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Tests for {@see \Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs} * * @covers \Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs */ -class OnClassMetadataNotFoundEventArgsTest extends PHPUnit_Framework_TestCase +class OnClassMetadataNotFoundEventArgsTest extends TestCase { public function testEventArgsMutability() { diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php index ba8a621d59b..21a932ed36d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php @@ -8,11 +8,12 @@ use Doctrine\ORM\EntityManager; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadataFactory; +use PHPUnit\Framework\TestCase; /** * @group DDC-2359 */ -class DDC2359Test extends \PHPUnit_Framework_TestCase +class DDC2359Test extends TestCase { /** diff --git a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php index 851cc2ae370..27b23f5128f 100644 --- a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php +++ b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php @@ -25,7 +25,7 @@ use Doctrine\ORM\Events; use Doctrine\ORM\Internal\HydrationCompleteHandler; use Doctrine\ORM\Mapping\ClassMetadata; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use stdClass; /** @@ -33,7 +33,7 @@ * * @covers \Doctrine\ORM\Internal\HydrationCompleteHandler */ -class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase +class HydrationCompleteHandlerTest extends TestCase { /** * @var \Doctrine\ORM\Event\ListenersInvoker|\PHPUnit_Framework_MockObject_MockObject diff --git a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php index 3015341d951..9286da614f8 100644 --- a/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php +++ b/tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php @@ -6,6 +6,7 @@ use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\LazyCriteriaCollection; use Doctrine\ORM\Persisters\Entity\EntityPersister; +use PHPUnit\Framework\TestCase; use stdClass; /** @@ -13,7 +14,7 @@ * * @covers \Doctrine\ORM\LazyCriteriaCollection */ -class LazyCriteriaCollectionTest extends \PHPUnit_Framework_TestCase +class LazyCriteriaCollectionTest extends TestCase { /** * @var \Doctrine\ORM\Persisters\Entity\EntityPersister|\PHPUnit_Framework_MockObject_MockObject diff --git a/tests/Doctrine/Tests/ORM/Mapping/Reflection/ReflectionPropertiesGetterTest.php b/tests/Doctrine/Tests/ORM/Mapping/Reflection/ReflectionPropertiesGetterTest.php index 06a895159c5..29906d59b9d 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/Reflection/ReflectionPropertiesGetterTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/Reflection/ReflectionPropertiesGetterTest.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter; use Doctrine\Tests\Models\Reflection\ClassWithMixedProperties; use Doctrine\Tests\Models\Reflection\ParentClass; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use ReflectionClass; /** @@ -15,7 +15,7 @@ * * @covers \Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter */ -class ReflectionPropertiesGetterTest extends PHPUnit_Framework_TestCase +class ReflectionPropertiesGetterTest extends TestCase { public function testRetrievesProperties() { diff --git a/tests/Doctrine/Tests/ORM/Mapping/ReflectionEmbeddedPropertyTest.php b/tests/Doctrine/Tests/ORM/Mapping/ReflectionEmbeddedPropertyTest.php index 04ed194a62f..82761282ad4 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ReflectionEmbeddedPropertyTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ReflectionEmbeddedPropertyTest.php @@ -9,6 +9,7 @@ use Doctrine\Tests\Models\Reflection\AbstractEmbeddable; use Doctrine\Tests\Models\Reflection\ArrayObjectExtendingClass; use Doctrine\Tests\Models\Reflection\ConcreteEmbeddable; +use PHPUnit\Framework\TestCase; use ReflectionProperty; /** @@ -16,7 +17,7 @@ * * @covers \Doctrine\ORM\Mapping\ReflectionEmbeddedProperty */ -class ReflectionEmbeddedPropertyTest extends \PHPUnit_Framework_TestCase +class ReflectionEmbeddedPropertyTest extends TestCase { /** * @param ReflectionProperty $parentProperty property of the embeddable/entity where to write the embeddable to diff --git a/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php index 082ebaf94be..85b3b2138dd 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/Symfony/AbstractDriverTest.php @@ -2,11 +2,12 @@ namespace Doctrine\Tests\ORM\Mapping\Symfony; use Doctrine\Common\Persistence\Mapping\MappingException; +use PHPUnit\Framework\TestCase; /** * @group DDC-1418 */ -abstract class AbstractDriverTest extends \PHPUnit_Framework_TestCase +abstract class AbstractDriverTest extends TestCase { public function testFindMappingFile() { diff --git a/tests/Doctrine/Tests/ORM/ORMInvalidArgumentExceptionTest.php b/tests/Doctrine/Tests/ORM/ORMInvalidArgumentExceptionTest.php index 81f22e2b7dc..b4d26907854 100644 --- a/tests/Doctrine/Tests/ORM/ORMInvalidArgumentExceptionTest.php +++ b/tests/Doctrine/Tests/ORM/ORMInvalidArgumentExceptionTest.php @@ -21,12 +21,13 @@ use Doctrine\Tests\Models\GeoNames\City; use Doctrine\Tests\Models\GeoNames\Country; use Doctrine\Tests\OrmTestCase; +use PHPUnit\Framework\TestCase; use stdClass; /** * @covers \Doctrine\ORM\ORMInvalidArgumentException */ -class ORMInvalidArgumentExceptionTest extends \PHPUnit_Framework_TestCase +class ORMInvalidArgumentExceptionTest extends TestCase { /** * @dataProvider invalidEntityNames diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php index 46e72245a22..064c0a799cb 100644 --- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php @@ -24,6 +24,7 @@ public function assertValidDQL($dql, $debug = false) { try { $parserResult = $this->parseDql($dql); + $this->addToAssertionCount(1); } catch (QueryException $e) { if ($debug) { echo $e->getTraceAsString() . PHP_EOL; @@ -44,6 +45,7 @@ public function assertInvalidDQL($dql, $debug = false) echo $e->getMessage() . PHP_EOL; echo $e->getTraceAsString() . PHP_EOL; } + $this->addToAssertionCount(1); } } diff --git a/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php b/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php index 3d74e0f96c5..1b74654430e 100644 --- a/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php +++ b/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php @@ -5,8 +5,9 @@ use Doctrine\ORM\Query\Exec\AbstractSqlExecutor; use Doctrine\ORM\Query\ParserResult; use Doctrine\ORM\Query\ResultSetMapping; +use PHPUnit\Framework\TestCase; -class ParserResultTest extends \PHPUnit_Framework_TestCase +class ParserResultTest extends TestCase { public $parserResult; diff --git a/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php b/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php index 91b99f2e35f..4e7434c851f 100644 --- a/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php +++ b/tests/Doctrine/Tests/ORM/Query/QueryExpressionVisitorTest.php @@ -9,13 +9,14 @@ use Doctrine\ORM\Query\Expr as QueryBuilder; use Doctrine\ORM\Query\Parameter; use Doctrine\ORM\Query\QueryExpressionVisitor; +use PHPUnit\Framework\TestCase; /** * Test for QueryExpressionVisitor * * @author Kirill chEbba Chebunin */ -class QueryExpressionVisitorTest extends \PHPUnit_Framework_TestCase +class QueryExpressionVisitorTest extends TestCase { /** * @var QueryExpressionVisitor diff --git a/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php b/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php index 963757618af..85a63404618 100644 --- a/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php +++ b/tests/Doctrine/Tests/ORM/Repository/DefaultRepositoryFactoryTest.php @@ -8,14 +8,14 @@ use Doctrine\ORM\Repository\DefaultRepositoryFactory; use Doctrine\Tests\Models\DDC753\DDC753DefaultRepository; use Doctrine\Tests\Models\DDC869\DDC869PaymentRepository; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Tests for {@see \Doctrine\ORM\Repository\DefaultRepositoryFactory} * * @covers \Doctrine\ORM\Repository\DefaultRepositoryFactory */ -class DefaultRepositoryFactoryTest extends PHPUnit_Framework_TestCase +class DefaultRepositoryFactoryTest extends TestCase { /** * @var \Doctrine\ORM\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject diff --git a/tests/Doctrine/Tests/OrmFunctionalTestCase.php b/tests/Doctrine/Tests/OrmFunctionalTestCase.php index 9a684785378..88fbc43ca15 100644 --- a/tests/Doctrine/Tests/OrmFunctionalTestCase.php +++ b/tests/Doctrine/Tests/OrmFunctionalTestCase.php @@ -16,6 +16,7 @@ use Doctrine\Tests\DbalTypes\Rot13Type; use Doctrine\Tests\EventListener\CacheMetadataListener; use Doctrine\Tests\Models; +use PHPUnit\Framework\AssertionFailedError; /** * Base testcase class for all functional ORM testcases. @@ -750,15 +751,15 @@ protected function _getEntityManager($config = null, $eventManager = null) { } /** - * @param \Exception $e + * @param \Throwable $e * * @return void * - * @throws \Exception + * @throws \Throwable */ - protected function onNotSuccessfulTest($e) + protected function onNotSuccessfulTest(\Throwable $e) { - if ($e instanceof \PHPUnit_Framework_AssertionFailedError) { + if ($e instanceof AssertionFailedError) { throw $e; }