Created
November 17, 2016 15:06
-
-
Save philipobenito/f1e747731f58c72e0a5873779cd50176 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FooTest extends PHPUnit_Framework_Testcase | |
{ | |
public function testDoSomethingEditsDataAndReturnsArray() | |
{ | |
$foo = new Foo; | |
$user = [ | |
'name' => 'Phil', | |
'email' => '[email protected]' | |
]; | |
$mockBar = $this->getMock('Bar'); | |
$mockBar->expects($this->once()) | |
->method('editAndReturnUser') | |
->with($this->equalTo(1), $this->equalTo('Phil'), $this->equalTo('[email protected]')) | |
->will($this->returnValue($user)); | |
$foo->doSomething($mockBar, 1, 'Phil', '[email protected]'); | |
$this->assertInternalType('array', $user, 'The return of (doSomething) was not an array'); | |
$this->assertSame($user['name'], 'Phil', 'The returned user name was not as expected'); | |
$this->assertSame($user['email'], '[email protected]', 'The returned user email was not as expected'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment