A b c d 23

' . '

q

' . '

in

  1. two
' . '

link mail


'; // HTML Purifier writes the styles without spaces $this->assertSame(str_replace(': ', ':', $html), purify_story($html)); } public function testPurifyRemovesScriptsAndHandlers(): void { $this->assertSame('

hi

', purify_story('

hi

')); $this->assertSame('

x

', purify_story('

x

')); $this->assertSame('', purify_story('')); } public function testPurifyRemovesUnsafeLinks(): void { $this->assertSame('x', purify_story('x')); $this->assertSame('x', purify_story('x')); $this->assertSame('x', purify_story('x')); } public function testPurifyKeepsOnlySomeStyles(): void { $this->assertSame('

x

', purify_story('

x

')); $this->assertSame('x', purify_story('x')); } public function testPurifyClosesOpenTags(): void { $this->assertSame('

x

', purify_story('

x')); $this->assertSame('', purify_story(NULL)); } public function testSanitiseLeavesAnEmptyStory(): void { $this->assertSame('', sanitise('')); $this->assertNull(sanitise(NULL)); } // SmartyPants writes numeric entities, and HTML Purifier turns them into characters public function testNumberRangesGetEnDashesInTextOnly(): void { $this->assertSame('

pages 10–20 and 3–4

', sanitise('

pages 10-20 and 3--4

')); $this->assertSame('

1–2

', sanitise('

1-2

')); } public function testDoubleHyphensBecomeEmDashes(): void { $this->assertSame('

a — b and c—d

', sanitise('

a -- b and c--d

')); } public function testThreeDotsBecomeAnEllipsis(): void { $this->assertSame('

a.b.c and 1..2

', sanitise('

a.b.c and 1..2

')); $this->assertSame('

Wait… what… now

', sanitise('

Wait... what. . . now

')); } public function testQuotesBecomeCurly(): void { $this->assertSame('

“Hi,” she said. It’s ‘fine’.

', sanitise('

"Hi," she said. It\'s \'fine\'.

')); } public function testScriptsAndCommentsAreRemoved(): void { $this->assertSame('

ab

', sanitise("

ab

")); $this->assertSame('

ab

', sanitise("

ab

")); } public function testTheResultIsPurified(): void { $this->assertSame('

x

', sanitise('

x

')); $this->assertSame('x', sanitise('x')); } }