@@ -28,46 +28,9 @@ public function testEmpty() {
2828 the_text ( '' );
2929 $ buffer = ob_get_clean ();
3030 $ this ->assertSame ( $ test , $ buffer );
31-
3231 }
3332
3433 public function testBeforeAfter () {
35- WP_Mock::userFunction ( 'wp_parse_args ' , [
36- 'times ' => 6 ,
37- 'return_in_order ' => [
38- [
39- 'before ' => 'b ' ,
40- 'after ' => '' ,
41- 'escape ' => '' ,
42- ],
43- [
44- 'before ' => '' ,
45- 'after ' => 'a ' ,
46- 'escape ' => '' ,
47- ],
48- [
49- 'before ' => 'b ' ,
50- 'after ' => 'a ' ,
51- 'escape ' => '' ,
52- ],
53- [
54- 'before ' => 'b ' ,
55- 'after ' => '' ,
56- 'escape ' => '' ,
57- ],
58- [
59- 'before ' => '' ,
60- 'after ' => 'a ' ,
61- 'escape ' => '' ,
62- ],
63- [
64- 'before ' => 'b ' ,
65- 'after ' => 'a ' ,
66- 'escape ' => '' ,
67- ],
68- ],
69- ] );
70-
7134 $ val = get_the_text ( 'val ' , [ 'before ' => 'b ' ] );
7235 $ val2 = get_the_text ( 'val ' , [ 'after ' => 'a ' ] );
7336 $ val3 = get_the_text ( 'val ' , [ 'before ' => 'b ' , 'after ' => 'a ' ] );
@@ -96,31 +59,7 @@ public function testBeforeAfter() {
9659 }
9760
9861 public function testEscape () {
99- WP_Mock::userFunction ( 'wp_parse_args ' , [
100- 'times ' => 4 ,
101- 'return_in_order ' => [
102- [
103- 'before ' => '' ,
104- 'after ' => '' ,
105- 'escape ' => 'test_escape ' ,
106- ],
107- [
108- 'before ' => 'b ' ,
109- 'after ' => '' ,
110- 'escape ' => 'test_escape ' ,
111- ],
112- [
113- 'before ' => '' ,
114- 'after ' => 'a ' ,
115- 'escape ' => 'test_escape ' ,
116- ],
117- [
118- 'before ' => 'b ' ,
119- 'after ' => 'a ' ,
120- 'escape ' => 'test_escape ' ,
121- ],
122- ],
123- ] );
62+
12463
12564 $ this ->assertSame ( 'esc_val ' , get_the_text ( 'val ' , [
12665 'before ' => '' ,
@@ -145,45 +84,57 @@ public function testEscape() {
14584 }
14685
14786 public function testFilterSettings () {
148- WP_Mock::userFunction ( 'wp_parse_args ' , [
149- 'return ' =>
150- [
151- 'before ' => '' ,
152- 'after ' => '' ,
153- 'escape ' => 'test_escape ' ,
154- ],
155- ] );
15687
157- WP_Mock::onFilter ( 'bea_theme_framework_text_settings ' )->with ( [
158- 'before ' => '' ,
159- 'after ' => '' ,
160- 'escape ' => 'test_escape ' ,
161- ], 'val ' )->reply ( [
162- 'before ' => 'b ' ,
163- 'after ' => 'a ' ,
164- 'escape ' => 'esc_html ' ,
165- ] );
166-
167- $ this ->assertSame ( 'bvala ' , get_the_text ( 'val ' ) );
88+ WP_Mock::onFilter ( 'bea_theme_framework_text_settings ' )->with (
89+ [
90+ 'before ' => '' ,
91+ 'after ' => '' ,
92+ 'escape ' => 'test_escape ' ,
93+ ],
94+ 'val '
95+ )->reply (
96+ [
97+ 'before ' => 'b ' ,
98+ 'after ' => 'a ' ,
99+ 'escape ' => 'esc_html ' ,
100+ ]
101+ );
102+
103+ $ this ->assertSame (
104+ 'bvala ' ,
105+ get_the_text (
106+ 'val ' ,
107+ [
108+ 'before ' => 'b ' ,
109+ 'after ' => 'a ' ,
110+ 'escape ' => 'esc_html ' ,
111+ ]
112+ )
113+ );
168114 }
169115
170116 public function testFilterValue () {
171- WP_Mock::userFunction ( 'wp_parse_args ' , [
172- 'return ' =>
117+
118+ WP_Mock::onFilter ( 'bea_theme_framework_text_value ' )->with (
119+ 'esc_val ' ,
120+ [
121+ 'before ' => '' ,
122+ 'after ' => '' ,
123+ 'escape ' => 'test_escape ' ,
124+ ]
125+ )->reply ( 'filtered ' );
126+
127+ $ this ->assertSame (
128+ 'filtered ' ,
129+ get_the_text (
130+ 'val ' ,
173131 [
174132 'before ' => '' ,
175133 'after ' => '' ,
176134 'escape ' => 'test_escape ' ,
177- ],
178- ] );
179-
180- WP_Mock::onFilter ( 'bea_theme_framework_text_value ' )->with ( 'esc_val ' , [
181- 'before ' => '' ,
182- 'after ' => '' ,
183- 'escape ' => 'test_escape ' ,
184- ] )->reply ( 'filtered ' );
185-
186- $ this ->assertSame ( 'filtered ' , get_the_text ( 'val ' ) );
135+ ]
136+ )
137+ );
187138 }
188139}
189140
0 commit comments