1
0
mirror of synced 2025-02-03 05:49:25 +03:00

Merge pull request #6378 from Sam-Burns/phpunit6

PHPUnit 6
This commit is contained in:
Marco Pivetta 2017-04-01 06:49:33 +02:00 committed by GitHub
commit 03b4397557
18 changed files with 39 additions and 25 deletions

View File

@ -26,7 +26,7 @@
}, },
"require-dev": { "require-dev": {
"symfony/yaml": "~2.3|~3.0", "symfony/yaml": "~2.3|~3.0",
"phpunit/phpunit": "^5.7" "phpunit/phpunit": "^6.0"
}, },
"suggest": { "suggest": {
"symfony/yaml": "If you want to use YAML Metadata Mapping Driver" "symfony/yaml": "If you want to use YAML Metadata Mapping Driver"

View File

@ -2,9 +2,11 @@
namespace Doctrine\Tests; namespace Doctrine\Tests;
use PHPUnit\Framework\TestCase;
/** /**
* Base testcase class for all Doctrine testcases. * Base testcase class for all Doctrine testcases.
*/ */
abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase abstract class DoctrineTestCase extends TestCase
{ {
} }

View File

@ -17,13 +17,13 @@ use Doctrine\ORM\ORMException;
use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\Tests\Models\DDC753\DDC753CustomRepository; use Doctrine\Tests\Models\DDC753\DDC753CustomRepository;
use ReflectionClass; use ReflectionClass;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
/** /**
* Tests for the Configuration object * Tests for the Configuration object
* @author Marco Pivetta <ocramius@gmail.com> * @author Marco Pivetta <ocramius@gmail.com>
*/ */
class ConfigurationTest extends PHPUnit_Framework_TestCase class ConfigurationTest extends TestCase
{ {
/** /**
* @var Configuration * @var Configuration

View File

@ -5,8 +5,9 @@ namespace Doctrine\Tests\ORM\Decorator;
use Doctrine\ORM\Decorator\EntityManagerDecorator; use Doctrine\ORM\Decorator\EntityManagerDecorator;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMapping;
use PHPUnit\Framework\TestCase;
class EntityManagerDecoratorTest extends \PHPUnit_Framework_TestCase class EntityManagerDecoratorTest extends TestCase
{ {
const VOID_METHODS = [ const VOID_METHODS = [
'persist', 'persist',

View File

@ -3,13 +3,14 @@
namespace Doctrine\Tests\ORM; namespace Doctrine\Tests\ORM;
use Doctrine\ORM\EntityNotFoundException; use Doctrine\ORM\EntityNotFoundException;
use PHPUnit\Framework\TestCase;
/** /**
* Tests for {@see \Doctrine\ORM\EntityNotFoundException} * Tests for {@see \Doctrine\ORM\EntityNotFoundException}
* *
* @covers \Doctrine\ORM\EntityNotFoundException * @covers \Doctrine\ORM\EntityNotFoundException
*/ */
class EntityNotFoundExceptionTest extends \PHPUnit_Framework_TestCase class EntityNotFoundExceptionTest extends TestCase
{ {
public function testFromClassNameAndIdentifier() public function testFromClassNameAndIdentifier()
{ {

View File

@ -5,14 +5,14 @@ namespace Doctrine\Tests\ORM;
use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs; use Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
/** /**
* Tests for {@see \Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs} * Tests for {@see \Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs}
* *
* @covers \Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs * @covers \Doctrine\ORM\Event\OnClassMetadataNotFoundEventArgs
*/ */
class OnClassMetadataNotFoundEventArgsTest extends PHPUnit_Framework_TestCase class OnClassMetadataNotFoundEventArgsTest extends TestCase
{ {
public function testEventArgsMutability() public function testEventArgsMutability()
{ {

View File

@ -8,11 +8,12 @@ use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataFactory; use Doctrine\ORM\Mapping\ClassMetadataFactory;
use PHPUnit\Framework\TestCase;
/** /**
* @group DDC-2359 * @group DDC-2359
*/ */
class DDC2359Test extends \PHPUnit_Framework_TestCase class DDC2359Test extends TestCase
{ {
/** /**

View File

@ -25,7 +25,7 @@ use Doctrine\ORM\Event\ListenersInvoker;
use Doctrine\ORM\Events; use Doctrine\ORM\Events;
use Doctrine\ORM\Internal\HydrationCompleteHandler; use Doctrine\ORM\Internal\HydrationCompleteHandler;
use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
use stdClass; use stdClass;
/** /**
@ -33,7 +33,7 @@ use stdClass;
* *
* @covers \Doctrine\ORM\Internal\HydrationCompleteHandler * @covers \Doctrine\ORM\Internal\HydrationCompleteHandler
*/ */
class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase class HydrationCompleteHandlerTest extends TestCase
{ {
/** /**
* @var \Doctrine\ORM\Event\ListenersInvoker|\PHPUnit_Framework_MockObject_MockObject * @var \Doctrine\ORM\Event\ListenersInvoker|\PHPUnit_Framework_MockObject_MockObject

View File

@ -6,6 +6,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\LazyCriteriaCollection; use Doctrine\ORM\LazyCriteriaCollection;
use Doctrine\ORM\Persisters\Entity\EntityPersister; use Doctrine\ORM\Persisters\Entity\EntityPersister;
use PHPUnit\Framework\TestCase;
use stdClass; use stdClass;
/** /**
@ -13,7 +14,7 @@ use stdClass;
* *
* @covers \Doctrine\ORM\LazyCriteriaCollection * @covers \Doctrine\ORM\LazyCriteriaCollection
*/ */
class LazyCriteriaCollectionTest extends \PHPUnit_Framework_TestCase class LazyCriteriaCollectionTest extends TestCase
{ {
/** /**
* @var \Doctrine\ORM\Persisters\Entity\EntityPersister|\PHPUnit_Framework_MockObject_MockObject * @var \Doctrine\ORM\Persisters\Entity\EntityPersister|\PHPUnit_Framework_MockObject_MockObject

View File

@ -7,7 +7,7 @@ use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;
use Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter; use Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter;
use Doctrine\Tests\Models\Reflection\ClassWithMixedProperties; use Doctrine\Tests\Models\Reflection\ClassWithMixedProperties;
use Doctrine\Tests\Models\Reflection\ParentClass; use Doctrine\Tests\Models\Reflection\ParentClass;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
use ReflectionClass; use ReflectionClass;
/** /**
@ -15,7 +15,7 @@ use ReflectionClass;
* *
* @covers \Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter * @covers \Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter
*/ */
class ReflectionPropertiesGetterTest extends PHPUnit_Framework_TestCase class ReflectionPropertiesGetterTest extends TestCase
{ {
public function testRetrievesProperties() public function testRetrievesProperties()
{ {

View File

@ -9,6 +9,7 @@ use Doctrine\Tests\Models\Mapping\Entity;
use Doctrine\Tests\Models\Reflection\AbstractEmbeddable; use Doctrine\Tests\Models\Reflection\AbstractEmbeddable;
use Doctrine\Tests\Models\Reflection\ArrayObjectExtendingClass; use Doctrine\Tests\Models\Reflection\ArrayObjectExtendingClass;
use Doctrine\Tests\Models\Reflection\ConcreteEmbeddable; use Doctrine\Tests\Models\Reflection\ConcreteEmbeddable;
use PHPUnit\Framework\TestCase;
use ReflectionProperty; use ReflectionProperty;
/** /**
@ -16,7 +17,7 @@ use ReflectionProperty;
* *
* @covers \Doctrine\ORM\Mapping\ReflectionEmbeddedProperty * @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 * @param ReflectionProperty $parentProperty property of the embeddable/entity where to write the embeddable to

View File

@ -2,11 +2,12 @@
namespace Doctrine\Tests\ORM\Mapping\Symfony; namespace Doctrine\Tests\ORM\Mapping\Symfony;
use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\Common\Persistence\Mapping\MappingException;
use PHPUnit\Framework\TestCase;
/** /**
* @group DDC-1418 * @group DDC-1418
*/ */
abstract class AbstractDriverTest extends \PHPUnit_Framework_TestCase abstract class AbstractDriverTest extends TestCase
{ {
public function testFindMappingFile() public function testFindMappingFile()
{ {

View File

@ -21,12 +21,13 @@ use Doctrine\Tests\Models\Forum\ForumUser;
use Doctrine\Tests\Models\GeoNames\City; use Doctrine\Tests\Models\GeoNames\City;
use Doctrine\Tests\Models\GeoNames\Country; use Doctrine\Tests\Models\GeoNames\Country;
use Doctrine\Tests\OrmTestCase; use Doctrine\Tests\OrmTestCase;
use PHPUnit\Framework\TestCase;
use stdClass; use stdClass;
/** /**
* @covers \Doctrine\ORM\ORMInvalidArgumentException * @covers \Doctrine\ORM\ORMInvalidArgumentException
*/ */
class ORMInvalidArgumentExceptionTest extends \PHPUnit_Framework_TestCase class ORMInvalidArgumentExceptionTest extends TestCase
{ {
/** /**
* @dataProvider invalidEntityNames * @dataProvider invalidEntityNames

View File

@ -24,6 +24,7 @@ class LanguageRecognitionTest extends OrmTestCase
{ {
try { try {
$parserResult = $this->parseDql($dql); $parserResult = $this->parseDql($dql);
$this->addToAssertionCount(1);
} catch (QueryException $e) { } catch (QueryException $e) {
if ($debug) { if ($debug) {
echo $e->getTraceAsString() . PHP_EOL; echo $e->getTraceAsString() . PHP_EOL;
@ -44,6 +45,7 @@ class LanguageRecognitionTest extends OrmTestCase
echo $e->getMessage() . PHP_EOL; echo $e->getMessage() . PHP_EOL;
echo $e->getTraceAsString() . PHP_EOL; echo $e->getTraceAsString() . PHP_EOL;
} }
$this->addToAssertionCount(1);
} }
} }

View File

@ -5,8 +5,9 @@ namespace Doctrine\Tests\ORM\Query;
use Doctrine\ORM\Query\Exec\AbstractSqlExecutor; use Doctrine\ORM\Query\Exec\AbstractSqlExecutor;
use Doctrine\ORM\Query\ParserResult; use Doctrine\ORM\Query\ParserResult;
use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMapping;
use PHPUnit\Framework\TestCase;
class ParserResultTest extends \PHPUnit_Framework_TestCase class ParserResultTest extends TestCase
{ {
public $parserResult; public $parserResult;

View File

@ -9,13 +9,14 @@ use Doctrine\Common\Collections\ExpressionBuilder as CriteriaBuilder;
use Doctrine\ORM\Query\Expr as QueryBuilder; use Doctrine\ORM\Query\Expr as QueryBuilder;
use Doctrine\ORM\Query\Parameter; use Doctrine\ORM\Query\Parameter;
use Doctrine\ORM\Query\QueryExpressionVisitor; use Doctrine\ORM\Query\QueryExpressionVisitor;
use PHPUnit\Framework\TestCase;
/** /**
* Test for QueryExpressionVisitor * Test for QueryExpressionVisitor
* *
* @author Kirill chEbba Chebunin <iam@chebba.org> * @author Kirill chEbba Chebunin <iam@chebba.org>
*/ */
class QueryExpressionVisitorTest extends \PHPUnit_Framework_TestCase class QueryExpressionVisitorTest extends TestCase
{ {
/** /**
* @var QueryExpressionVisitor * @var QueryExpressionVisitor

View File

@ -8,14 +8,14 @@ use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Repository\DefaultRepositoryFactory; use Doctrine\ORM\Repository\DefaultRepositoryFactory;
use Doctrine\Tests\Models\DDC753\DDC753DefaultRepository; use Doctrine\Tests\Models\DDC753\DDC753DefaultRepository;
use Doctrine\Tests\Models\DDC869\DDC869PaymentRepository; use Doctrine\Tests\Models\DDC869\DDC869PaymentRepository;
use PHPUnit_Framework_TestCase; use PHPUnit\Framework\TestCase;
/** /**
* Tests for {@see \Doctrine\ORM\Repository\DefaultRepositoryFactory} * Tests for {@see \Doctrine\ORM\Repository\DefaultRepositoryFactory}
* *
* @covers \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 * @var \Doctrine\ORM\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject

View File

@ -16,6 +16,7 @@ use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\Tests\DbalTypes\Rot13Type; use Doctrine\Tests\DbalTypes\Rot13Type;
use Doctrine\Tests\EventListener\CacheMetadataListener; use Doctrine\Tests\EventListener\CacheMetadataListener;
use Doctrine\Tests\Models; use Doctrine\Tests\Models;
use PHPUnit\Framework\AssertionFailedError;
/** /**
* Base testcase class for all functional ORM testcases. * Base testcase class for all functional ORM testcases.
@ -750,15 +751,15 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
} }
/** /**
* @param \Exception $e * @param \Throwable $e
* *
* @return void * @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; throw $e;
} }