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

Merge pull request #6607 from lcobucci/be-strict-with-risky-tests

Be strict with risky tests
This commit is contained in:
Marco Pivetta 2017-08-06 14:40:16 +02:00 committed by GitHub
commit bbe005837e
6 changed files with 56 additions and 38 deletions

View File

@ -11,15 +11,11 @@
tests/ folder: phpunit -c <filename> ... tests/ folder: phpunit -c <filename> ...
Example: phpunit -c mysqlconf.xml AllTests Example: phpunit -c mysqlconf.xml AllTests
--> -->
<phpunit backupGlobals="false" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupStaticAttributes="false" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true" colors="true"
convertErrorsToExceptions="true" verbose="true"
convertNoticesToExceptions="true" failOnRisky="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/Doctrine/Tests/TestInit.php" bootstrap="./tests/Doctrine/Tests/TestInit.php"
> >

View File

@ -1,18 +1,18 @@
<?php <?php
namespace Doctrine\Tests\ORM\Performance; namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events; use Doctrine\ORM\Events;
use Doctrine\Tests\OrmPerformanceTestCase; use Doctrine\Tests\OrmFunctionalTestCase;
/** /**
* @group DDC-2602 * @group DDC-2602
*/ */
class DDC2602Test extends OrmPerformanceTestCase class DDC2602Test extends OrmFunctionalTestCase
{ {
protected function setUp() protected function setUp() : void
{ {
parent::setUp(); parent::setUp();
@ -28,7 +28,7 @@ class DDC2602Test extends OrmPerformanceTestCase
$this->loadFixture(); $this->loadFixture();
} }
protected function tearDown() protected function tearDown() : void
{ {
parent::tearDown(); parent::tearDown();
@ -42,21 +42,20 @@ class DDC2602Test extends OrmPerformanceTestCase
); );
} }
public function testIssue() public function testPostLoadListenerShouldBeAbleToRunQueries() : void
{ {
$eventManager = $this->_em->getEventManager(); $eventManager = $this->_em->getEventManager();
$eventManager->addEventListener([Events::postLoad], new DDC2602PostLoadListener()); $eventManager->addEventListener([Events::postLoad], new DDC2602PostLoadListener());
// Set maximum seconds this can run $result = $this->_em->createQuery('SELECT u, b FROM Doctrine\Tests\ORM\Functional\Ticket\DDC2602User u JOIN u.biography b')
$this->setMaxRunningTime(1);
$this
->_em
->createQuery('SELECT u, b FROM Doctrine\Tests\ORM\Performance\DDC2602User u JOIN u.biography b')
->getResult(); ->getResult();
self::assertCount(2, $result);
self::assertCount(2, $result[0]->biography->fieldList);
self::assertCount(1, $result[1]->biography->fieldList);
} }
private function loadFixture() private function loadFixture() : void
{ {
$user1 = new DDC2602User(); $user1 = new DDC2602User();
$user2 = new DDC2602User(); $user2 = new DDC2602User();
@ -127,7 +126,7 @@ class DDC2602Test extends OrmPerformanceTestCase
class DDC2602PostLoadListener class DDC2602PostLoadListener
{ {
public function postLoad(LifecycleEventArgs $event) public function postLoad(LifecycleEventArgs $event) : void
{ {
$entity = $event->getEntity(); $entity = $event->getEntity();
@ -138,7 +137,7 @@ class DDC2602PostLoadListener
$entityManager = $event->getEntityManager(); $entityManager = $event->getEntityManager();
$query = $entityManager->createQuery(' $query = $entityManager->createQuery('
SELECT f, fc SELECT f, fc
FROM Doctrine\Tests\ORM\Performance\DDC2602BiographyField f INDEX BY f.id FROM Doctrine\Tests\ORM\Functional\Ticket\DDC2602BiographyField f INDEX BY f.id
JOIN f.choiceList fc INDEX BY fc.id JOIN f.choiceList fc INDEX BY fc.id
'); ');

View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="../Doctrine/Tests/TestInit.php" colors="true"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
verbose="true"
failOnRisky="true"
bootstrap="../Doctrine/Tests/TestInit.php"
>
<php> <php>
<var name="db_type" value="pdo_mysql"/> <var name="db_type" value="pdo_mysql"/>
<var name="db_host" value="localhost" /> <var name="db_host" value="localhost" />

View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="../Doctrine/Tests/TestInit.php" colors="true"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
verbose="true"
failOnRisky="true"
bootstrap="../Doctrine/Tests/TestInit.php"
>
<php> <php>
<var name="db_type" value="pdo_mysql"/> <var name="db_type" value="pdo_mysql"/>
<var name="db_host" value="localhost" /> <var name="db_host" value="localhost" />

View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="../Doctrine/Tests/TestInit.php" colors="true"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
verbose="true"
failOnRisky="true"
bootstrap="../Doctrine/Tests/TestInit.php"
>
<php> <php>
<!-- "Real" test database --> <!-- "Real" test database -->
<var name="db_type" value="pdo_pgsql"/> <var name="db_type" value="pdo_pgsql"/>

View File

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="../Doctrine/Tests/TestInit.php" colors="true"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
verbose="true"
failOnRisky="true"
bootstrap="../Doctrine/Tests/TestInit.php"
>
<testsuites> <testsuites>
<testsuite name="Doctrine ORM Test Suite"> <testsuite name="Doctrine ORM Test Suite">
<directory>./../Doctrine/Tests/ORM</directory> <directory>./../Doctrine/Tests/ORM</directory>