Test Setup Failed
Pull Request — master (#197)
by Gorrie
01:07
created

tests/Src/TestElementController.php (1 issue)

1
<?php
2
3
namespace DNADesign\Elemental\Tests\Src;
4
5
use DNADesign\Elemental\Controllers\ElementController;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\Forms\Form;
9
use SilverStripe\Forms\FormAction;
10
use SilverStripe\Forms\TextField;
11
12
class TestElementController extends ElementController implements TestOnly
13
{
14
    private static $url_segment = 'test-page';
15
16
    private static $allowed_actions = array(
17
        'Form'
18
    );
19
20
    public function Form()
21
    {
22
        $elementform = new Form(
23
            $this,
24
            'Form',
25
            new FieldList(
26
                new TextField('TestValue')
27
            ),
28
            new FieldList(
29
                new FormAction('doAction')
30
            )
31
        );
32
33
        return $elementform;
34
    }
35
36
    public function doAction($data, $form)
0 ignored issues
show
The parameter $form is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
    public function doAction($data, /** @scrutinizer ignore-unused */ $form)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
        return sprintf(
39
            'TestValue: %s\nElement ID: %d',
40
            $data['TestValue'],
41
            $this->element->ID
42
        );
43
    }
44
}
45