@@ -6,108 +6,108 @@ |
||
6 | 6 | class LocatorTest extends Locator_Test |
7 | 7 | { |
8 | 8 | |
9 | - /** |
|
10 | - * |
|
11 | - */ |
|
12 | - public function testGetCMSFields() |
|
13 | - { |
|
14 | - $locator = singleton('Locator'); |
|
15 | - $this->assertInstanceOf('FieldList', $locator->getCMSFields()); |
|
16 | - } |
|
17 | - |
|
18 | - /** |
|
19 | - * |
|
20 | - */ |
|
21 | - public function testLocations() |
|
22 | - { |
|
23 | - $filter = Config::inst()->get('Locator_Controller', 'base_filter'); |
|
24 | - $filterAny = Config::inst()->get('Locator_Controller', 'base_filter_any'); |
|
25 | - $exclude = Config::inst()->get('Locator_Controller', 'base_exclude'); |
|
26 | - $locations = Locator::get_locations($filter, $filterAny, $exclude); |
|
27 | - $locations2 = Location::get()->filter($filter)->filterAny($filterAny)->exclude($exclude); |
|
28 | - $this->assertEquals($locations->count(), $locations2->count()); |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * |
|
33 | - */ |
|
34 | - public function testGetAllCategories() |
|
35 | - { |
|
36 | - |
|
37 | - $this->assertEquals(Locator::get_all_categories()->count(), 4); |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * |
|
42 | - */ |
|
43 | - public function testGetPageCategories() |
|
44 | - { |
|
45 | - $locator = $this->objFromFixture('Locator', 'locator1'); |
|
46 | - $this->assertEquals($locator->getPageCategories()->count(), 2); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * |
|
51 | - */ |
|
52 | - public function testLocatorCategoriesByLocator() |
|
53 | - { |
|
54 | - |
|
55 | - $locator = $this->objFromFixture('Locator', 'locator1'); |
|
56 | - $this->assertEquals(Locator::locator_categories_by_locator($locator->ID)->count(), 2); |
|
57 | - |
|
58 | - $newLocator = Locator::create(); |
|
59 | - $newLocator->Title = 'Locator 2'; |
|
60 | - $newLocator->write(); |
|
61 | - |
|
62 | - $this->assertEquals(Locator::locator_categories_by_locator($newLocator->ID)->count(), 0); |
|
63 | - |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * |
|
68 | - */ |
|
69 | - public function testInit() |
|
70 | - { |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * |
|
75 | - */ |
|
76 | - public function testIndex() |
|
77 | - { |
|
78 | - $locator = $this->objFromFixture('Locator', 'locator1'); |
|
79 | - $controller = Locator_Controller::create($locator); |
|
80 | - $this->assertInstanceOf('ViewableData', $controller->index($controller->request)); |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * |
|
85 | - */ |
|
86 | - public function testXml() |
|
87 | - { |
|
88 | - $locator = $this->objFromFixture('Locator', 'locator1'); |
|
89 | - $controller = Locator_Controller::create($locator); |
|
90 | - $this->assertInstanceOf('HTMLText', $controller->xml($controller->request)); |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * |
|
95 | - */ |
|
96 | - public function testLocationSearch() |
|
97 | - { |
|
98 | - $locator = $this->objFromFixture('Locator', 'locator1'); |
|
99 | - $object = Locator_Controller::create($locator); |
|
100 | - $form = $object->LocationSearch(); |
|
101 | - $this->assertTrue(is_a($form, 'Form')); |
|
102 | - |
|
103 | - $category = $this->objFromFixture('LocationCategory', 'service'); |
|
104 | - $category2 = $this->objFromFixture('LocationCategory', 'manufacturing'); |
|
105 | - $locator->Categories()->add($category); |
|
106 | - $locator->Categories()->add($category2); |
|
107 | - |
|
108 | - $form = $object->LocationSearch(); |
|
109 | - $fields = $form->Fields(); |
|
110 | - $this->assertNotNull($fields->fieldByName('CategoryID')); |
|
111 | - } |
|
9 | + /** |
|
10 | + * |
|
11 | + */ |
|
12 | + public function testGetCMSFields() |
|
13 | + { |
|
14 | + $locator = singleton('Locator'); |
|
15 | + $this->assertInstanceOf('FieldList', $locator->getCMSFields()); |
|
16 | + } |
|
17 | + |
|
18 | + /** |
|
19 | + * |
|
20 | + */ |
|
21 | + public function testLocations() |
|
22 | + { |
|
23 | + $filter = Config::inst()->get('Locator_Controller', 'base_filter'); |
|
24 | + $filterAny = Config::inst()->get('Locator_Controller', 'base_filter_any'); |
|
25 | + $exclude = Config::inst()->get('Locator_Controller', 'base_exclude'); |
|
26 | + $locations = Locator::get_locations($filter, $filterAny, $exclude); |
|
27 | + $locations2 = Location::get()->filter($filter)->filterAny($filterAny)->exclude($exclude); |
|
28 | + $this->assertEquals($locations->count(), $locations2->count()); |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * |
|
33 | + */ |
|
34 | + public function testGetAllCategories() |
|
35 | + { |
|
36 | + |
|
37 | + $this->assertEquals(Locator::get_all_categories()->count(), 4); |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * |
|
42 | + */ |
|
43 | + public function testGetPageCategories() |
|
44 | + { |
|
45 | + $locator = $this->objFromFixture('Locator', 'locator1'); |
|
46 | + $this->assertEquals($locator->getPageCategories()->count(), 2); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * |
|
51 | + */ |
|
52 | + public function testLocatorCategoriesByLocator() |
|
53 | + { |
|
54 | + |
|
55 | + $locator = $this->objFromFixture('Locator', 'locator1'); |
|
56 | + $this->assertEquals(Locator::locator_categories_by_locator($locator->ID)->count(), 2); |
|
57 | + |
|
58 | + $newLocator = Locator::create(); |
|
59 | + $newLocator->Title = 'Locator 2'; |
|
60 | + $newLocator->write(); |
|
61 | + |
|
62 | + $this->assertEquals(Locator::locator_categories_by_locator($newLocator->ID)->count(), 0); |
|
63 | + |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * |
|
68 | + */ |
|
69 | + public function testInit() |
|
70 | + { |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * |
|
75 | + */ |
|
76 | + public function testIndex() |
|
77 | + { |
|
78 | + $locator = $this->objFromFixture('Locator', 'locator1'); |
|
79 | + $controller = Locator_Controller::create($locator); |
|
80 | + $this->assertInstanceOf('ViewableData', $controller->index($controller->request)); |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * |
|
85 | + */ |
|
86 | + public function testXml() |
|
87 | + { |
|
88 | + $locator = $this->objFromFixture('Locator', 'locator1'); |
|
89 | + $controller = Locator_Controller::create($locator); |
|
90 | + $this->assertInstanceOf('HTMLText', $controller->xml($controller->request)); |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * |
|
95 | + */ |
|
96 | + public function testLocationSearch() |
|
97 | + { |
|
98 | + $locator = $this->objFromFixture('Locator', 'locator1'); |
|
99 | + $object = Locator_Controller::create($locator); |
|
100 | + $form = $object->LocationSearch(); |
|
101 | + $this->assertTrue(is_a($form, 'Form')); |
|
102 | + |
|
103 | + $category = $this->objFromFixture('LocationCategory', 'service'); |
|
104 | + $category2 = $this->objFromFixture('LocationCategory', 'manufacturing'); |
|
105 | + $locator->Categories()->add($category); |
|
106 | + $locator->Categories()->add($category2); |
|
107 | + |
|
108 | + $form = $object->LocationSearch(); |
|
109 | + $fields = $form->Fields(); |
|
110 | + $this->assertNotNull($fields->fieldByName('CategoryID')); |
|
111 | + } |
|
112 | 112 | |
113 | 113 | } |