1 | <?php |
||
2 | namespace Aerophant\RamdaTest; |
||
3 | |||
4 | use function Aerophant\Ramda\all; |
||
5 | use PHPUnit\Framework\TestCase; |
||
6 | |||
7 | class AllTest extends TestCase |
||
8 | { |
||
9 | public function testAllAndExpectTrue() |
||
10 | { |
||
11 | $lessThan10 = function ($it) { |
||
12 | return $it < 10; |
||
13 | }; |
||
14 | $this->assertTrue(all($lessThan10)([1, 2, 3, 4])); |
||
15 | } |
||
16 | |||
17 | public function testAllAndExpectFalse() |
||
18 | { |
||
19 | $lessThan10 = function ($it) { |
||
20 | return $it < 10; |
||
21 | }; |
||
22 | $this->assertFalse(all($lessThan10)([1, 2, 3, 4, 20])); |
||
23 | } |
||
24 | |||
25 | public function testAllWithEmptyArray() |
||
26 | { |
||
27 | $predicate = function ($it) { |
||
0 ignored issues
–
show
|
|||
28 | return true; |
||
29 | }; |
||
30 | $this->assertFalse(all($predicate)([])); |
||
31 | } |
||
32 | } |
||
33 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.