mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
optimized legacy tests management
This commit is contained in:
committed by
Fabien Potencier
parent
eebfdc75f1
commit
c6ab7de8f2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user