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

MultiSelectTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
eloc 7
c 1
b 0
f 1
dl 0
loc 13
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_getValue() 0 10 1
1
<?php
2
3
namespace Nip\Form\Tests\Elements;
4
5
use Nip\Form\Tests\AbstractTest;
6
7
/**
8
 * Class MultiElementTest
9
 * @package Nip\Form\Tests\Elements
10
 */
11
class MultiSelectTest extends AbstractTest
12
{
13
14
    public function test_getValue()
15
    {
16
        $form = new \Nip\Form\Form();
17
        $input = new \Nip_Form_Element_MultiSelect($form);
18
        $input->addOption('1', 'opt1');
19
        $input->addOption('2', 'opt2');
20
21
        $input->getDataFromRequest(['1', '2', '3']);
22
23
        self::assertSame(['1', '2'], $input->getValue());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $input->getValue() targeting Nip\Form\Elements\AbstractElement::getValue() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
24
    }
25
}
26