optimized legacy tests management

This commit is contained in:
Nicolas Grekas
2015-08-17 21:34:52 +02:00
committed by Fabien Potencier
parent eebfdc75f1
commit c6ab7de8f2
2 changed files with 10 additions and 6 deletions
+4 -4
View File
@@ -30,13 +30,14 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
/**
* @dataProvider getLegacyTests
* @group legacy
*/
public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs)
{
$this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs);
$this->testIntegration($file, $message, $condition, $templates, $exception, $outputs);
}
public function getTests($name, $legacyOnly = false)
public function getTests($name, $legacyTests = false)
{
$fixturesDir = realpath($this->getFixturesDir());
$tests = array();
@@ -46,8 +47,7 @@ abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase
continue;
}
$isLegacyTest = false !== strpos($file->getRealpath(), '.legacy.test');
if (($isLegacyTest && !$legacyOnly) || (!$isLegacyTest && $legacyOnly)) {
if ($legacyTests xor false !== strpos($file->getRealpath(), '.legacy.test')) {
continue;
}
+6 -2
View File
@@ -14,8 +14,9 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
/**
* @expectedException LogicException
* @expectedExceptionMessage You must set a loader first.
* @group legacy
*/
public function testLegacyRenderNoLoader()
public function testRenderNoLoader()
{
$env = new Twig_Environment();
$env->render('test');
@@ -182,7 +183,10 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
$this->assertEquals('Twig_Tests_EnvironmentTest_NodeVisitor', get_class($visitors[2]));
}
public function testLegacyRemoveExtension()
/**
* @group legacy
*/
public function testRemoveExtension()
{
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());