Completed
Pull Request — master (#2)
by Siwapun
13:33
created

CurryNTest::testCurryNWithAutoCurry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Aerophant\RamdaTest;
3
4
use function Aerophant\Ramda\curryN;
5
use PHPUnit\Framework\TestCase;
6
7
class CurryNTest extends TestCase
8
{
9
10
  public function testCurryNWithInvokeFunctionDirectly()
11
  {
12
    $curriedReduce = curryN('array_reduce', 3);
13
    $add = function ($a, $b) {
14
      return $a + $b;
15
    };
16
    $result = $curriedReduce([4,5,6], $add, 0);
17
    $this->assertEquals(15, $result);
18
  }
19
20
  public function testCurryNWithAutoCurry()
21
  {
22
    $curriedReduce = curryN('array_reduce', 3);
23
    $add = function ($a, $b) {
24
      return $a + $b;
25
    };
26
    $result = $curriedReduce([4,5,6])($add)(0);
27
    $this->assertEquals(15, $result);
28
  }
29
}
30