Skip to content

Commit

Permalink
Merge pull request #1173 from derrabus/improvement/skip-orm-on-php8
Browse files Browse the repository at this point in the history
Allow DBAL 3.0 and ignore ORM tests on php 8
  • Loading branch information
alcaeus authored May 26, 2020
2 parents 2ee4c25 + e57eada commit f5a5a3d
Show file tree
Hide file tree
Showing 13 changed files with 274 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ jobs:

# Test against PHP 8
- php: nightly
env: SYMFONY_DEPRECATIONS_HELPER=weak
before_install:
- composer config platform.php 7.4.99
- composer remove --dev doctrine/orm --no-update
install:
- travis_retry composer update -n --prefer-dist

Expand Down
10 changes: 10 additions & 0 deletions Tests/Command/ImportMappingDoctrineCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\Bundle\DoctrineBundle\Tests\Command;

use Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\Fixtures\TestKernel;
use Doctrine\ORM\EntityManagerInterface;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
Expand All @@ -20,6 +21,15 @@ class ImportMappingDoctrineCommandTest extends TestCase
/** @var CommandTester|null */
private $commandTester;

public static function setUpBeforeClass()
{
if (interface_exists(EntityManagerInterface::class)) {
return;
}

self::markTestSkipped('This test requires ORM');
}

protected function setup()
{
$this->kernel = new class() extends TestKernel {
Expand Down
10 changes: 10 additions & 0 deletions Tests/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\Mapping\ClassMetadataFactory;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
Expand All @@ -23,6 +24,15 @@

class ContainerTest extends TestCase
{
public static function setUpBeforeClass()
{
if (interface_exists(EntityManagerInterface::class)) {
return;
}

self::markTestSkipped('This test requires ORM');
}

/**
* https://github.com/doctrine/orm/pull/7953 needed, otherwise ORM classes we define services for trigger deprecations
*
Expand Down
5 changes: 5 additions & 0 deletions Tests/DataCollector/DoctrineDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\Bundle\DoctrineBundle\Tests\DataCollector;

use Doctrine\Bundle\DoctrineBundle\DataCollector\DoctrineDataCollector;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
Expand All @@ -16,6 +17,10 @@ class DoctrineDataCollectorTest extends TestCase

public function testCollectEntities()
{
if (! interface_exists(EntityManagerInterface::class)) {
self::markTestSkipped('This test requires ORM');
}

$manager = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
$config = $this->getMockBuilder('Doctrine\ORM\Configuration')->getMock();
$factory = $this->getMockBuilder('Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory')
Expand Down
Loading

0 comments on commit f5a5a3d

Please sign in to comment.