Completed
Push — master ( 5c8995...29ed75 )
by Jason
28s
created

LocatorTest::testGetPageCategories()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 8
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 testGetLocations()
13
    {
14
        $locator = singleton('Locator');
15
        $count = Location::get()->filter('ShowInLocator', 1)->exclude('Lat', 0)->Count();
16
        $this->assertEquals($locator->getLocations()->Count(), $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 testGetAreLocations()
20
    {
21
        $locator = singleton('Locator');
22
        $this->assertEquals($locator->getLocations(), $locator->getAreLocations());
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...
23
    }
24
25
    public function testGetAllCategories()
26
    {
27
        $locator = singleton('Locator');
28
        $count = LocationCategory::get();
29
        $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...
30
    }
31
32
    public function testGetPageCategories()
33
    {
34
        $locator = Locator::create();
35
        $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...
36
37
        $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...
38
39
        $locator->write();
40
        $category = $this->objFromFixture('LocationCategory', 'service');
41
        $locator->Categories()->add($category);
42
        $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...
43
    }
44
45
    public function testInit()
46
    {
47
    }
48
49
    public function testXml()
50
    {
51
    }
52
53
    public function testLocationSearch()
54
    {
55
        $locator = $this->objFromFixture('Locator', 'locator1');
56
        $object = Locator_Controller::create($locator);
57
        $form = $object->LocationSearch();
58
        $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...
59
        
60
        $category = $this->objFromFixture('LocationCategory', 'service');
61
        $category2 = $this->objFromFixture('LocationCategory', 'manufacturing');
62
        $locator->Categories()->add($category);
63
        $locator->Categories()->add($category2);
64
65
        $form = $object->LocationSearch();
66
        $fields = $form->Fields();
67
        $this->assertNotNull($fields->fieldByName('category'));
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...
68
        
69
    }
70
}
71