I have a simpletest suite I've been working on writing for some of my recent API wrapper code in PHP. But every time I run the test, it runs all of the tests twice.
My calling code:
require_once(dirname(__FILE__) . '/simpletest/autorun.php');
require_once('CompanyNameAPI.php');
$test = new TestSuite('API test');
$test->addFile(dirname(__FILE__) . '/tests/authentication_test.php');
if (TextReporter::inCli()) {
exit ($test->run(new TextReporter()) ? 0 : 1);
} else {
$test->run(new HtmlReporter());
}
authentication_test.php looks like:
class Test_CallLoop_Authentication extends UnitTestCase {
function test_ClassCreate(){
$class = new CallLoopAPI();
$this->assertIsA($class, CallLoopAPI);
}
//More tests
}
There aren't any more includes to autorun.php or other calls to simpletest within authentication_test.php either.
Ideas?
You should change your calling code like this:
autorun.php file executes automatically your tests calling run() methods implicitly, when you call run() method you execute tests again.