Issues (11)

test/AllTest.php (1 issue)

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
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

27
    $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...
28
      return true;
29
    };
30
    $this->assertFalse(all($predicate)([]));
31
  }
32
}
33