Created
July 17, 2010 04:26
-
-
Save yuya-takeyama/479238 to your computer and use it in GitHub Desktop.
TDD with PHPUnit #02 http://blog.yuyat.jp/archives/342
This file contains 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 Calc | |
{ | |
public function add($a, $b) | |
{ | |
return $a + $b; | |
} | |
} |
This file contains 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_once 'PHPUnit/Framework.php'; | |
require_once './Calc.php'; | |
class CalcTest extends PHPUnit_Framework_TestCase | |
{ | |
public function testAdd() | |
{ | |
$calc = new Calc; | |
$this->assertEquals(2, $calc->add(1, 1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment