I have written some test cases and want to try them with PHPUnit. However, this does not work. If I run phpunit CategoryTest, it produces:
PHPUnit 3.7.14 by Sebastian Bergmann.
If I do phpunit --log-json error.log CategoryTest, the error.log file displays:
{"event":"suiteStart","suite":"CategoryTest","tests":5}
{"event":"testStart","suite":"CategoryTest","test":"CategoryTest::test__construct"}
So, he found that in the file there are 5 tests, he starts to do the first one and stops for no reason. Is there any journal where I could find a reason why it would not continue execution? Also, if I run the test on some other file, say phpunit --log-json error.log UserTest, the shell does not display any output and the error.log file.
I tried to reinstall it, as suggested in one of the other similar questions, but did nothing.
What ideas can I fix?
require_once '../Category.class.php';
require_once '../../db_connect.php';
require_once 'PHPUnit/Framework/TestCase.php';
class CategoryTest extends PHPUnit_Framework_TestCase {
private $Category;
protected function setUp() {
parent::setUp ();
$this->Category = new Category(0, $mdb2);
}
protected function tearDown() {
$this->Category = null;
parent::tearDown ();
}
public function __construct() {
}
public function test__construct() {
$this->markTestIncomplete ( "__construct test not implemented" );
$cat = $this->Category->__construct(0, $mdb2);
$this->assertInstanceOf('Category', $cat);
}
public function testReturnID() {
$this->markTestIncomplete ( "returnID test not implemented" );
$id = $this->Category->returnID();
$this->assertEquals(0, $id);
}
...
}
The variable $mdb2comes from the db_connect.php file.
. , .