Completed
Push — master ( 1b4f53...76f910 )
by Siwapun
03:55
created

FindTest::testFindWithExistingValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Aerophant\RamdaTest;
3
4
use function Aerophant\Ramda\find;
5
use PHPUnit\Framework\TestCase;
6
7
class FindTest extends TestCase
8
{
9
  public function testFindWithExistingValue()
10
  {
11
    $isEqual3 = function ($it) {
12
      return 3 == $it;
13
    };
14
    $list = [1, 2, 3, 4, 5];
15
    $expect = 3;
16
    $actual = find($isEqual3)($list);
17
    $this->assertEquals($expect, $actual);
18
  }
19
20
  public function testFindWithNonExistingValue()
21
  {
22
    $isEqual11 = function ($it) {
23
      return 11 == $it;
24
    };
25
    $list = [1, 2, 3, 4, 5];
26
    $actual = find($isEqual11)($list);
27
    $this->assertNull($actual);
28
  }
29
}
30