/** * @testdox The [MEDIA] tag transfers its priority to the tag it creates */ public function testTagPriority() { $newTag = $this->getMockBuilder('s9e\\TextFormatter\\Parser\\Tag')->disableOriginalConstructor()->setMethods(['setAttributes', 'setSortPriority'])->getMock(); $newTag->expects($this->once())->method('setSortPriority')->with(123); $tagStack = $this->getMockBuilder('s9e\\TextFormatter\\Parser')->disableOriginalConstructor()->setMethods(['addSelfClosingTag'])->getMock(); $tagStack->expects($this->once())->method('addSelfClosingTag')->will($this->returnValue($newTag)); $tag = new Tag(Tag::START_TAG, 'MEDIA', 0, 0); $tag->setAttribute('media', 'foo'); $tag->setSortPriority(123); Parser::filterTag($tag, $tagStack, ['foo.invalid' => 'foo']); }
/** * @testdox setSortPriority() sets the tag's sortPriority */ public function testSetSortPriority() { $tag = new Tag(Tag::START_TAG, 'X', 12, 34); $tag->setSortPriority(-10); $this->assertSame(-10, $tag->getSortPriority()); }