Completed
Push — master ( 0b7415...f7faeb )
by Siwapun
04:16 queued 02:45
created

GroupByTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGroupByIsEven() 0 11 2
1
<?php
2
namespace Aerophant\RamdaTest;
3
4
use function Aerophant\Ramda\groupBy;
5
use PHPUnit\Framework\TestCase;
6
7
class GroupByTest extends TestCase
8
{
9
  public function testGroupByIsEven()
10
  {
11
    $evenOrOdd = function ($value) {
12
      return $value % 2 === 0 ? 'even' : 'odd';
13
    };
14
    $expected = [
15
      'even' => [2, 4, 6],
16
      'odd' => [1, 3, 5]
17
    ];
18
    $actual = groupBy($evenOrOdd)([1, 2, 3, 4, 5, 6]);
19
    $this->assertEquals($expected, $actual);
20
  }
21
}
22