I have defined some variables in my test file then i call a function from my test file defined in src file and verify the result then While using phing it is not working, but if i use php or phpunit to verify it is working fine.
Example: add.php (source file) (present in the src directory)
<?php
function add_two_numbers()
{
global $a,$b; /* defined in test file*/
return ($a + $b);
}
?>
Other file:
// add_Test (Test File) (present in the test directory)
<?php
$a = 5;
$b = 3;
require_once ("__DIR__./../src/add.php");
class add_Test extends PHPUnit_Framework_TestCase{
function testadd()
{
$act = 8;
$res = add_two_numbers();
$this -> assertTrue($res === $act);
}
}
?>
Now, if i use phpunit then it is working fine but with phing the global variables are not set. Please tell me a solution to this.