@@ 172-184 (lines=13) @@ | ||
169 | /** |
|
170 | * Validate we're traversing correctly down in to the child pages |
|
171 | */ |
|
172 | public function testFindChildPage() |
|
173 | { |
|
174 | /** @var Page $homePage */ |
|
175 | $homePage = Page::get()->filter(['URLSegment' => 'home'])->first(); |
|
176 | /** @var Page $homePage */ |
|
177 | $child = Page::create(['Title' => 'Test Page', 'ParentID' => $homePage->ID]); |
|
178 | $child->write(); |
|
179 | $child->doPublish(); |
|
180 | $testArray = ['', '', 'test-page']; |
|
181 | $page = $this->service->findPage($testArray); |
|
182 | $this->assertInstanceOf(Page::class, $page); |
|
183 | $this->assertEquals('/home/test-page/', $page->Link()); |
|
184 | } |
|
185 | ||
186 | /** |
|
187 | * Make sure the get params are ignored |
|
@@ 189-201 (lines=13) @@ | ||
186 | /** |
|
187 | * Make sure the get params are ignored |
|
188 | */ |
|
189 | public function testFindChildPageWithQuery() |
|
190 | { |
|
191 | /** @var Page $homePage */ |
|
192 | $homePage = Page::get()->filter(['URLSegment' => 'home'])->first(); |
|
193 | /** @var Page $homePage */ |
|
194 | $child = Page::create(['Title' => 'Test Page', 'ParentID' => $homePage->ID]); |
|
195 | $child->write(); |
|
196 | $child->doPublish(); |
|
197 | $testArray = ['', '', 'test-page', '?stage=Stage']; |
|
198 | $page = $this->service->findPage($testArray); |
|
199 | $this->assertInstanceOf(Page::class, $page); |
|
200 | $this->assertEquals('/home/test-page/', $page->Link()); |
|
201 | } |
|
202 | ||
203 | /** |
|
204 | * Make sure an empty last value is skipped |
|
@@ 206-218 (lines=13) @@ | ||
203 | /** |
|
204 | * Make sure an empty last value is skipped |
|
205 | */ |
|
206 | public function testFindPageWithEmptyLast() |
|
207 | { |
|
208 | /** @var Page $homePage */ |
|
209 | $homePage = Page::get()->filter(['URLSegment' => 'home'])->first(); |
|
210 | /** @var Page $homePage */ |
|
211 | $child = Page::create(['Title' => 'Test Page', 'ParentID' => $homePage->ID]); |
|
212 | $child->write(); |
|
213 | $child->doPublish(); |
|
214 | $testArray = ['', '', 'test-page', '']; |
|
215 | $page = $this->service->findPage($testArray); |
|
216 | $this->assertInstanceOf(Page::class, $page); |
|
217 | $this->assertEquals('/home/test-page/', $page->Link()); |
|
218 | } |
|
219 | ||
220 | /** |
|
221 | * Validate blacklisted pages don't show up |