Passed
Push — master ( 6bfa44...e0849e )
by Siwapun
06:09
created

ComposeTest::testComposeMultipleMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Aerophant\RamdaTest;
3
4
use function Aerophant\Ramda\always;
5
use function Aerophant\Ramda\compose;
6
use PHPUnit\Framework\TestCase;
7
8
class ComposeTest extends TestCase
9
{
10
11
  /**
12
   * @throws \Exception
13
   */
14
  public function testComposeSingleMethod()
15
  {
16
    $composed = compose(
17
      always(10)
18
    );
19
    $this->assertEquals(10, $composed());
20
  }
21
22
  /**
23
   * @throws \Exception
24
   */
25
  public function testComposeMultipleMethods()
26
  {
27
    $composed = compose(
28
      function ($i) {
29
        return $i * 10;
30
      },
31
      function ($a, $b) {
32
        return $a + $b;
33
      }
34
    );
35
    $this->assertEquals(30, $composed(1, 2));
36
  }
37
}
38