Skip to content

Instantly share code, notes, and snippets.

@MacDada

MacDada/phpspec.php

Created Jun 10, 2014
Embed
What would you like to do?
<?php
namespace spec;
use PhpSpec\ObjectBehavior;
class StringCalculatorSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('StringCalculator');
}
function it_requires_string_input()
{
$this->shouldThrow('\InvalidArgumentException')->during('add', [null]);
}
function it_adds_2_numbers_separated_by_comma()
{
$this->add('1,2')->shouldReturn(3);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment