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

LocatorTest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 9
c 5
b 0
f 1
lcom 0
cbo 5
dl 0
loc 71
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetCMSFields() 0 6 1
A testLocations() 0 6 1
A testGetAllCategories() 0 6 1
A testGetPageCategories() 0 12 1
A testInit() 0 3 1
A testIndex() 0 4 1
A testXml() 0 3 1
A testItems() 0 4 1
A testLocationSearch() 0 16 1
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
        $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 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