Issues (11)

test/AnyTest.php (1 issue)

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
The parameter $it is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

28
    $predicate = function (/** @scrutinizer ignore-unused */ $it) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
      return true;
30
    };
31
    $this->assertFalse(any($predicate)([]));
32
  }
33
}
34