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