From 80430a6bcc382da9d2ed5cb66ddbee8205389882 Mon Sep 17 00:00:00 2001 From: widmogrod Date: Wed, 20 Dec 2017 18:58:48 +0100 Subject: [PATCH] Functional\applicator tests --- test/Functional/ApplicatorTest.php | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/Functional/ApplicatorTest.php diff --git a/test/Functional/ApplicatorTest.php b/test/Functional/ApplicatorTest.php new file mode 100644 index 0000000..e54249d --- /dev/null +++ b/test/Functional/ApplicatorTest.php @@ -0,0 +1,46 @@ +assertSame( + $expected, + applicator($value, $fn) + ); + } + + /** + * @expectedException \ArgumentCountError + * @expectedExceptionMessage Too few arguments to function + */ + public function test_it_should_fail_when_function_requires_more_argumetns() + { + applicator(1, function (int $i, string $a): int { + return 10 + $i; + }); + } + + public function provideData() + { + return [ + 'Single value function' => [ + '$value' => 133, + '$fn' => function (int $i): int { + return 10 + $i; + }, + '$expected' => 143, + ], + ]; + } +} -- 2.11.0