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

MagicMethodElementsFormTraitTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 9
c 1
b 0
f 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_magic_methods() 0 8 1
A data_magic_methods() 0 5 1
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
}