Skip to content

Instantly share code, notes, and snippets.

@yuya-matsushima
Created May 19, 2012 12:17
Show Gist options
  • Save yuya-matsushima/2730637 to your computer and use it in GitHub Desktop.
Save yuya-matsushima/2730637 to your computer and use it in GitHub Desktop.
<?php
class Bowling
{
public $score = 0;
public function hit($val)
{
$this->score += $val;
}
}
<?php
require 'Bowling.php';
class DescribeNewBowlingGame extends \PHPSpec\Context
{
private $_bowling = null;
public function before()
{
$this->_bowling = $this->spec(new Bowling);
}
public function itShouldScore0ForGutterGame()
{
for ($i = 1; $i <= 20; $i++) {
$this->_bowling->hit(0);
}
$this->_bowling->score->should->equal(0);
}
public function it1点を20回繰り返すとスコアは20になる()
{
for ($i = 1; $i <= 20; $i++) {
$this->_bowling->hit(0);
}
$this->_bowling->score->should->equal(20);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment