/** * * Creates a test file from the given testDataFile object * @param testDataFile $testDataFile */ private function createTestFile($testDataFile) { //1. Create the new unit test data file $newTestDataFile = new KalturaUnitTestDataFile(); //2.For every unit test data we need to: foreach ($testDataFile->unitTestsData as $unitTestData) { $unitTestDataObjects = new KalturaUnitTestData(); //1. Create the input and output reference objects $inputObjects = array(); $outputReferenceObjects = array(); //2. Foreach input - Get the object from kaltura DB and add it to the inputObjects array foreach ($unitTestData->input as $inputIdentifier) { $inputObjects[] = $this->getUnitTestDataObject($inputIdentifier); } //3. Foreach outputReference - Get the object from kaltura DB and add it to the outputReferenceObjects array foreach ($unitTestData->outputReference as $outputReferenceIdentifier) { $outputReferenceObjects[] = $this->getUnitTestDataObject($outputReferenceIdentifier); } //4. Create the new unit test data with the new objects $unitTestDataObjects->input = $inputObjects; $unitTestDataObjects->outputReference = $outputReferenceObjects; //5. Add the new unit test data to the Data file $newTestDataFile->unitTestsData[] = $unitTestDataObjects; } chdir(dirname($this->generatorConfigFile->filePath)); //3. Open the file at the file path $unitTestDatFileHandle = fopen($testDataFile->fileName, "w+"); //4. Save the entire test data file to the test data file name path (in XML) fwrite($unitTestDatFileHandle, $newTestDataFile->toDataXML()); }