From: widmogrod Date: Wed, 20 Dec 2017 17:52:05 +0000 (+0100) Subject: Functional\valueOf tests X-Git-Tag: 4.0.0~3^2~29 X-Git-Url: http://cameron1729.xyz/?a=commitdiff_plain;h=d1a9570c753e675a5b279cb458413e0e9ce095fa;p=php-functional.git Functional\valueOf tests --- diff --git a/test/Functional/ValueOfTest.php b/test/Functional/ValueOfTest.php new file mode 100644 index 0000000..8b09f10 --- /dev/null +++ b/test/Functional/ValueOfTest.php @@ -0,0 +1,59 @@ +assertSame( + $expected, + valueOf($value) + ); + } + + public function provideData() + { + return [ + 'Native int should be return as is' => [ + '$value' => 1023, + '$expected' => 1023, + ], + 'Native string should be return as is' => [ + '$value' => 'Something amazing', + '$expected' => 'Something amazing', + ], + 'Native array should be return as is' => [ + '$value' => [1, 2, 3], + '$expected' => [1, 2, 3], + ], + 'Identity 6' => [ + '$value' => Identity::of(6), + '$expected' => 6 + ], + 'Just 6' => [ + '$value' => just(6), + '$expected' => 6 + ], + 'Nothing' => [ + '$value' => nothing(), + '$expected' => null + ], + 'Listt' => [ + '$value' => fromIterable([1, 2, 3]), + '$expected' => [1, 2, 3] + ], + ]; + } +}