From c105ac1cf7cf46e7e89dbb45b0957d9b1fb79cc2 Mon Sep 17 00:00:00 2001 From: Payton Swick Date: Wed, 9 Aug 2017 13:41:48 -0400 Subject: [PATCH] Add more stub tests for falsey values --- tests/StubTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/StubTest.php b/tests/StubTest.php index e44e9f5..2746e74 100644 --- a/tests/StubTest.php +++ b/tests/StubTest.php @@ -29,6 +29,16 @@ public function test_stub_and_return_returns_the_value_when_the_stub_is_called() $this->assertEquals( 8, $stub() ); } + public function test_stub_and_return_returns_the_value_when_the_stub_is_called_even_if_the_value_is_empty() { + $stub = \Spies\mock_function( 'test_stub' )->and_return( '' ); + $this->assertEquals( '', $stub() ); + } + + public function test_stub_and_return_returns_the_value_when_the_stub_is_called_even_if_the_value_is_false() { + $stub = \Spies\mock_function( 'test_stub' )->and_return( false ); + $this->assertEquals( false, $stub() ); + } + public function test_stub_with_argument_and_return_returns_the_value_when_the_stub_is_called_even_if_the_return_value_is_empty() { $stub = \Spies\mock_function( 'test_stub' )->with( 5 )->and_return( [] ); $this->assertEquals( [], $stub( 5 ) );