Completed
Push — master ( dd845a...c89ab0 )
by Jason
12s
created

tests/LocatorFormTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Dynamic\Locator\Tests;
4
5
use Dynamic\Locator\Locator;
6
use Dynamic\Locator\LocatorController;
7
use Dynamic\Locator\LocatorForm;
8
use SilverStripe\Dev\FunctionalTest;
9
use SilverStripe\Forms\FieldList;
10
use SilverStripe\Forms\RequiredFields;
11
12
class LocatorFormTest extends FunctionalTest
13
{
14
    /**
15
     * @var string
16
     */
17
    protected static $fixture_file = 'locator/tests/fixtures.yml';
18
19
    /**
20
     *
21
     */
22
    public function testLocatorFormBase()
23
    {
24
        $form = LocatorForm::create(LocatorController::create(Locator::get()->first()), 'LocatorForm');
25
26
        $this->assertInstanceOf(FieldList::class, $form->Fields());
27
        $this->assertInstanceOf(RequiredFields::class, $form->getValidator());
28
    }
29
30
    /**
31
     *
32
     */
33
    public function testUpdateRequiredFields()
34
    {
35
        $form = LocatorForm::create(LocatorController::create(Locator::get()->first()), 'LocatorForm');
36
        $validator = $form->getValidator();
37
38
        $validator->removeRequiredField('Address');
39
        $validator->addRequiredField('Foo');
40
41
        $this->assertEquals(['Foo'], $form->getValidator()->getRequired());
0 ignored issues
show
The method assertEquals() does not seem to exist on object<Dynamic\Locator\Tests\LocatorFormTest>.

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...
42
    }
43
44
}