Created
December 30, 2011 15:27
-
-
Save phpspec/1540309 to your computer and use it in GitHub Desktop.
Example of existing syntax
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 StringCalculator extends \PHPSpec\Context | |
{ | |
function before() | |
{ | |
$this->calculator = $this->spec(new StringCalculator); | |
} | |
function itReturnsZeroWithNoArguments() | |
{ | |
$this->calculator->add()->should->equal(0); | |
} | |
function itReturnsZeroWhenZeroIsPassed() | |
{ | |
$this->calculator->add("0")->should->equal(0); | |
} | |
function itReturnsTheBareNumber() | |
{ | |
$this->calculator->add("42")->should->equal(42); | |
} | |
function itReturnsTheSumOfSpaceSeparatedNumbers() | |
{ | |
$this->calculator->add("42 7")->should->equal(49); | |
} | |
function itReturnsTheSumOfAnyWhiteSpaceSeparatedNumbers() | |
{ | |
$this->pending() | |
} | |
function itAllowsYouToSpecifyAnySeparator() | |
{ | |
$this->pending(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment