|
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 testLocations() |
|
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 testGetAllCategories() |
|
20
|
|
|
{ |
|
21
|
|
|
$locator = singleton('Locator'); |
|
22
|
|
|
$count = LocationCategory::get(); |
|
23
|
|
|
$this->assertEquals($locator->getAllCategories(), $count); |
|
|
|
|
|
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function testGetPageCategories() |
|
27
|
|
|
{ |
|
28
|
|
|
$locator = Locator::create(); |
|
29
|
|
|
$this->assertFalse($locator->getPageCategories()); |
|
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
$this->assertFalse($locator->getPageCategories(500)); |
|
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
$locator->write(); |
|
34
|
|
|
$category = $this->objFromFixture('LocationCategory', 'service'); |
|
35
|
|
|
$locator->Categories()->add($category); |
|
36
|
|
|
$this->assertEquals($locator->getPageCategories($locator->ID), $locator->Categories()); |
|
|
|
|
|
|
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')); |
|
|
|
|
|
|
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')); |
|
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
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.