私は次の構成を持っています:
- xampp 1.7.7 からの PHP 5.3.8
- PHP ユニット 3.7.13。
コマンドラインと Windows XP の Netbeans の両方からテストを実行しています。これが私のコードです。
class Wrapper
{
public function wrap($text, $maxLength) {
if(strlen($text) > $maxLength)
return substr($text, 0, $maxLength) . "\n" . substr($text, $maxLength);
return $text;
}
}
class WrapperTest extends PHPUnit_Framework_TestCase
{
protected $wrapper;
protected function setUp() {
$this->wrapper = new Wrapper;
}
public function testWrap() {
$text = '';
$this->assertEquals($text, $this->wrapper->wrap($text));
}
}
問題は、関数に明らかに引数が欠落しているにもかかわらず、テストがパスすることです。Ubuntu を使用している場合、テストは期待どおりに失敗します。