Completed
Push — master ( c5c436...b453a3 )
by Ruud
15:58
created

TextPagePartAdminTypeTest::testConfigureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Kunstmaan\PagePartBundle\Tests\Form;
4
5
use Kunstmaan\PagePartBundle\Form\TextPagePartAdminType;
6
use Kunstmaan\PagePartBundle\Tests\unit\Form\PagePartAdminTypeTestCase;
7
use Symfony\Component\Form\FormBuilderInterface;
8
9
/**
10
 * Class TextPagePartAdminTypeTest
11
 */
12 View Code Duplication
class TextPagePartAdminTypeTest extends PagePartAdminTypeTestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * @var TextPagePartAdminType
16
     */
17
    protected $object;
18
19
    protected function setUp()
20
    {
21
        parent::setUp();
22
        $this->object = new TextPagePartAdminType();
23
    }
24
25
    public function testBuildForm()
26
    {
27
        $builder = $this->createMock(FormBuilderInterface::class);
28
        $builder->expects($this->once())->method('add');
29
30
        $this->object->buildForm($builder, array());
0 ignored issues
show
Documentation introduced by
$builder is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Symfony\Component...m\FormBuilderInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
31
    }
32
33
    public function testConfigureOptions()
34
    {
35
        $this->object->configureOptions($this->resolver);
36
        $resolve = $this->resolver->resolve();
37
        $this->assertEquals($resolve['data_class'], 'Kunstmaan\PagePartBundle\Entity\TextPagePart');
38
    }
39
}
40