1
0
mirror of synced 2025-02-02 21:41:45 +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> ...
Example: phpunit -c mysqlconf.xml AllTests
-->
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
verbose="true"
failOnRisky="true"
bootstrap="./tests/Doctrine/Tests/TestInit.php"
>

View File

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

View File

@ -1,5 +1,11 @@
<?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>
<var name="db_type" value="pdo_mysql"/>
<var name="db_host" value="localhost" />

View File

@ -1,5 +1,11 @@
<?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>
<var name="db_type" value="pdo_mysql"/>
<var name="db_host" value="localhost" />

View File

@ -1,5 +1,11 @@
<?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>
<!-- "Real" test database -->
<var name="db_type" value="pdo_pgsql"/>

View File

@ -1,6 +1,11 @@
<?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>
<testsuite name="Doctrine ORM Test Suite">
<directory>./../Doctrine/Tests/ORM</directory>