Skip to content
This repository was archived by the owner on Nov 5, 2022. It is now read-only.

Commit 1ebedbe

Browse files
committed
Boolean and unit tests
1 parent c125cc0 commit 1ebedbe

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
if ($a AND $b === $c) {} // Fail
4+
if ($a === $b AND $c) {} // Fail
5+
if ($a === $b AND $a === $c) {} // Fail
6+
if ($a === $b && $a === $c) {} // Fail
7+
if ($a === 1 and $a === 2 AND $a === 3) {} // Fail 2 errors
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
if ($a && $b === $c) {} // Fail
4+
if ($a === $b && $c) {} // Fail
5+
if ($a === $b && $a === $c) {} // Fail
6+
if ($a === $b && $a === $c) {} // Fail
7+
if ($a === 1 && $a === 2 && $a === 3) {} // Fail 2 errors
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* Boolean And Unit Test
4+
*
5+
* @package CodeIgniter4-Standard
6+
* @author Louis Linehan <[email protected]>
7+
* @copyright 2017 Louis Linehan
8+
* @license https://github.com/louisl/CodeIgniter4-Standard/blob/master/LICENSE MIT License
9+
*/
10+
11+
namespace CodeIgniter4\Tests\Operators;
12+
13+
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
14+
15+
class BooleanAndUnitTest extends AbstractSniffUnitTest
16+
{
17+
18+
19+
/**
20+
* Returns the lines where errors should occur.
21+
*
22+
* The key of the array should represent the line number and the value
23+
* should represent the number of errors that should occur on that line.
24+
*
25+
* @return array<int, int>
26+
*/
27+
public function getErrorList()
28+
{
29+
return array(
30+
3 => 1,
31+
4 => 1,
32+
5 => 1,
33+
7 => 2,
34+
);
35+
36+
}//end getErrorList()
37+
38+
39+
/**
40+
* Returns the lines where warnings should occur.
41+
*
42+
* The key of the array should represent the line number and the value
43+
* should represent the number of warnings that should occur on that line.
44+
*
45+
* @return array<int, int>
46+
*/
47+
public function getWarningList()
48+
{
49+
return array();
50+
51+
}//end getWarningList()
52+
53+
54+
}//end class

0 commit comments

Comments
 (0)