Completed
Pull Request — master (#88)
by Jason
02:30
created

LocatorTest::testIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
class LocatorTest extends Locator_Test
4
{
5
    public function testGetCMSFields()
6
    {
7
        $object = new Locator();
8
        $fieldset = $object->getCMSFields();
9
        $this->assertTrue(is_a($fieldset, 'FieldList'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<LocatorTest>.

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...
10
    }
11
12
    public function testLocations()
13
    {
14
        $locations = Locator::locations();
15
        $locations2 = Location::get()->filter('ShowInLocator', 1);
16
        $this->assertEquals($locations->Count(), $locations2->Count());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<LocatorTest>.

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...
17
    }
18
19
    public function testGetAllCategories()
20
    {
21
        $locator = singleton('Locator');
22
        $count = LocationCategory::get();
23
        $this->assertEquals($locator->getAllCategories(), $count);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<LocatorTest>.

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...
24
    }
25
26
    public function testGetPageCategories()
27
    {
28
        $locator = Locator::create();
29
        $this->assertFalse($locator->getPageCategories());
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<LocatorTest>.

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...
30
31
        $this->assertFalse($locator->getPageCategories(500));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<LocatorTest>.

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...
32
33
        $locator->write();
34
        $category = $this->objFromFixture('LocationCategory', 'service');
35
        $locator->Categories()->add($category);
36
        $this->assertEquals($locator->getPageCategories($locator->ID), $locator->Categories());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<LocatorTest>.

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...
37
    }
38
39
    public function testInit()
40
    {
41
    }
42
43
    public function testIndex()
44
    {
45
46
    }
47
48
    public function testXml()
49
    {
50
    }
51
52
    public function testItems()
53
    {
54
55
    }
56
57
    public function testLocationSearch()
58
    {
59
        $locator = $this->objFromFixture('Locator', 'locator1');
60
        $object = Locator_Controller::create($locator);
61
        $form = $object->LocationSearch();
62
        $this->assertTrue(is_a($form, 'Form'));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<LocatorTest>.

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...
63
64
        $category = $this->objFromFixture('LocationCategory', 'service');
65
        $category2 = $this->objFromFixture('LocationCategory', 'manufacturing');
66
        $locator->Categories()->add($category);
67
        $locator->Categories()->add($category2);
68
69
        $form = $object->LocationSearch();
70
        $fields = $form->Fields();
71
        $this->assertNotNull($fields->fieldByName('CategoryID'));
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<LocatorTest>.

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...
72
    }
73
}
74