Information on the tools:
Netbeans 8.2
XAMPP V3.2.2
PHPUnit 3.7.21 by Sebastian Bergmann.
phpunit-skelgen 2.0.1 by Sebastian Bergmann.
HelloWorld:
<?php
namespace HelloWorld;
class HelloWorld
{
/**
* @assert (0, 0) == 0
* @assert (0, 1) == 1
* @assert (1, 0) == 1
* @assert (1, 1) == 2
* @assert (1, 2) == 4
*/
public function add($a, $b)
{
return $a + $b;
}
}
HelloWorldTest:
<?php
namespace HelloWorld;
/**
* Generated by PHPUnit_SkeletonGenerator on 2019-05-05 at 11:24:04.
*/
class HelloWorldTest extends \PHPUnit_Framework_TestCase {
/**
* @var HelloWorld
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
$this->object = new HelloWorld;
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown() {
}
/**
* Generated from @assert (0, 0) == 0.
*
* @covers HelloWorld\HelloWorld::add
*/
public function testAdd() {
$this->assertEquals(
0, $this->object->add(0, 0)
);
}
/**
* Generated from @assert (0, 1) == 1.
*
* @covers HelloWorld\HelloWorld::add
*/
public function testAdd2() {
$this->assertEquals(
1, $this->object->add(0, 1)
);
}
/**
* Generated from @assert (1, 0) == 1.
*
* @covers HelloWorld\HelloWorld::add
*/
public function testAdd3() {
$this->assertEquals(
1, $this->object->add(1, 0)
);
}
/**
* Generated from @assert (1, 1) == 2.
*
* @covers HelloWorld\HelloWorld::add
*/
public function testAdd4() {
$this->assertEquals(
2, $this->object->add(1, 1)
);
}
/**
* Generated from @assert (1, 2) == 4.
*
* @covers HelloWorld\HelloWorld::add
*/
public function testAdd5() {
$this->assertEquals(
4, $this->object->add(1, 2)
);
}
}
After run Test on netbeans, phpunit exhibits
the test passed. (0.0s)
while it should not
It seems there is a bug
Tools/Options=> PHPUnit Script is selected and
PHPUnit 3.7.21 by Sebastian Bergmann.
is returned from Command prompt when version is requested
Tools/Options=> Skeleton Generator Script is selected and
phpunit-skelgen 2.0.1 by Sebastian Bergmann.
is returned from Command prompt when version is requested