Merge pull request #6607 from lcobucci/be-strict-with-risky-tests
Be strict with risky tests
This commit is contained in:
commit
bbe005837e
@ -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"
|
||||||
>
|
>
|
||||||
|
|
||||||
@ -46,7 +42,7 @@
|
|||||||
<var name="db_name" value="doctrine_tests" />
|
<var name="db_name" value="doctrine_tests" />
|
||||||
<var name="db_port" value="3306"/>-->
|
<var name="db_port" value="3306"/>-->
|
||||||
<!--<var name="db_event_subscribers" value="Doctrine\DBAL\Event\Listeners\OracleSessionInit">-->
|
<!--<var name="db_event_subscribers" value="Doctrine\DBAL\Event\Listeners\OracleSessionInit">-->
|
||||||
|
|
||||||
<!-- Database for temporary connections (i.e. to drop/create the main database) -->
|
<!-- Database for temporary connections (i.e. to drop/create the main database) -->
|
||||||
<var name="tmpdb_type" value="pdo_mysql"/>
|
<var name="tmpdb_type" value="pdo_mysql"/>
|
||||||
<var name="tmpdb_host" value="localhost" />
|
<var name="tmpdb_host" value="localhost" />
|
||||||
@ -56,4 +52,4 @@
|
|||||||
<var name="tmpdb_port" value="3306"/>
|
<var name="tmpdb_port" value="3306"/>
|
||||||
</php>
|
</php>
|
||||||
|
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
@ -1,62 +1,61 @@
|
|||||||
<?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();
|
||||||
|
|
||||||
$this->_schemaTool->createSchema(
|
$this->_schemaTool->createSchema(
|
||||||
[
|
[
|
||||||
$this->_em->getClassMetadata(DDC2602User::class),
|
$this->_em->getClassMetadata(DDC2602User::class),
|
||||||
$this->_em->getClassMetadata(DDC2602Biography::class),
|
$this->_em->getClassMetadata(DDC2602Biography::class),
|
||||||
$this->_em->getClassMetadata(DDC2602BiographyField::class),
|
$this->_em->getClassMetadata(DDC2602BiographyField::class),
|
||||||
$this->_em->getClassMetadata(DDC2602BiographyFieldChoice::class),
|
$this->_em->getClassMetadata(DDC2602BiographyFieldChoice::class),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->loadFixture();
|
$this->loadFixture();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown() : void
|
||||||
{
|
{
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
|
|
||||||
$this->_schemaTool->dropSchema(
|
$this->_schemaTool->dropSchema(
|
||||||
[
|
[
|
||||||
$this->_em->getClassMetadata(DDC2602User::class),
|
$this->_em->getClassMetadata(DDC2602User::class),
|
||||||
$this->_em->getClassMetadata(DDC2602Biography::class),
|
$this->_em->getClassMetadata(DDC2602Biography::class),
|
||||||
$this->_em->getClassMetadata(DDC2602BiographyField::class),
|
$this->_em->getClassMetadata(DDC2602BiographyField::class),
|
||||||
$this->_em->getClassMetadata(DDC2602BiographyFieldChoice::class),
|
$this->_em->getClassMetadata(DDC2602BiographyFieldChoice::class),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
->getResult();
|
||||||
|
|
||||||
$this
|
self::assertCount(2, $result);
|
||||||
->_em
|
self::assertCount(2, $result[0]->biography->fieldList);
|
||||||
->createQuery('SELECT u, b FROM Doctrine\Tests\ORM\Performance\DDC2602User u JOIN u.biography b')
|
self::assertCount(1, $result[1]->biography->fieldList);
|
||||||
->getResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
');
|
');
|
||||||
|
|
@ -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" />
|
||||||
|
@ -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" />
|
||||||
|
@ -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"/>
|
||||||
|
@ -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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user