私は自分のPHPプログラムに単体テストを使い始めましたが、Simpletestは他のプログラムと同じように飛び込むのに適した場所だと思いました。Simpletestファイルをテストサーバーに追加し、カスタムPDOクラスで次のテストを実行しました。
<?php
require_once('../simpletest/autorun.php');
require_once('../includes/inc_sql.php');
class TestOfSQL extends UnitTestCase{
function testRead(){
...
}
function testWriteAndDelete(){
...
}
}
?>
それはすべて大胆にうまくいきます。次のように、(これまでのところ)そのテストファイルだけを含むテストスイートを構築しようとしています。
<?php
require_once('../simpletest/autorun.php');
class AllTests extends TestSuite {
function __construct(){
parent::__construct();
$this->addFile('inc_sql_test.php');
}
}
これはクラッシュして燃え、次のように表示されます。
Warning: include_once(inc_sql_test.php) [function.include-once]: failed to open stream: No such file or directory in E:\xampp\htdocs\historicMuncie\simpletest\test_case.php on line 382
Warning: include_once() [function.include]: Failed opening 'inc_sql_test.php' for inclusion (include_path='.;E:\xampp\php\PEAR') in E:\xampp\htdocs\historicMuncie\simpletest\test_case.php on line 382
Warning: file_get_contents(inc_sql_test.php) [function.file-get-contents]: failed to open stream: No such file or directory in E:\xampp\htdocs\historicMuncie\simpletest\test_case.php on line 418
all_tests.php
Fail: AllTests -> inc_sql_test.php -> Bad TestSuite [inc_sql_test.php] with error [No runnable test cases in [inc_sql_test.php]]
0/0 test cases complete: 0 passes, 1 fails and 0 exceptions.
インクルードパス、Webルートとサーバールートの表記法を試してみましたが、頭に浮かんだことは何でもありますが、そのテストスイートを正しく実行することはできません。何か案は?