Passed
Push — master ( 30ce24...41f662 )
by Simon
08:36
created

DataObjectExtensionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 11
c 1
b 0
f 0
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetMemberView() 0 18 1
1
<?php
2
3
4
namespace Firesphere\SolrPermissions\Tests;
5
6
7
use Firesphere\SolrPermissions\Extensions\DataObjectExtension;
8
use SilverStripe\Dev\SapphireTest;
9
10
class DataObjectExtensionTest extends SapphireTest
11
{
12
13
    public function testGetMemberView()
14
    {
15
        $page = \Page::get()->first();
0 ignored issues
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...
16
        $extension = new DataObjectExtension();
17
        $extension->setOwner($page);
18
19
        $viewStatus = $extension->getMemberView();
20
21
        $this->assertEquals(['null'], $viewStatus);
22
23
        $page->CanViewType('LoggedInUsers');
24
        $page->write();
25
26
        $extension->setOwner($page);
27
28
        $status = $extension->getMemberView();
29
30
        $this->assertNotContains('null', $status);
31
    }
32
}
33