/** * TODO: check if needed * Finds the right test data by its inputs (id and type) * @param KalturaTestCaseDataFile $unitTestDataFile * @param array $failuresInputs * @return int - the KalturaTestCaseDataFile key or null for if non found */ protected static function getTestKeyByInputs(KalturaTestCaseDataFile $unitTestDataFile, array $failuresInputs) { $testKey = null; foreach ($unitTestDataFile->getTestProceduresData() as $testProcedureKey => $testProcedureData) { foreach ($testProcedureData->getTestCasesData() as $key => $unitTestData) { $isAllInputsFound = KalturaTestResultUpdater::isAllFound($unitTestData->getInput(), $failuresInputs); $isAllOutputReferencesFound = KalturaTestResultUpdater::isAllFound($unitTestData->getOutputReferences(), $failuresInputs); if ($isAllInputsFound && $isAllOutputReferencesFound) { $testKey = $key; break; } } //If key is found then skip if (isset($testKey)) { break; } } return $testKey; }
<?php require_once dirname(__FILE__) . '/../bootstrap/bootstrapServer.php'; //Command line usage if (count($argv) == 2) { $dataFilePath = $argv[0]; $failuresFilePath = $argv[1]; } else { $basePath = "C:/opt/kaltura/app/tests/unitTests/kdl/testsData/"; $dataFilePath = $basePath . "KDLTest.Data"; $failuresFilePath = $basePath . "KDLTest.failures"; } KalturaTestResultUpdater::UpdateResults($dataFilePath, $failuresFilePath);
/** * * Writes the listener failures to the given file */ private function writeFailuresToFile() { if (KalturaTestListener::$testCaseFailures != null) { $testCaseFailuresXml = KalturaTestCaseFailures::toXml(KalturaTestListener::$testCaseFailures, "TestCaseFailures"); if ($testCaseFailuresXml != null) { $testCaseFailuresXml->formatOutput = true; $failuresAsXml = $testCaseFailuresXml->saveXML(); fwrite(KalturaTestListener::$failuresFile, $failuresAsXml); KalturaTestResultUpdater::UpdateResults(KalturaTestListener::$dataFilePath, KalturaTestListener::$failureFilePath); //Write the failures into the global failures file fwrite(KalturaTestListener::$totalFailureFile, $failuresAsXml); } else { // print("failures XML is null!!!\n"); KalturaLog::debug("failures XML is null!!!"); } } }