Last active
August 29, 2015 13:57
-
-
Save danscotton/9787202 to your computer and use it in GitHub Desktop.
This file contains 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 MyClassTest extends PHPUnit_Framework_TestCase | |
{ | |
public function setup() | |
{ | |
$this->dependency = Phake::mock('Dependency'); | |
$this->myClass = new MyClassOne($this->dependency); | |
} | |
public function testAddNumberSendsAddNumberMessageToDependency() | |
{ | |
$this->myClass->addNumber('one'); | |
Phake::verify($this->dependency)->addNumber('one'); | |
} | |
public function testGetNumbersReturnsDependencyGetListOfNumbers() | |
{ | |
$expected = array('one', 'two'); | |
Phake::when($this->dependency)->getListOfNumbers()->thenReturn($expected); | |
$this->assertEquals($expected, $this->myClass->getNumbers()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment