Created
June 7, 2011 15:54
-
-
Save alexandresalome/1012539 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 CalcSteps | |
{ | |
protected $calc; | |
protected $screen; | |
public function start() | |
{ | |
$this->calc = new Calc(); | |
} | |
public function getSteps() | |
{ | |
return array( | |
'/I start the calculator' => array($this, 'start'), | |
'/I have entered (.*) in the calculator' => array($this, 'enterValue'), | |
'/I press add' => array($this, 'pressAdd'), | |
'/The result should be (.*) on the screen/' => array('resultShouldBe') | |
); | |
} | |
public function pressAdd() | |
{ | |
$this->screen = $this->calc->getSum(); | |
} | |
public function enterValue($value) | |
{ | |
$this->calc->add($value); | |
} | |
public function resultShouldBe($value) | |
{ | |
assertEquals($value, $this->screen); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It will not work. At all!