/** * Unregister the specified shortcode by given name. * * @param string $name */ public function unregister($name) { if ($this->exists($name)) { $this->handlers->remove($name); } return $this; }
public function testRemoveException() { $handlers = new HandlerContainer(); $this->setExpectedException('RuntimeException'); $handlers->remove('code'); }
public function testValidProcessAfterHandlerRemoval() { $handlers = new HandlerContainer(); $handlers->add('name', function (ShortcodeInterface $s) { return $s->getName(); }); $handlers->addAlias('n', 'name'); $processor = new Processor(new RegexParser(), $handlers); $this->assertSame('n', $processor->process('[n]')); $this->assertSame('name', $processor->process('[name]')); $handlers->remove('name'); $this->assertSame('n', $processor->process('[n]')); $this->assertSame('[name]', $processor->process('[name]')); }