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

DataObjectExtensionTest::testGetMemberView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
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 18
rs 9.9332
cc 1
nc 1
nop 0
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