/**
  * @testdox filterAttributes() calls the logger's setAttribute() and unsetAttribute() methods for each attribute with a filterChain
  */
 public function testFilterAttributesCallsLoggerSetAttribute()
 {
     $logger = $this->getMock('s9e\\TextFormatter\\Parser\\Logger', ['setAttribute', 'unsetAttribute']);
     $logger->expects($this->at(0))->method('setAttribute')->with('foo');
     $logger->expects($this->at(2))->method('setAttribute')->with('bar');
     $logger->expects($this->exactly(2))->method('unsetAttribute');
     $tagConfig = new TagConfig();
     $tagConfig->attributes->add('foo')->filterChain->append(function () {
     });
     $tagConfig->attributes->add('bar')->filterChain->append(function () {
     });
     $tag = new Tag(Tag::SELF_CLOSING_TAG, 'X', 0, 0);
     $tag->setAttribute('foo', 'foo');
     $tag->setAttribute('bar', 'bar');
     Parser::filterAttributes($tag, $tagConfig->asConfig(), [], $logger);
 }
Exemple #2
0
 /**
  * @testdox asConfig() does not modify the tag's filterChain itself
  */
 public function testFilterChainConfigIsSafe()
 {
     $tag = new Tag();
     $config = $tag->asConfig();
     $tag->attributes->add('foo');
     $config = $tag->asConfig();
     $this->assertArrayHasKey('filterChain', $config);
 }