Skip to content

Commit

Permalink
Add more stub tests for falsey values
Browse files Browse the repository at this point in the history
  • Loading branch information
sirbrillig committed Aug 9, 2017
1 parent 0da4424 commit c105ac1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/StubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down

0 comments on commit c105ac1

Please sign in to comment.