I have a php project with unit tests included. I use Netbeans for development and would like to have phpunit intergration in my IDE. If I run phpunit from the commandline, it is working. If I press Alt+F6 to run tests in Netbeans no tests run, I get the message:
No tests executed (Perhaps an error occurred, verify in Output window.)
The structure (it is a Zend Framework 2 module):
Foo/
src/
Foo/
Bar.php
Baz.php
tests/
Foo/
BarTest.php
bootstrap.php
phpunit.xml
Module.php
autoload_register.php
Contents of BarTest.php
namespace Foo;
use PHPUnit_Framework_TestCase as TestCase;
class BarTest extends TestCase
{
public function testIsWorking ()
{
$this->assertTrue(true);
}
}
My phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="bootstrap.php">
<testsuite name="Foo">
<directory>./</directory>
</testsuite>
</phpunit>
My bootstrap.php:
// Set error reporting pretty high
error_reporting(E_ALL | E_STRICT);
// Get base, application and tests path
define('BASE_PATH', dirname(__DIR__));
// Load autoloader
require_once BASE_PATH . '/autoload_register.php';
In the Netbeans project properties I tried:
- To set the tests directory to
Foo/tests
(this is required I think) - To set specifically the bootstrap file (not required I think)
- To set specifically the XML configuration file (not required I think)
- To set specifically to run all *Test files (not required I think)
How can I ensure Netbeans can execute my phpunit tests?
phpunit --bootstrap bootstrap.php Foo/tests
? Because thats what IDE ultimately does - Artjom Kurapov