Completed
Push — 3.x ( 86905e...ba2f7c )
by Grégoire
02:59
created

StringOperatorTypeTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testConfigureOptions() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\Form\Type\Operator;
15
16
use Sonata\AdminBundle\Form\Type\Operator\StringOperatorType;
17
use Symfony\Component\Form\Test\TypeTestCase;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
20
class StringOperatorTypeTest extends TypeTestCase
21
{
22
    public function testConfigureOptions()
23
    {
24
        $formType = new StringOperatorType();
25
        $optionsResolver = new OptionsResolver();
26
        $expected_choices = [
27
            'label_type_contains' => StringOperatorType::TYPE_CONTAINS,
28
            'label_type_not_contains' => StringOperatorType::TYPE_NOT_CONTAINS,
29
            'label_type_equals' => StringOperatorType::TYPE_EQUAL,
30
            'label_type_starts_with' => StringOperatorType::TYPE_STARTS_WITH,
31
            'label_type_ends_with' => StringOperatorType::TYPE_ENDS_WITH,
32
        ];
33
        $formType->configureOptions($optionsResolver);
34
        $options = $optionsResolver->resolve([]);
35
        $this->assertSame($expected_choices, $options['choices']);
36
        $this->assertSame('SonataAdminBundle', $options['choice_translation_domain']);
37
    }
38
}
39