Skip to content

Instantly share code, notes, and snippets.

@MacDada
Created June 10, 2014 22:53
Show Gist options
  • Select an option

  • Save MacDada/5c0e07d68f29d1a930f2 to your computer and use it in GitHub Desktop.

Select an option

Save MacDada/5c0e07d68f29d1a930f2 to your computer and use it in GitHub Desktop.
<?php
namespace Dn;
class StringCalculatorSpec
{
public function specification($features)
{
/**
* It is initializable
*/
$features[] = function ($calculator) {
$calculator->shouldHaveType('StringCalculator');
};
/**
* It requires string input
*/
$features[] = function ($calculator) {
$calculator->shouldThrow('\InvalidArgumentException')->during('add', [null]);
};
/**
* It adds 2 numbers separated by comma
*/
$features[] = function ($calculator) {
$calculator->add('1,2')->shouldReturn(3);
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment