Skip to content

Instantly share code, notes, and snippets.

@alexandresalome
Created June 7, 2011 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexandresalome/1012539 to your computer and use it in GitHub Desktop.
Save alexandresalome/1012539 to your computer and use it in GitHub Desktop.
<?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);
}
}
@everzet
Copy link

everzet commented Jun 7, 2011

It will not work. At all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment