These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\AdminListBundle\Tests\AdminList\FilterType\ORM; |
||
4 | |||
5 | use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\BooleanFilterType; |
||
6 | use Kunstmaan\AdminListBundle\Tests\unit\AdminList\FilterType\ORM\BaseOrmFilterTest; |
||
7 | use Kunstmaan\AdminListBundle\Tests\UnitTester; |
||
8 | use Symfony\Component\HttpFoundation\Request; |
||
9 | |||
10 | View Code Duplication | class BooleanFilterTypeTest extends BaseOrmFilterTest |
|
11 | { |
||
12 | /** |
||
13 | * @var UnitTester |
||
14 | */ |
||
15 | protected $tester; |
||
16 | |||
17 | /** |
||
18 | * @var BooleanFilterType |
||
19 | */ |
||
20 | protected $object; |
||
21 | |||
22 | protected function setUp() |
||
23 | { |
||
24 | $this->object = new BooleanFilterType('boolean', 'b'); |
||
25 | } |
||
26 | |||
27 | public function testBindRequest() |
||
28 | { |
||
29 | $request = new Request(array('filter_value_boolean' => 'true')); |
||
30 | |||
31 | $data = array(); |
||
32 | $uniqueId = 'boolean'; |
||
33 | $this->object->bindRequest($request, $data, $uniqueId); |
||
34 | |||
35 | $this->assertEquals(array('value' => 'true'), $data); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param mixed $value |
||
40 | * |
||
41 | * @dataProvider applyDataProvider |
||
42 | */ |
||
43 | public function testApply($value) |
||
44 | { |
||
45 | $qb = $this->getQueryBuilder(); |
||
46 | $qb->select('b') |
||
47 | ->from('Entity', 'b'); |
||
48 | $this->object->setQueryBuilder($qb); |
||
49 | $this->object->apply(array('value' => $value), 'boolean'); |
||
50 | |||
51 | $this->assertEquals("SELECT b FROM Entity b WHERE b.boolean = $value", $qb->getDQL()); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return array |
||
0 ignored issues
–
show
|
|||
56 | */ |
||
57 | public static function applyDataProvider() |
||
58 | { |
||
59 | return array( |
||
60 | array('true'), |
||
61 | array('false'), |
||
62 | ); |
||
63 | } |
||
64 | |||
65 | public function testGetTemplate() |
||
66 | { |
||
67 | $this->assertEquals('KunstmaanAdminListBundle:FilterType:booleanFilter.html.twig', $this->object->getTemplate()); |
||
68 | } |
||
69 | } |
||
70 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.