Code Duplication    Length = 13-13 lines in 3 locations

tests/PageUpdateServiceTest.php 3 locations

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