obj = new HTMLPurifier_Strategy_MakeWellFormed(); $this->config->set('AutoFormat', 'AutoParagraph', true); $this->config->set('AutoFormat', 'Linkify', true); generate_mock_once('HTMLPurifier_Injector'); } function testEndNotification() { $mock = new HTMLPurifier_InjectorMock(); $mock->skip = false; $mock->expectAt(0, 'notifyEnd', array(new HTMLPurifier_Token_End('b'))); $mock->expectAt(1, 'notifyEnd', array(new HTMLPurifier_Token_End('i'))); $mock->expectCallCount('notifyEnd', 2); $this->config->set('AutoFormat', 'AutoParagraph', false); $this->config->set('AutoFormat', 'Linkify', false); $this->config->set('AutoFormat', 'Custom', array($mock)); $this->assertResult('asdf', 'asdf'); } function testOnlyAutoParagraph() { $this->assertResult( 'Foobar', '
Foobar
' ); } function testParagraphWrappingOnlyLink() { $this->assertResult( 'http://example.com', '' ); } function testParagraphWrappingNodeContainingLink() { $this->assertResult( 'http://example.com', '' ); } function testParagraphWrappingPoorlyFormedNodeContainingLink() { $this->assertResult( 'http://example.com', '' ); } function testTwoParagraphsContainingOnlyOneLink() { $this->assertResult( "http://example.com\n\nhttp://dev.example.com", '' ); } function testParagraphNextToDivWithLinks() { $this->assertResult( 'http://example.comThis URL http://example.com is what you need
' ); } function testParagraphAfterLinkifiedURL() { $this->assertResult( "http://google.com\n\nb", "b
" ); } }