I do not believe you have followed the tutorials on PHPUnit correctly. The setUp() function is run before each test, as each test is run in isolation. Therefore, you need to write your tests for that.
class XYZTest extends PHPUnit_Framework_TestCase {
protected $xml; // Internal Object for testing
// Assume you have autoloader configured in bootstrap. If not, Require your class to test
//require_once('YourXMLClass.php');
public function setUp()
{
$this->xml = new YourXMLClass(); // Create the XML object so it exists for testing.
}
public function testXMLIsEmpty()
{
$this->assertNull($this->xml->subject);
}
public function testXMLSubjectSet()
{
$this->xml->SetSubject('Basic Text to be returned as XML subject field');
$this->assertEquals('<subject>Basic Text to be returned as XML subject field</subject>', $this->xml->subject);
}
}
The assumption in my test is you have a SetSubject method in your class that adds the parameter to the subject field of your XML. IE:
public function SetSubject($SubjectText)
{
$this->subject = '<subject>' . $SubjectText . '</subject>';
}