I'm a beginner with PHPUnit.
This is a sample test class that I've created:
class NewTest extends PHPUnit_Framework_TestCase
{
protected $foo;
function testFirst ()
{
$this->foo = true;
$this->assertTrue($this->foo);
}
/**
* @depends testFirst
*/
function testSecond ()
{
$this->assertTrue($this->foo);
}
}
When testSecond is executed, it throws an error saying "Undefined property NewTest::$foo
".
Why does this happen? Does PHPUnit clear new properties after each test execution? Is there a way to set a property in a test so that it will be accessible in other tests of the same test class?