mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 13:26:37 +00:00
removed deprecated Twig_Environment::removeExtension()
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user