| Conditions | 1 |
| Paths | 1 |
| Total Lines | 33 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function testBooleanValues(): void |
||
| 15 | { |
||
| 16 | $db = $this->getConnection(); |
||
| 17 | $command = $db->createCommand(); |
||
| 18 | |||
| 19 | $command->batchInsert( |
||
| 20 | 'bool_values', |
||
| 21 | ['bool_col'], |
||
| 22 | [ |
||
| 23 | [true], |
||
| 24 | [false], |
||
| 25 | ] |
||
| 26 | )->execute(); |
||
| 27 | |||
| 28 | $this->assertEquals(1, (new Query($db))->from('bool_values')->where('bool_col = TRUE')->count('*', $db)); |
||
|
|
|||
| 29 | $this->assertEquals(1, (new Query($db))->from('bool_values')->where('bool_col = FALSE')->count('*', $db)); |
||
| 30 | $this->assertEquals( |
||
| 31 | 2, |
||
| 32 | (new Query($db))->from('bool_values')->where('bool_col IN (TRUE, FALSE)')->count('*', $db) |
||
| 33 | ); |
||
| 34 | $this->assertEquals(1, (new Query($db))->from('bool_values')->where(['bool_col' => true])->count('*', $db)); |
||
| 35 | $this->assertEquals(1, (new Query($db))->from('bool_values')->where(['bool_col' => false])->count('*', $db)); |
||
| 36 | $this->assertEquals( |
||
| 37 | 2, |
||
| 38 | (new Query($db))->from('bool_values')->where(['bool_col' => [true, false]])->count('*', $db) |
||
| 39 | ); |
||
| 40 | $this->assertEquals( |
||
| 41 | 1, |
||
| 42 | (new Query($db))->from('bool_values')->where('bool_col = :bool_col', ['bool_col' => true])->count('*', $db) |
||
| 43 | ); |
||
| 44 | $this->assertEquals( |
||
| 45 | 1, |
||
| 46 | (new Query($db))->from('bool_values')->where('bool_col = :bool_col', ['bool_col' => false])->count('*', $db) |
||
| 47 | ); |
||
| 50 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.