Passed
Push — master ( 9cf181...0135fb )
by Gordon
05:12 queued 02:38
created

SearchPageControllerTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A SearchPageControllerTest::testEmptySearchNoResults() 0 3 1
1
<?php declare(strict_types = 1);
2
3
namespace Suilven\FreeTextSearch\Tests\Page;
4
5
use SilverStripe\Dev\FunctionalTest;
6
use Suilven\FreeTextSearch\Page\SearchPage;
7
use Suilven\FreeTextSearch\Tests\Models\FlickrPhoto;
8
9
class SearchPageControllerTest extends FunctionalTest
10
{
11
    protected static $fixture_file = [
12
        'tests/fixtures/pages.yml',
13
        'tests/fixtures/sitetree.yml',
14
        'tests/fixtures/flickrphotos.yml',
15
    ];
16
17
    protected static $extra_dataobjects = [
18
        FlickrPhoto::class,
19
    ];
20
21
22
    public function testEmptySearchNoResults(): void
23
    {
24
        $this->markTestSkipped('@todo');
25
    }
26
27
28
    public function testEmptySearchShowResults(): void
29
    {
30
        $this->markTestSkipped('@todo');
31
    }
32
33
34
    public function testSearch(): void
35
    {
36
        /** @var \Suilven\FreeTextSearch\Page\SearchPage $photoSearchPage */
37
        $photoSearchPage = $this->objFromFixture(SearchPage::class, 'photo-search');
38
        $photoSearchPage->publishRecursive();
0 ignored issues
show
Bug introduced by
The method publishRecursive() does not exist on Suilven\FreeTextSearch\Page\SearchPage. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        $photoSearchPage->/** @scrutinizer ignore-call */ 
39
                          publishRecursive();
Loading history...
39
40
        $this->assertInstanceOf('Suilven\FreeTextSearch\Page\SearchPage', $photoSearchPage);
41
42
        $page = $this->get('/photo-search/?q=Fish');
43
        \error_log('PAGE:');
44
        \error_log($page->getBody());
45
46
        // @todo assertions
47
    }
48
49
50
    public function testSearchNotFirstPage(): void
51
    {
52
        /** @var \Suilven\FreeTextSearch\Page\SearchPage $photoSearchPage */
53
        $photoSearchPage = $this->objFromFixture(SearchPage::class, 'photo-search');
54
        $photoSearchPage->publishRecursive();
55
56
        $this->assertInstanceOf('Suilven\FreeTextSearch\Page\SearchPage', $photoSearchPage);
57
58
        $page = $this->get('/photo-search/?q=Fish&start=10');
59
        \error_log('PAGE:');
60
        \error_log($page->getBody());
61
62
        // @todo more search results and assertions
63
    }
64
}
65