Passed
Push — master ( ab2dc9...db3995 )
by Gabriel
14:15 queued 10s
created

data_magic_methods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nip\Form\Tests\Traits;
4
5
use Nip\Form\Form;
6
use Nip\Form\Tests\AbstractTest;
7
8
/**
9
 * Class MagicMethodElementsFormTraitTest
10
 * @package Nip\Form\Tests\Traits
11
 */
12
class MagicMethodElementsFormTraitTest extends AbstractTest
13
{
14
15
    /**
16
     * @dataProvider data_magic_methods
17
     */
18
    public function test_magic_methods($element, $class)
19
    {
20
        $method = 'add' . $element;
21
        $form = new Form();
22
        $form->$method('test_input');
23
24
        self::assertInstanceOf($class, $form->test_input);
0 ignored issues
show
Bug Best Practice introduced by
The property test_input does not exist on Nip\Form\Form. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
        self::assertInstanceOf($class, $form->getElement('test_input'));
26
    }
27
28
    /**
29
     * @return \string[][]
30
     */
31
    public function data_magic_methods()
32
    {
33
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(array('Sele...nt_MultiSelect::class)) returns the type array<integer,array<integer,string>> which is incompatible with the documented return type array<mixed,string[]>.
Loading history...
34
            ['Select', \Nip_Form_Element_Select::class],
35
            ['MultiSelect', \Nip_Form_Element_MultiSelect::class]
36
        ];
37
    }
38
}