I am using windows environment , I have setup phpunit
in C:/users/kanishka/Desktop/php_unit folder i have two php files
User.php
class User {
protected $name;
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
}
public function talk() {
return "Hello world!";
}
}
UserTest.php
<?php
require_once "PHPUnit/Autoload.php";
require_once "User.php";
class UserTest extends PHPUnit_Framework_TestCase
{
protected $user;
protected function setUp() {
$this->user = new User();
$this->user->setName("Tom");
}
public function testTalk() {
$expected = "Hello world!";
$actual = $this->user->talk();
$this->assertEquals($expected, $actual);
}
protected function tearDown() {
unset($this->user);
}
}
when i type phpunit UnitTest UserTest.php
PHPUnit 3.6.3 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 5.75Mb
OK (1 test, 1 assertion)
Now I am trying to run this test automatically via ant
I have ant build.xml file in C:/users/kanishka/Desktop
<?xml version="1.0"?>
<project name="test" default="phpunit">
<target name="phpunit">
<exec executable="phpunit" failonerror="true">
<arg value="php_unit/UserTest.php" />
</exec>
</target>
</project>
I am trying to run UserTest.php
but I am getting this error
so ant file can not detect the path :( . please help me, Thanks in advance