Completed
Push — master ( 74f423...06a480 )
by Siwapun
05:31 queued 03:49
created

RejectPreserveKeyTest::testWithIsOdd()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Aerophant\RamdaTest;
4
5
use function Aerophant\Ramda\reject;
6
use function Aerophant\Ramda\rejectPreserveKey;
7
use PHPUnit\Framework\TestCase;
8
9
class RejectPreserveKeyTest extends TestCase
10
{
11
  public function testWithIsOdd()
12
  {
13
    $isOdd = function ($item) {
14
      return $item % 2 == 1;
15
    };
16
17
    $array = [1, 2, 3, 4];
18
    $expect = [1 => 2, 3 => 4];
19
    $actual = rejectPreserveKey($isOdd)($array);
20
    $this->assertEquals($expect, $actual);
21
  }
22
}
23