PHPUnit3ではAnnotationを使ってテストケースの雛形を作る
確かに楽そう。ただ、テストパターンが多い場合、コードの可読性が異様に下がりそうな感じがするのは気のせいかなぁ。まあ、折り畳んで表示しちゃえば問題ないのか。
PHPUnit can help you write your tests by analyzing the code of an existing class and generating a skeleton test-case class for it. With PHPUnit 3 this feature will be more powerful as it now supports @test annotations in the class source.
<?php class Calculator { /** * @test (0, 0) == 0 * @test (0, 1) == 1 * @test (1, 0) == 1 * @test (1, 1) == 2 */ public function add($a, $b) { return $a + $b; } } ?>