How do I run all my PHPUnit tests?

Posted by JJ on Stack Overflow See other posts from Stack Overflow or by JJ
Published on 2009-09-12T02:54:32Z Indexed on 2010/04/23 7:53 UTC
Read the original article Hit count: 469

Filed under:
|
|
|
|

I have script called Script.php and tests for it in Tests/Script.php, but when I run phpunit Tests it does not execute any tests in my test file. How do I run all my tests with phpunit?

PHPUnit 3.3.17, PHP 5.2.6-3ubuntu4.2, latest Ubuntu

Output:

$ phpunit Tests
PHPUnit 3.3.17 by Sebastian Bergmann.
Time: 0 seconds
OK (0 tests, 0 assertions)

And here are my script and test files:

Script.php

<?php  
function returnsTrue() {  
    return TRUE;  
}  
?>

Tests/Script.php

<?php  
require_once 'PHPUnit/Framework.php';  
require_once 'Script.php'  

class TestingOne extends PHPUnit_Framework_TestCase  
{

    public function testTrue()
    {
        $this->assertEquals(TRUE, returnsTrue());
    }

    public function testFalse()
    {
        $this->assertEquals(FALSE, returnsTrue());
    }
}

class TestingTwo extends PHPUnit_Framework_TestCase  
{

    public function testTrue()  
    {  
        $this->assertEquals(TRUE, returnsTrue());  
    }

    public function testFalse()
    {
        $this->assertEquals(FALSE, returnsTrue());
    }
}  
?>

© Stack Overflow or respective owner

Related posts about phpunit

Related posts about php