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

RejectPreserveKeyTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testWithIsOdd() 0 10 1
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