@@ 37-49 (lines=13) @@ | ||
34 | /** |
|
35 | * Validate we're traversing correctly down in to the child pages |
|
36 | */ |
|
37 | public function testFindChildPage() |
|
38 | { |
|
39 | /** @var Page $homePage */ |
|
40 | $homePage = Page::get()->filter(['URLSegment' => 'home'])->first(); |
|
41 | /** @var Page $homePage */ |
|
42 | $child = Page::create(['Title' => 'Test Page', 'ParentID' => $homePage->ID]); |
|
43 | $child->write(); |
|
44 | $child->doPublish(); |
|
45 | $testArray = ['', '', 'test-page']; |
|
46 | $page = $this->service->findPage($testArray); |
|
47 | $this->assertInstanceOf(Page::class, $page); |
|
48 | $this->assertEquals('/home/test-page/', $page->Link()); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Make sure the get params are ignored |
|
@@ 54-66 (lines=13) @@ | ||
51 | /** |
|
52 | * Make sure the get params are ignored |
|
53 | */ |
|
54 | public function testFindChildPageWithQuery() |
|
55 | { |
|
56 | /** @var Page $homePage */ |
|
57 | $homePage = Page::get()->filter(['URLSegment' => 'home'])->first(); |
|
58 | /** @var Page $homePage */ |
|
59 | $child = Page::create(['Title' => 'Test Page', 'ParentID' => $homePage->ID]); |
|
60 | $child->write(); |
|
61 | $child->doPublish(); |
|
62 | $testArray = ['', '', 'test-page', '?stage=Stage']; |
|
63 | $page = $this->service->findPage($testArray); |
|
64 | $this->assertInstanceOf(Page::class, $page); |
|
65 | $this->assertEquals('/home/test-page/', $page->Link()); |
|
66 | } |
|
67 | ||
68 | /** |
|
69 | * Make sure an empty last value is skipped |
|
@@ 71-83 (lines=13) @@ | ||
68 | /** |
|
69 | * Make sure an empty last value is skipped |
|
70 | */ |
|
71 | public function testFindPageWithEmptyLast() |
|
72 | { |
|
73 | /** @var Page $homePage */ |
|
74 | $homePage = Page::get()->filter(['URLSegment' => 'home'])->first(); |
|
75 | /** @var Page $homePage */ |
|
76 | $child = Page::create(['Title' => 'Test Page', 'ParentID' => $homePage->ID]); |
|
77 | $child->write(); |
|
78 | $child->doPublish(); |
|
79 | $testArray = ['', '', 'test-page', '']; |
|
80 | $page = $this->service->findPage($testArray); |
|
81 | $this->assertInstanceOf(Page::class, $page); |
|
82 | $this->assertEquals('/home/test-page/', $page->Link()); |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * Validate updating the pages works |