DataObjectExtensionTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
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 20
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
use Firesphere\SolrPermissions\Extensions\DataObjectExtension;
7
use SilverStripe\Dev\SapphireTest;
8
9
class DataObjectExtensionTest extends SapphireTest
10
{
11
    public function testGetMemberView()
12
    {
13
        $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...
14
        $extension = new DataObjectExtension();
15
        $extension->setOwner($page);
16
17
        $viewStatus = $extension->getMemberView();
18
19
        $this->assertEquals(['null'], $viewStatus);
20
21
        $page->CanViewType = 'LoggedInUsers';
22
        $page->write();
23
24
        $extension->setOwner($page);
25
26
        $status = $extension->getMemberView();
27
28
        $this->assertNotContains('null', $status);
29
    }
30
}
31