@@ 12-23 (lines=12) @@ | ||
9 | /** |
|
10 | * @test |
|
11 | */ |
|
12 | public function shouldRunFunctionHasManyAriry() |
|
13 | { |
|
14 | $fn = pipe( |
|
15 | function ($x, $y) { return $x * $y; }, |
|
16 | function ($x) { return $x / 3; } |
|
17 | ); |
|
18 | ||
19 | $this->assertEquals($fn(10, 15), 50); |
|
20 | } |
|
21 | ||
22 | /** |
|
23 | * @tests |
|
24 | */ |
|
25 | public function shouldPipedResult() |
|
26 | { |
|
@@ 25-39 (lines=15) @@ | ||
22 | /** |
|
23 | * @tests |
|
24 | */ |
|
25 | public function shouldPipedResult() |
|
26 | { |
|
27 | $fn = pipe( |
|
28 | function ($x) { return "foo($x)"; }, |
|
29 | function ($x) { return "bar($x)"; }, |
|
30 | function ($x) { return "baz($x)"; } |
|
31 | ); |
|
32 | ||
33 | $this->assertSame($fn('x'), 'baz(bar(foo(x)))'); |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * @test |
|
38 | */ |
|
39 | public function whenRestParamsIsArray() |
|
40 | { |
|
41 | $c = ['foo' => 10]; |
|
42 | $p = function (int $x, array $c) { |