Passed
Push — master ( 0b2f25...4fb89a )
by Simon
02:00
created

SolrSearchFormTest::testConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 18
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
4
namespace Firesphere\SolrSearch\Tests;
5
6
7
use Firesphere\SolrSearch\Forms\SolrSearchForm;
8
use Page;
1 ignored issue
show
Bug introduced by
The type Page 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...
9
use PageController;
1 ignored issue
show
Bug introduced by
The type PageController 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...
10
use SilverStripe\Core\Injector\Injector;
11
use SilverStripe\Dev\SapphireTest;
12
use SilverStripe\Forms\FieldList;
13
use SilverStripe\Security\NullSecurityToken;
14
15
class SolrSearchFormTest extends SapphireTest
16
{
17
18
    public function testConstruct()
19
    {
20
        /** @var Page $page */
21
        $page = Injector::inst()->get(Page::class);
22
        /** @var PageController $controller */
23
        $controller = Injector::inst()->createWithArgs(PageController::class, [$page]);
24
25
        /** @var SolrSearchForm $form */
26
        $form = SolrSearchForm::create(
27
            $controller,
28
            'TestForm',
29
            FieldList::create(),
30
            FieldList::create()
31
        );
32
33
        $this->assertInstanceOf(NullSecurityToken::class, $form->getSecurityToken());
34
35
        $this->assertEquals('GET', $form->FormMethod());
36
    }
37
}