|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Dynamic\Locator\Tests; |
|
4
|
|
|
|
|
5
|
|
|
use \DOMDocument; |
|
6
|
|
|
use Dynamic\Locator\LocationCategory; |
|
7
|
|
|
use Dynamic\Locator\Locator; |
|
8
|
|
|
use Dynamic\Locator\LocatorController; |
|
9
|
|
|
use SilverStripe\Dev\FunctionalTest; |
|
10
|
|
|
use SilverStripe\Forms\FieldList; |
|
11
|
|
|
use SilverStripe\Forms\Form; |
|
12
|
|
|
use SilverStripe\View\ViewableData; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class LocatorControllerTest |
|
16
|
|
|
* @package Dynamic\Locator\Tests |
|
17
|
|
|
*/ |
|
18
|
|
|
class LocatorControllerTest extends FunctionalTest |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
protected static $fixture_file = '../fixtures.yml'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var bool |
|
28
|
|
|
*/ |
|
29
|
|
|
protected static $use_draft_site = true; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* |
|
33
|
|
|
*/ |
|
34
|
|
|
public function testLocationSearch() |
|
35
|
|
|
{ |
|
36
|
|
|
$locator = $this->objFromFixture(Locator::class, 'locator1'); |
|
37
|
|
|
$object = LocatorController::create($locator); |
|
38
|
|
|
$form = $object->LocationSearch(); |
|
39
|
|
|
$this->assertInstanceOf(Form::class, $form); |
|
40
|
|
|
|
|
41
|
|
|
$category = $this->objFromFixture(LocationCategory::class, 'service'); |
|
42
|
|
|
$category2 = $this->objFromFixture(LocationCategory::class, 'manufacturing'); |
|
43
|
|
|
$locator->Categories()->add($category); |
|
44
|
|
|
$locator->Categories()->add($category2); |
|
45
|
|
|
|
|
46
|
|
|
$form = $object->LocationSearch(); |
|
47
|
|
|
$fields = $form->Fields(); |
|
48
|
|
|
$this->assertInstanceOf(FieldList::class, $fields); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
|