removed deprecated Twig_Environment::removeExtension()

This commit is contained in:
Fabien Potencier
2013-08-05 18:43:54 +02:00
parent 2d659ed5a8
commit d821ec2e90
2 changed files with 0 additions and 34 deletions
-18
View File
@@ -699,24 +699,6 @@ class Twig_Environment
$this->extensions[$extension->getName()] = $extension;
}
/**
* Removes an extension by name.
*
* This method is deprecated and you should not use it.
*
* @param string $name The extension name
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
public function removeExtension($name)
{
if ($this->extensionInitialized) {
throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name));
}
unset($this->extensions[$name]);
}
/**
* Registers an array of extensions.
*
-16
View File
@@ -181,22 +181,6 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
$visitors = $twig->getNodeVisitors();
$this->assertEquals('Twig_Tests_EnvironmentTest_NodeVisitor', get_class($visitors[2]));
}
public function testRemoveExtension()
{
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
$twig->addExtension(new Twig_Tests_EnvironmentTest_Extension());
$twig->removeExtension('environment_test');
$this->assertFalse(array_key_exists('test', $twig->getTags()));
$this->assertFalse(array_key_exists('foo_filter', $twig->getFilters()));
$this->assertFalse(array_key_exists('foo_function', $twig->getFunctions()));
$this->assertFalse(array_key_exists('foo_test', $twig->getTests()));
$this->assertFalse(array_key_exists('foo_unary', $twig->getUnaryOperators()));
$this->assertFalse(array_key_exists('foo_binary', $twig->getBinaryOperators()));
$this->assertFalse(array_key_exists('foo_global', $twig->getGlobals()));
$this->assertCount(2, $twig->getNodeVisitors());
}
}
class Twig_Tests_EnvironmentTest_Extension extends Twig_Extension