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')); |
|
|
|
|
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); |
|
|
|
|
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function testGetAreLocations() |
20
|
|
|
{ |
21
|
|
|
$locator = singleton('Locator'); |
22
|
|
|
$this->assertEquals($locator->getLocations(), $locator->getAreLocations()); |
|
|
|
|
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function testGetAllCategories() |
26
|
|
|
{ |
27
|
|
|
$locator = singleton('Locator'); |
28
|
|
|
$count = LocationCategory::get(); |
29
|
|
|
$this->assertEquals($locator->getAllCategories(), $count); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testGetPageCategories() |
33
|
|
|
{ |
34
|
|
|
$locator = Locator::create(); |
35
|
|
|
$this->assertFalse($locator->getPageCategories()); |
|
|
|
|
36
|
|
|
|
37
|
|
|
$this->assertFalse($locator->getPageCategories(500)); |
|
|
|
|
38
|
|
|
|
39
|
|
|
$locator->write(); |
40
|
|
|
$category = $this->objFromFixture('LocationCategory', 'service'); |
41
|
|
|
$locator->Categories()->add($category); |
42
|
|
|
$this->assertEquals($locator->getPageCategories($locator->ID), $locator->Categories()); |
|
|
|
|
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')); |
|
|
|
|
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')); |
|
|
|
|
68
|
|
|
|
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
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.