93 | | /** |
94 | | * make sure unbalanced tags are fixed when they span a --more-- tag |
95 | | * @ticket 6297 |
96 | | */ |
97 | | function test_post_content_unbalanced_more() { |
98 | | $content = <<<EOF |
99 | | <em>some text<!--more--> |
100 | | that's continued after the jump</em> |
101 | | EOF; |
102 | | |
103 | | $expected = <<<EOF |
104 | | <em>some text</em><!--more--> |
105 | | that's continued after the jump |
106 | | EOF; |
107 | | |
108 | | $id = $this->factory->post->create( array( 'post_content' => $content ) ); |
109 | | $post = get_post($id); |
110 | | |
111 | | $this->assertEquals( $expected, $post->post_content ); |
112 | | } |
113 | | |
114 | | /** |
115 | | * make sure unbalanced tags are fixed when they span a --nextpage-- tag |
116 | | * @ticket 6297 |
117 | | */ |
118 | | function test_post_content_unbalanced_nextpage() { |
119 | | $content = <<<EOF |
120 | | <em>some text<!--nextpage--> |
121 | | that's continued after the jump</em> |
122 | | EOF; |
123 | | |
124 | | $expected = <<<EOF |
125 | | <em>some text</em><!--nextpage--> |
126 | | that's continued after the jump |
127 | | EOF; |
128 | | |
129 | | $id = $this->factory->post->create( array( 'post_content' => $content ) ); |
130 | | $post = get_post($id); |
131 | | |
132 | | $this->assertEquals( $expected, $post->post_content ); |
133 | | } |
134 | | |
135 | | /** |
136 | | * make sure unbalanced tags are fixed when they span both --more-- and --nextpage-- tags (in that order) |
137 | | * @ticket 6297 |
138 | | */ |
139 | | function test_post_content_unbalanced_more_nextpage() { |
140 | | $content = <<<EOF |
141 | | <em>some text<!--more--> |
142 | | that's continued after the jump</em> |
143 | | <!--nextpage--> |
144 | | <p>and the next page |
145 | | <!--nextpage--> |
146 | | breaks the graf</p> |
147 | | EOF; |
148 | | |
149 | | $expected = <<<EOF |
150 | | <em>some text</em><!--more--> |
151 | | that's continued after the jump |
152 | | <!--nextpage--> |
153 | | <p>and the next page |
154 | | </p><!--nextpage--> |
155 | | breaks the graf |
156 | | EOF; |
157 | | |
158 | | $id = $this->factory->post->create( array( 'post_content' => $content ) ); |
159 | | $post = get_post($id); |
160 | | |
161 | | $this->assertEquals( $expected, $post->post_content ); |
162 | | } |
163 | | |
164 | | /** |
165 | | * make sure unbalanced tags are fixed when they span both --nextpage-- and --more-- tags (in that order) |
166 | | * @ticket 6297 |
167 | | */ |
168 | | function test_post_content_unbalanced_nextpage_more() { |
169 | | $content = <<<EOF |
170 | | <em>some text<!--nextpage--> |
171 | | that's continued after the jump</em> |
172 | | <!--more--> |
173 | | <p>and the next page |
174 | | <!--nextpage--> |
175 | | breaks the graf</p> |
176 | | EOF; |
177 | | |
178 | | $expected = <<<EOF |
179 | | <em>some text</em><!--nextpage--> |
180 | | that's continued after the jump |
181 | | <!--more--> |
182 | | <p>and the next page |
183 | | </p><!--nextpage--> |
184 | | breaks the graf |
185 | | EOF; |
186 | | |
187 | | $id = $this->factory->post->create( array( 'post_content' => $content ) ); |
188 | | $post = get_post($id); |
189 | | |
190 | | $this->assertEquals( $expected, $post->post_content ); |
191 | | } |
192 | | |