UnCurlyQuoteTest.php
1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
include_once(dirname(dirname(__FILE__)) . '/ShortCodeLoader.php');
class UnCurlyQuoteTest extends PHPUnit_Framework_TestCase {
public function testStripCurlyQuote() {
$sl = new UnCurlyQuoteTestShortCodeLoader;
$stripped = $sl->stripCurlyQuotes('”hello”');
$this->assertEquals('hello', $stripped);
}
public function testStripCurlyQuote2() {
$sl = new UnCurlyQuoteTestShortCodeLoader;
$stripped = $sl->stripCurlyQuotes('”3″');
$this->assertEquals('3', $stripped);
}
public function testStripCurlyQuote3() {
$sl = new UnCurlyQuoteTestShortCodeLoader;
$stripped = $sl->decodeString('”submit_time>-6 0=days”');
$this->assertEquals('submit_time>-6 0=days', $stripped);
}
public function testNotStripCurlyQuoteStart() {
$sl = new UnCurlyQuoteTestShortCodeLoader;
$stripped = $sl->stripCurlyQuotes('”hello');
$this->assertEquals('”hello', $stripped);
}
public function testNotStripCurlyQuoteEnd() {
$sl = new UnCurlyQuoteTestShortCodeLoader;
$stripped = $sl->stripCurlyQuotes('hello”');
$this->assertEquals('hello”', $stripped);
}
// https://core.trac.wordpress.org/ticket/29658#comment:4
public function testWorkAroundForSpaceParseBug() {
$sl = new UnCurlyQuoteTestShortCodeLoader;
$atts['filter'] = '”submit_time>-6';
$atts[0] = 'days”';
$atts = $sl->decodeAttributes($atts);
$this->assertEquals('submit_time>-6 days', $atts['filter']);
$this->assertFalse(isset($atts[0]));
}
}
class UnCurlyQuoteTestShortCodeLoader extends ShortCodeLoader {
public function handleShortcode($atts, $content = null) {
}
}