Completed
Pull Request — 3.x (#587)
by Sullivan
08:36
created

FormContractorTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testGetFormBuilder() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrineORMAdminBundle\Tests\Builder;
13
14
use Sonata\DoctrineORMAdminBundle\Builder\FormContractor;
15
use Symfony\Component\Form\FormFactoryInterface;
16
17
/**
18
 * @author Sullivan Senechal <[email protected]>
19
 */
20
final class FormContractorTest extends \PHPUnit_Framework_TestCase
21
{
22
    /**
23
     * @var FormFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
24
     */
25
    private $formFactory;
26
27
    /**
28
     * @var FormContractor
29
     */
30
    private $formContractor;
31
32
    protected function setUp()
33
    {
34
        $this->formFactory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
35
36
        $this->formContractor = new FormContractor($this->formFactory);
37
    }
38
39
    public function testGetFormBuilder()
40
    {
41
        $this->formFactory->expects($this->once())->method('createNamedBuilder')
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Symfony\Component...m\FormFactoryInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
            ->willReturn($this->getMock('Symfony\Component\Form\FormBuilderInterface'));
43
44
        $this->assertInstanceOf(
45
            'Symfony\Component\Form\FormBuilderInterface',
46
            $this->formContractor->getFormBuilder('test', array('foo' => 'bar'))
47
        );
48
    }
49
}
50