コード例 #1
0
 /**
  * 
  * Update the failures into the data so in the next run no failures will accure
  * Should be use with extreme care after completly reviewing the failure file  
  * @param unknown_type $dataFile
  * @param unknown_type $failuresFile
  */
 public static function UpdateResults($dataFilePath, $failuresFilePath)
 {
     //Returns the inputs for the unit tests
     $unitTestDataFile = KalturaUnitTestDataFile::generateFromDataXml($dataFilePath);
     $testsFailures = KalturaTestFailures::generateFromXml($failuresFilePath);
     $newUnitTestData = KalturaUnitTestResultUpdater::update($unitTestDataFile, $testsFailures);
     $newDataFile = fopen($dataFilePath . ".new", "w+");
     fwrite($newDataFile, $newUnitTestData->toDataXml());
 }
コード例 #2
0
 /**
  * 
  * 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());
 }
コード例 #3
0
 /**
  * 
  * Generates a new testDatafile object from a given xml file path
  * @param string $dataFilePath
  * @return testDataFile - new TestDataFile object
  */
 public static function generateFromDataXml($dataFilePath)
 {
     $testDataFile = new KalturaUnitTestDataFile();
     $testDataFile->fromDataXml($dataFilePath);
     return $testDataFile;
 }