Skip to content

Commit

Permalink
Merge pull request #6378 from Sam-Burns/phpunit6
Browse files Browse the repository at this point in the history
PHPUnit 6
  • Loading branch information
Ocramius committed Apr 1, 2017
2 parents 904f4d5 + 3d7a734 commit 03b4397
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 25 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/DoctrineTestCase.php
Expand Up @@ -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
{
}
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ORM/ConfigurationTest.php
Expand Up @@ -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 <ocramius@gmail.com>
*/
class ConfigurationTest extends PHPUnit_Framework_TestCase
class ConfigurationTest extends TestCase
{
/**
* @var Configuration
Expand Down
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/ORM/EntityNotFoundExceptionTest.php
Expand Up @@ -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()
{
Expand Down
Expand Up @@ -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()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2359Test.php
Expand Up @@ -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
{

/**
Expand Down
Expand Up @@ -25,15 +25,15 @@
use Doctrine\ORM\Events;
use Doctrine\ORM\Internal\HydrationCompleteHandler;
use Doctrine\ORM\Mapping\ClassMetadata;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use stdClass;

/**
* Tests for {@see \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
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/ORM/LazyCriteriaCollectionTest.php
Expand Up @@ -6,14 +6,15 @@
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\LazyCriteriaCollection;
use Doctrine\ORM\Persisters\Entity\EntityPersister;
use PHPUnit\Framework\TestCase;
use stdClass;

/**
* @author Marco Pivetta <ocramius@gmail.com>
*
* @covers \Doctrine\ORM\LazyCriteriaCollection
*/
class LazyCriteriaCollectionTest extends \PHPUnit_Framework_TestCase
class LazyCriteriaCollectionTest extends TestCase
{
/**
* @var \Doctrine\ORM\Persisters\Entity\EntityPersister|\PHPUnit_Framework_MockObject_MockObject
Expand Down
Expand Up @@ -7,15 +7,15 @@
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;

/**
* Tests for {@see \Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter}
*
* @covers \Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter
*/
class ReflectionPropertiesGetterTest extends PHPUnit_Framework_TestCase
class ReflectionPropertiesGetterTest extends TestCase
{
public function testRetrievesProperties()
{
Expand Down
Expand Up @@ -9,14 +9,15 @@
use Doctrine\Tests\Models\Reflection\AbstractEmbeddable;
use Doctrine\Tests\Models\Reflection\ArrayObjectExtendingClass;
use Doctrine\Tests\Models\Reflection\ConcreteEmbeddable;
use PHPUnit\Framework\TestCase;
use ReflectionProperty;

/**
* Tests for {@see \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
Expand Down
Expand Up @@ -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()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/ORM/ORMInvalidArgumentExceptionTest.php
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php
Expand Up @@ -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;
Expand All @@ -44,6 +45,7 @@ public function assertInvalidDQL($dql, $debug = false)
echo $e->getMessage() . PHP_EOL;
echo $e->getTraceAsString() . PHP_EOL;
}
$this->addToAssertionCount(1);
}
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Doctrine/Tests/ORM/Query/ParserResultTest.php
Expand Up @@ -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;

Expand Down
Expand Up @@ -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 <iam@chebba.org>
*/
class QueryExpressionVisitorTest extends \PHPUnit_Framework_TestCase
class QueryExpressionVisitorTest extends TestCase
{
/**
* @var QueryExpressionVisitor
Expand Down
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions tests/Doctrine/Tests/OrmFunctionalTestCase.php
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 03b4397

Please sign in to comment.