Completed
Push — master ( dd845a...c89ab0 )
by Jason
12s
created

tests/LocationCategoryTest.php (7 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Dynamic\Locator\Tests;
4
5
use Dynamic\Locator\LocationCategory;
6
use Dynamic\SilverStripeGeocoder\GoogleGeocoder;
7
use SilverStripe\Core\Config\Config;
8
use SilverStripe\Dev\SapphireTest;
9
use SilverStripe\Forms\FieldList;
10
use SilverStripe\Security\Member;
11
12
/**
13
 * Class LocationTest
14
 */
15
class LocationCategoryTest extends SapphireTest
16
{
17
    /**
18
     * @var string
19
     */
20
    protected static $fixture_file = 'locator/tests/fixtures.yml';
21
22
    /**
23
     *
24
     */
25
    public function testGetCMSFields()
26
    {
27
        $object = $this->objFromFixture(LocationCategory::class, 'service');
28
        $fieldset = $object->getCMSFields();
29
        $this->assertInstanceOf(FieldList::class, $fieldset);
30
    }
31
32
    /**
33
     *
34
     */
35
    public function testCanView()
36
    {
37
        $object = $this->objFromFixture(LocationCategory::class, 'service');
38
        $this->assertTrue($object->canView());
0 ignored issues
show
The method assertTrue() does not seem to exist on object<Dynamic\Locator\T...s\LocationCategoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
    }
40
41
    /**
42
     *
43
     */
44 View Code Duplication
    public function testCanEdit()
45
    {
46
        $object = $this->objFromFixture(LocationCategory::class, 'service');
47
48
        $admin = $this->objFromFixture(Member::class, 'locationedit');
49
        $this->assertTrue($object->canEdit($admin));
0 ignored issues
show
The method assertTrue() does not seem to exist on object<Dynamic\Locator\T...s\LocationCategoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
51
        $member = $this->objFromFixture(Member::class, 'default');
52
        $this->assertFalse($object->canEdit($member));
0 ignored issues
show
The method assertFalse() does not seem to exist on object<Dynamic\Locator\T...s\LocationCategoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
    }
54
55
    /**
56
     *
57
     */
58 View Code Duplication
    public function testCanDelete()
59
    {
60
        $object = $this->objFromFixture(LocationCategory::class, 'service');
61
62
        $admin = $this->objFromFixture(Member::class, 'locationdelete');
63
        $this->assertTrue($object->canDelete($admin));
0 ignored issues
show
The method assertTrue() does not seem to exist on object<Dynamic\Locator\T...s\LocationCategoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
64
65
        $member = $this->objFromFixture(Member::class, 'default');
66
        $this->assertFalse($object->canDelete($member));
0 ignored issues
show
The method assertFalse() does not seem to exist on object<Dynamic\Locator\T...s\LocationCategoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
67
    }
68
69
    /**
70
     *
71
     */
72 View Code Duplication
    public function testCanCreate()
73
    {
74
        $object = $this->objFromFixture(LocationCategory::class, 'service');
75
76
        $admin = $this->objFromFixture(Member::class, 'locationcreate');
77
        $this->assertTrue($object->canCreate($admin));
0 ignored issues
show
The method assertTrue() does not seem to exist on object<Dynamic\Locator\T...s\LocationCategoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
78
79
        $member = $this->objFromFixture(Member::class, 'default');
80
        $this->assertFalse($object->canCreate($member));
0 ignored issues
show
The method assertFalse() does not seem to exist on object<Dynamic\Locator\T...s\LocationCategoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
81
    }
82
}
83