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

PipeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testPipeMultipleMethods() 0 11 1
A testPipeSingleMethod() 0 6 1
1
<?php
2
namespace Aerophant\RamdaTest;
3
4
use function Aerophant\Ramda\always;
5
use function Aerophant\Ramda\pipe;
6
use PHPUnit\Framework\TestCase;
7
8
class PipeTest extends TestCase
9
{
10
11
  /**
12
   * @throws \Exception
13
   */
14
  public function testPipeSingleMethod()
15
  {
16
    $piped = pipe(
17
      always(10)
18
    );
19
    $this->assertEquals(10, $piped());
20
  }
21
22
  /**
23
   * @throws \Exception
24
   */
25
  public function testPipeMultipleMethods()
26
  {
27
    $piped = pipe(
28
      function ($a, $b) {
29
        return $a + $b;
30
      },
31
      function ($i) {
32
        return $i * 10;
33
      }
34
    );
35
    $this->assertEquals(30, $piped(1, 2));
36
  }
37
}
38