diff --git a/tests/tad/FunctionMocker/FunctionReplacementInOrderTest.php b/tests/tad/FunctionMocker/FunctionReplacementInOrderTest.php index f55cfbe..b2ee07c 100644 --- a/tests/tad/FunctionMocker/FunctionReplacementInOrderTest.php +++ b/tests/tad/FunctionMocker/FunctionReplacementInOrderTest.php @@ -27,7 +27,7 @@ public function returnValues() * @test * @dataProvider returnValues */ - public function replace_function_should_be_retunr_values_in_order( $values ) { + public function replace_function_should_be_return_values_in_order(array $values) { $f = 'Some\Name\Space\func' . uniqid(rand(1, 9999)); $spy = FunctionMocker::replaceInOrder( $f, $values ); @@ -38,4 +38,17 @@ public function replace_function_should_be_retunr_values_in_order( $values ) { $spy->wasCalledTimes(count($values)); } + /** + * Test replace static methods should replace values in order + * @dataProvider returnValues + */ + public function test_replace_static_methods_should_replace_values_in_order(array $values) { + $f = 'tad\FunctionMocker\Tests\AClass::staticMethod'; + $spy = FunctionMocker::replaceInOrder( $f, $values ); + + foreach ( $values as $value ) { + $this->assertEquals( $value, $f() ); + } + $spy->wasCalledTimes(count($values)); + } } diff --git a/tests/tad/FunctionMocker/FunctionReplacementTest.php b/tests/tad/FunctionMocker/FunctionReplacementTest.php index 09e9ed3..4f8f45e 100644 --- a/tests/tad/FunctionMocker/FunctionReplacementTest.php +++ b/tests/tad/FunctionMocker/FunctionReplacementTest.php @@ -158,4 +158,19 @@ public function allow_replacing_a_non_defined_namespaced_function() $this->assertEquals(2324, $f()); $spy->wasCalledOnce(); } + + /** + * It should allow replacing a function result w/ an array + * + * @test + */ + public function should_allow_replacing_a_function_result_w_an_array() { + $f = 'Some\Name\Space\func' . uniqid(rand(1, 9999)); + + $spy = FunctionMocker::replace($f, [23,89,2389]); + + $this->assertTrue(function_exists($f)); + $this->assertEquals([23,89,2389], $f()); + $spy->wasCalledOnce(); + } }