Passed
Push — master ( b59ea0...ef0b76 )
by Simon
02:07
created

TestIndex::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 12
rs 9.9332
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Tests;
5
6
use Firesphere\SolrSearch\Indexes\BaseIndex;
7
use SilverStripe\CMS\Model\SiteTree;
1 ignored issue
show
Bug introduced by
The type SilverStripe\CMS\Model\SiteTree was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use SilverStripe\Dev\TestOnly;
9
10
class TestIndex extends BaseIndex implements TestOnly
11
{
12
    protected $facetFields = [
13
        SiteTree::class => [
14
            'BaseClass' => SiteTree::class,
15
            'Title'     => 'Parent',
16
            'Field'     => 'ParentID',
17
        ],
18
    ];
19
20
    public function init(): void
21
    {
22
        $this->addClass(SiteTree::class);
23
        $this->addFulltextField('Title');
24
        $this->addFulltextField('Content');
25
        $this->addFilterField('Title');
26
        $this->addFilterField('Created');
27
        $this->addSortField('Created');
28
        $this->addFacetField(SiteTree::class, [
29
            'BaseClass' => SiteTree::class,
30
            'Title'     => 'Parent',
31
            'Field'     => 'ParentID',
32
        ]);
33
    }
34
35
    public function getIndexName(): string
36
    {
37
        return 'TestIndex';
38
    }
39
}
40