Created
May 19, 2012 12:17
-
-
Save yuya-matsushima/2730637 to your computer and use it in GitHub Desktop.
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 Bowling | |
{ | |
public $score = 0; | |
public function hit($val) | |
{ | |
$this->score += $val; | |
} | |
} |
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 | |
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