Note that there are some explanatory texts on larger screens.

plurals
  1. POPHPUnit not doing anything, no output
    primarykey
    data
    text
    <p>I have written some test cases and want to try them out with PHPUnit. However, it does not work. If I run <code>phpunit CategoryTest</code> it outputs:</p> <pre><code>PHPUnit 3.7.14 by Sebastian Bergmann. </code></pre> <p>If I do <code>phpunit --log-json error.log CategoryTest</code>, error.log file displays:</p> <pre><code>{"event":"suiteStart","suite":"CategoryTest","tests":5} {"event":"testStart","suite":"CategoryTest","test":"CategoryTest::test__construct"} </code></pre> <p>So, it finds that there are 5 tests in the file, starts doing the first one and for no reason stops. Is there any log where I could find a reason why it would not continue execution? Also, if I run test on some other file, say <code>phpunit --log-json error.log UserTest</code>, the shell does not display any output and neither does error.log file.</p> <p>I tried reinstalling it, as it was suggested in one of the other similar questions, but it didn't do anything.</p> <p>Any ideas how I could fix it?</p> <pre><code>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-&gt;Category = new Category(0, $mdb2); } protected function tearDown() { $this-&gt;Category = null; parent::tearDown (); } public function __construct() { } public function test__construct() { $this-&gt;markTestIncomplete ( "__construct test not implemented" ); $cat = $this-&gt;Category-&gt;__construct(0, $mdb2); $this-&gt;assertInstanceOf('Category', $cat); } public function testReturnID() { $this-&gt;markTestIncomplete ( "returnID test not implemented" ); $id = $this-&gt;Category-&gt;returnID(); $this-&gt;assertEquals(0, $id); } ... } </code></pre> <p>Variable <code>$mdb2</code> comes from the db_connect.php file.</p> <p><strong>I figured it out. The problem was that I included a variable from outside of a class.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload