本文整理汇总了PHP中AbstractHandler::endElement方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractHandler::endElement方法的具体用法?PHP AbstractHandler::endElement怎么用?PHP AbstractHandler::endElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractHandler
的用法示例。
在下文中一共展示了AbstractHandler::endElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: endElement
/** End Element */
public function endElement($parser, $name)
{
$parent = $this->getParent();
// should be before endElement
parent::endElement($parser, $name);
if ($name == "STARTDATETIME" && $parent == 'COVERAGELOG') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->BuildId = $this->Build->GetIdFromName($this->SubProjectName);
if ($this->BuildId == 0) {
$t = 'Cannot add a coverage log to a build that does not exist';
$f = 'CoverageLogHandler::endElement';
add_log($t, $f, LOG_ERR, $this->projectid);
}
} else {
if ($name == 'LINE') {
$this->CoverageFile->File .= '<br>';
// cannot be <br/> for backward compatibility
} else {
if ($name == 'FILE') {
if ($this->BuildId != 0) {
$this->CoverageFile->Update($this->BuildId);
$this->CoverageFileLog->BuildId = $this->BuildId;
$this->CoverageFileLog->FileId = $this->CoverageFile->Id;
$this->CoverageFileLog->Insert();
}
unset($this->CoverageFile);
unset($this->CoverageFileLog);
}
}
}
}
示例2: endElement
/** endElement function */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'NOTE') {
$this->Build->ProjectId = $this->projectid;
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
// If the build doesn't exist we add it.
if ($this->Build->Id == 0) {
$this->Build->SetSubProject($this->SubProjectName);
// Since we only have precision in minutes (not seconds) here,
// set the start time at the end of the minute so it can be overridden
// by any more precise XML file received later.
$start_time = gmdate(FMT_DATETIME, strtotime($this->Note->Time) + 59);
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $this->Note->Time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
}
if ($this->Build->Id > 0) {
// Insert the note
$this->Note->BuildId = $this->Build->Id;
$this->Note->Insert();
} else {
add_log('Trying to add a note to a nonexistent build', 'note_handler.php', LOG_ERR);
}
}
}
示例3: endElement
/** End element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'SITE') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
// If the build doesn't exist we add it
if ($this->Build->Id == 0) {
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
$this->CoverageSummary->BuildId = $this->Build->Id;
// Insert coverage summary
$this->CoverageSummary->Insert(true);
$this->CoverageSummary->ComputeDifference();
} elseif ($name == 'FILE') {
$this->CoverageSummary->AddCoverage($this->Coverage);
} elseif ($name == 'LABEL') {
if (isset($this->Coverage)) {
$this->Coverage->AddLabel($this->Label);
}
}
}
示例4: endElement
/** End element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'SITE') {
$this->Site->Insert();
} elseif ($name == 'UPDATE') {
$this->Build->SiteId = $this->Site->Id;
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$submit_time = gmdate(FMT_DATETIME);
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = $submit_time;
$this->Build->ProjectId = $this->projectid;
$this->Build->GetIdFromName($this->SubProjectName);
// Update.xml doesn't include SubProject information.
// Check if GetIdFromName returned a child build, and
// if so, change our buildid to point at the parent instead.
$parentid = $this->Build->LookupParentBuildId();
if ($parentid > 0) {
$this->Build->Id = $parentid;
}
$this->Build->RemoveIfDone();
// If the build doesn't exist we add it
if ($this->Build->Id == 0) {
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->Append = $this->Append;
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
$this->Update->BuildId = $this->Build->Id;
$this->Update->StartTime = $start_time;
$this->Update->EndTime = $end_time;
// Insert the update
$this->Update->Insert();
global $CDASH_ENABLE_FEED;
if ($CDASH_ENABLE_FEED) {
// We need to work the magic here to have a good description
$this->Feed->InsertUpdate($this->projectid, $this->Build->Id);
}
if ($this->Update->Command === '') {
// If the UpdateCommand was not set, then this was a
// "version only" update. This means that CTest only told us
// what version of the code is being built, not what changed
// since last time. In this case we need to query the remote
// repository to figure out what changed.
perform_version_only_diff($this->Update, $this->projectid);
}
// Compute the update statistics
$this->Build->ComputeUpdateStatistics();
} elseif ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
$this->Update->AddFile($this->UpdateFile);
unset($this->UpdateFile);
}
}
示例5: endElement
/** endElement function */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'NOTE') {
if ($this->BuildId > 0) {
// Insert the note
$this->Note->BuildId = $this->BuildId;
$this->Note->Insert();
} else {
add_log("note_handler.php", "Trying to add a note to an unexisting build");
}
}
}
示例6: endElement
/** End element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'SITE') {
$this->Site->Insert();
} else {
if ($name == 'UPDATE') {
$this->Build->SiteId = $this->Site->Id;
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$submit_time = gmdate(FMT_DATETIME);
$this->Build->ProjectId = $this->projectid;
$buildid = $this->Build->GetIdFromName($this->SubProjectName);
// If the build doesn't exist we add it
if ($buildid == 0) {
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = $submit_time;
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
$buildid = $this->Build->Id;
} else {
$this->Build->Id = $buildid;
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = $submit_time;
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $buildid;
$this->Update->BuildId = $buildid;
$this->Update->StartTime = $start_time;
$this->Update->EndTime = $end_time;
// Insert the update
$this->Update->Insert();
global $CDASH_ENABLE_FEED;
if ($CDASH_ENABLE_FEED) {
// We need to work the magic here to have a good description
$this->Feed->InsertUpdate($this->projectid, $buildid);
}
// Compute the update statistics
$this->Build->ComputeUpdateStatistics();
} else {
if ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
$this->Update->AddFile($this->UpdateFile);
unset($this->UpdateFile);
}
}
}
}
示例7: endElement
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'CONFIGURE') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->InsertErrors = false;
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
if ($this->Build->Id == 0) {
// If the build doesn't exist we add it
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise we make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
$this->Configure->BuildId = $this->Build->Id;
$this->Configure->StartTime = $start_time;
$this->Configure->EndTime = $end_time;
// Insert the configure
if ($this->Configure->Exists()) {
$this->Configure->Delete();
}
$this->Configure->Insert();
// Insert errors from the log file
$this->Configure->ComputeWarnings();
$this->Configure->ComputeErrors();
$this->Build->ComputeConfigureDifferences();
// Record the number of warnings & errors with the build.
$this->Build->SetNumberOfConfigureWarnings($this->Configure->NumberOfWarnings);
$this->Build->SetNumberOfConfigureErrors($this->Configure->NumberOfErrors);
// Record configure duration with the build.
$this->Build->SetConfigureDuration($this->EndTimeStamp - $this->StartTimeStamp);
// Update the tally of warnings & errors in the parent build,
// if applicable.
$this->Build->UpdateParentConfigureNumbers($this->Configure->NumberOfWarnings, $this->Configure->NumberOfErrors);
} elseif ($name == 'LABEL') {
if (isset($this->Configure)) {
$this->Configure->AddLabel($this->Label);
}
}
}
示例8: endElement
/** End Element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name === 'SITE') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
if ($this->Build->Id == 0) {
// If the build doesn't exist we add it.
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
// Record the coverage data that we parsed from this file.
foreach ($this->CoverageFiles as $coverageInfo) {
$coverageFile = $coverageInfo[0];
$coverageFileLog = $coverageInfo[1];
$coverageFile->TrimLastNewline();
$coverageFile->Update($this->Build->Id);
$coverageFileLog->BuildId = $this->Build->Id;
$coverageFileLog->FileId = $coverageFile->Id;
$coverageFileLog->Insert(true);
}
} elseif ($name == 'LINE') {
$this->CurrentCoverageFile->File .= rtrim($this->CurrentLine);
// Cannot be <br/> for backward compatibility.
$this->CurrentCoverageFile->File .= '<br>';
} elseif ($name == 'FILE') {
// Store these objects to be inserted after we're guaranteed
// to have a valid buildid.
$this->CoverageFiles[] = array($this->CurrentCoverageFile, $this->CurrentCoverageFileLog);
} elseif ($name == 'COVERAGELOG') {
if (empty($this->CoverageFiles)) {
// Store these objects to be inserted after we're guaranteed
// to have a valid buildid.
$this->CoverageFiles[] = array(new CoverageFile(), new CoverageFileLog());
}
}
}
示例9: endElement
/** End element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'SITE') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->ProjectId = $this->projectid;
$buildid = $this->Build->GetIdFromName($this->SubProjectName);
// If the build doesn't exist we add it
if ($buildid == 0) {
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
$buildid = $this->Build->Id;
}
// Remove any previous coverage information
$GLOBALS['PHP_ERROR_BUILD_ID'] = $buildid;
$this->CoverageSummary->BuildId = $buildid;
$this->CoverageSummary->RemoveAll();
// Insert coverage summary
$this->CoverageSummary->Insert();
$this->CoverageSummary->ComputeDifference();
} else {
if ($name == 'FILE') {
$this->CoverageSummary->AddCoverage($this->Coverage);
} else {
if ($name == 'LABEL') {
if (isset($this->Coverage)) {
$this->Coverage->AddLabel($this->Label);
}
}
}
}
}
示例10: endElement
/** Function endElement */
public function endElement($parser, $name)
{
$parent = $this->getParent();
// should be before endElement
parent::endElement($parser, $name);
if ($name == "STARTTESTTIME" && $parent == 'DYNAMICANALYSIS') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$this->Build->ProjectId = $this->projectid;
$buildid = $this->Build->GetIdFromName($this->SubProjectName);
// If the build doesn't exist we add it
if ($buildid == 0) {
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $start_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
$this->UpdateEndTime = true;
$buildid = $this->Build->Id;
} else {
// Remove all the previous analysis
$this->DynamicAnalysis = new DynamicAnalysis();
$this->DynamicAnalysis->BuildId = $buildid;
$this->DynamicAnalysis->RemoveAll();
unset($this->DynamicAnalysis);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $buildid;
$this->BuildId = $buildid;
} else {
if ($name == "TEST" && $parent == 'DYNAMICANALYSIS') {
$this->DynamicAnalysis->BuildId = $this->BuildId;
$this->DynamicAnalysis->Insert();
} else {
if ($name == 'DEFECT') {
$this->DynamicAnalysis->AddDefect($this->DynamicAnalysisDefect);
unset($this->DynamicAnalysisDefect);
} else {
if ($name == "SITE") {
if ($this->UpdateEndTime) {
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
// The EndTimeStamp
$this->Build->UpdateEndTime($end_time);
}
} else {
if ($name == 'LABEL') {
if (isset($this->DynamicAnalysis)) {
$this->DynamicAnalysis->AddLabel($this->Label);
}
} else {
if ($name == 'DYNAMICANALYSIS') {
// If everything is perfect CTest doesn't send any <test>
// But we still want a line showing the current dynamic analysis
if (!isset($this->DynamicAnalysis)) {
$this->DynamicAnalysis = new DynamicAnalysis();
$this->DynamicAnalysis->BuildId = $this->BuildId;
$this->DynamicAnalysis->Status = 'passed';
$this->DynamicAnalysis->Checker = $this->Checker;
$this->DynamicAnalysis->Insert();
}
}
}
}
}
}
}
}
示例11: endElement
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'BUILD') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$submit_time = gmdate(FMT_DATETIME);
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = $submit_time;
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->Append = $this->Append;
add_build($this->Build, $this->scheduleid);
$this->Build->ComputeDifferences();
global $CDASH_ENABLE_FEED;
if ($CDASH_ENABLE_FEED) {
// Insert the build into the feed
$this->Feed->InsertBuild($this->projectid, $this->Build->Id);
}
} else {
if ($name == 'WARNING' || $name == 'ERROR' || $name == 'FAILURE') {
global $CDASH_LARGE_TEXT_LIMIT;
$threshold = $CDASH_LARGE_TEXT_LIMIT;
if ($threshold > 0 && isset($this->Error->StdOutput)) {
$outlen = strlen($this->Error->StdOutput);
if ($outlen > $threshold) {
$tmp = substr($this->Error->StdOutput, 0, $threshold);
unset($this->Error->StdOutput);
$this->Error->StdOutput = $tmp . "\n...\nCDash truncated output because it exceeded {$threshold} characters.\n";
$outlen = strlen($this->Error->StdOutput);
//add_log("truncated long out text", "build_handler", LOG_INFO);
}
$errlen = strlen($this->Error->StdError);
if ($errlen > $threshold) {
$tmp = substr($this->Error->StdError, 0, $threshold);
unset($this->Error->StdError);
$this->Error->StdError = $tmp . "\n...\nCDash truncated output because it exceeded {$threshold} characters.\n";
$errlen = strlen($this->Error->StdError);
//add_log("truncated long err text", "build_handler", LOG_INFO);
}
}
$this->Build->AddError($this->Error);
unset($this->Error);
} else {
if ($name == 'LABEL') {
if (isset($this->Error)) {
$this->Error->AddLabel($this->Label);
} else {
if (isset($this->Build)) {
$this->Build->AddLabel($this->Label);
}
}
}
}
}
}
示例12: endElement
/** Function endElement */
public function endElement($parser, $name)
{
$parent = $this->getParent();
// should be before endElement
parent::endElement($parser, $name);
if ($this->UploadError) {
return;
}
if ($name == 'FILE' && $parent == 'UPLOAD') {
$this->UploadFile->BuildId = $this->BuildId;
// Close base64 temporary file writing handler
fclose($this->Base64TmpFileWriteHandle);
unset($this->Base64TmpFileWriteHandle);
// Decode file using 'read by chunk' approach to minimize memory footprint
// Note: Using stream_filter_append/stream_copy_to_stream is more efficient but
// return an "invalid byte sequence" on windows
$rhandle = fopen($this->Base64TmpFilename, 'r');
$whandle = fopen($this->TmpFilename, 'w+');
$chunksize = 4096;
while (!feof($rhandle)) {
fwrite($whandle, base64_decode(fread($rhandle, $chunksize)));
}
fclose($rhandle);
unset($rhandle);
fclose($whandle);
unset($whandle);
// Delete base64 encoded file
$success = cdash_unlink($this->Base64TmpFilename);
if (!$success) {
add_log("Failed to delete file '" . $this->Base64TmpFilename . "'", __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_WARNING);
}
// Check file size against the upload quota
$upload_file_size = filesize($this->TmpFilename);
$Project = new Project();
$Project->Id = $this->projectid;
$Project->Fill();
if ($upload_file_size > $Project->UploadQuota) {
add_log("Size of uploaded file {$this->TmpFilename} is {$upload_file_size} bytes, which is greater " . "than the total upload quota for this project ({$Project->UploadQuota} bytes)", __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_ERR);
$this->UploadError = true;
cdash_unlink($this->TmpFilename);
return;
}
// Compute SHA1 of decoded file
$upload_file_sha1 = sha1_file($this->TmpFilename);
// TODO Check if a file if same buildid, sha1 and name has already been uploaded
$this->UploadFile->Sha1Sum = $upload_file_sha1;
$this->UploadFile->Filesize = $upload_file_size;
// Extension of the file indicates if it's a data file that should be hosted on CDash of if
// an URL should just be considered. File having extension ".url" are expected to contain an URL.
$path_parts = pathinfo($this->UploadFile->Filename);
$ext = $path_parts['extension'];
if ($ext == "url") {
$this->UploadFile->IsUrl = true;
// Read content of the file
$url_length = 255;
// max length of 'uploadfile.filename' field
$this->UploadFile->Filename = trim(file_get_contents($this->TmpFilename, NULL, NULL, 0, $url_length));
cdash_unlink($this->TmpFilename);
//add_log("this->UploadFile->Filename '".$this->UploadFile->Filename."'", __FILE__.':'.__LINE__.' - '.__FUNCTION__, LOG_INFO);
} else {
$this->UploadFile->IsUrl = false;
$upload_dir = realpath($GLOBALS['CDASH_UPLOAD_DIRECTORY']);
if (!$upload_dir) {
add_log("realpath cannot resolve CDASH_UPLOAD_DIRECTORY '" . $GLOBALS['CDASH_UPLOAD_DIRECTORY'] . "' with cwd '" . getcwd() . "'", __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_WARNING);
}
$upload_dir .= '/' . $this->UploadFile->Sha1Sum;
$uploadfilepath = $upload_dir . '/' . $this->UploadFile->Sha1Sum;
// Check if upload directory should be created
if (!file_exists($upload_dir)) {
$success = mkdir($upload_dir);
if (!$success) {
add_log("Failed to create directory '" . $upload_dir . "'", __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_ERR);
$this->UploadError = true;
return;
}
}
// Check if file has already been referenced
if (!file_exists($uploadfilepath)) {
$success = rename($this->TmpFilename, $uploadfilepath);
if (!$success) {
add_log("Failed to rename file '" . $this->TmpFilename . "' into '" . $uploadfilepath . "'", __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_ERR);
$this->UploadError = true;
return;
}
} else {
// Delete decoded temporary file since it has already been addressed
$success = cdash_unlink($this->TmpFilename);
if (!$success) {
add_log("Failed to delete file '" . $this->TmpFilename . "'", __FILE__ . ':' . __LINE__ . ' - ' . __FUNCTION__, LOG_WARNING);
}
}
// Generate symlink name
$symlinkName = $path_parts['basename'];
// Check if symlink should be created
$createSymlink = !file_exists($upload_dir . '/' . $symlinkName);
if ($createSymlink) {
// Create symlink
if (function_exists("symlink")) {
$success = symlink($uploadfilepath, $upload_dir . '/' . $symlinkName);
//.........这里部分代码省略.........
示例13: endElement
/** Function endElement */
public function endElement($parser, $name)
{
$parent = $this->getParent();
// should be before endElement
parent::endElement($parser, $name);
if ($name == 'STARTTESTTIME' && $parent == 'DYNAMICANALYSIS') {
$this->Build->ProjectId = $this->projectid;
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$this->Build->StartTime = $start_time;
// EndTimeStamp hasn't been parsed yet. We update this value later.
$this->Build->EndTime = $start_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
// If the build doesn't exist we add it
if ($this->Build->Id == 0) {
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise make sure that the build is up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
// Remove all the previous analysis
$this->DynamicAnalysis = new DynamicAnalysis();
$this->DynamicAnalysis->BuildId = $this->Build->Id;
$this->DynamicAnalysis->RemoveAll();
unset($this->DynamicAnalysis);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
$this->DynamicAnalysisSummary->BuildId = $this->Build->Id;
} elseif ($name == 'TEST' && $parent == 'DYNAMICANALYSIS') {
$this->DynamicAnalysis->BuildId = $this->Build->Id;
$this->DynamicAnalysis->Insert();
} elseif ($name == 'DEFECT') {
$this->DynamicAnalysis->AddDefect($this->DynamicAnalysisDefect);
$this->DynamicAnalysisSummary->AddDefects($this->DynamicAnalysisDefect->Value);
unset($this->DynamicAnalysisDefect);
} elseif ($name == 'LABEL') {
if (isset($this->DynamicAnalysis)) {
$this->DynamicAnalysis->AddLabel($this->Label);
}
} elseif ($name == 'DYNAMICANALYSIS') {
// Update this build's end time if necessary.
$this->Build->EndTime = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
// If everything is perfect CTest doesn't send any <test>
// But we still want a line showing the current dynamic analysis
if (!isset($this->DynamicAnalysis)) {
$this->DynamicAnalysis = new DynamicAnalysis();
$this->DynamicAnalysis->BuildId = $this->Build->Id;
$this->DynamicAnalysis->Status = 'passed';
$this->DynamicAnalysis->Checker = $this->Checker;
$this->DynamicAnalysis->Insert();
}
$this->DynamicAnalysisSummary->Insert();
// If this is a child build append these defects to the parent's
// summary.
$parentid = $this->Build->LookupParentBuildId();
if ($parentid > 0) {
$this->DynamicAnalysisSummary->BuildId = $parentid;
$this->DynamicAnalysisSummary->Insert(true);
}
}
}
示例14: endElement
/** End Element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'FAILURE') {
$this->BuildTest->Status = 'failed';
} elseif ($name == 'TESTCASE') {
if ($this->BuildTest->Status == 'passed') {
$this->NumberTestsPassed++;
} elseif ($this->BuildTest->Status == 'failed') {
$this->NumberTestsFailed++;
}
$this->Test->Insert();
if ($this->Test->Id > 0) {
$this->BuildTest->TestId = $this->Test->Id;
$this->BuildTest->BuildId = $this->Build->Id;
$this->BuildTest->Insert();
$this->Test->InsertLabelAssociations($this->Build->Id);
} else {
add_log('Cannot insert test', 'Test XML parser', LOG_ERR, $this->projectid, $this->Build->Id);
}
} elseif ($name == 'SITE' || $this->HasSiteTag == false && $name == 'TESTSUITE') {
if (strlen($this->EndTimeStamp) > 0 && $this->UpdateEndTime) {
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
// The EndTimeStamp
$this->Build->UpdateEndTime($end_time);
}
// Update the number of tests in the Build table
$this->Build->UpdateTestNumbers($this->NumberTestsPassed, $this->NumberTestsFailed, $this->NumberTestsNotRun);
$this->Build->ComputeTestTiming();
}
}
示例15: endElement
/** End Element */
public function endElement($parser, $name)
{
//$parent = $this->getParent(); // should be before endElement
parent::endElement($parser, $name);
if ($name == "TEST-CASE") {
$this->Test->Insert();
if ($this->Test->Id > 0) {
$this->BuildTest->TestId = $this->Test->Id;
$this->BuildTest->BuildId = $this->BuildId;
$this->BuildTest->Insert();
$this->Test->InsertLabelAssociations($this->BuildId);
} else {
add_log("Cannot insert test", "Test XML parser", LOG_ERR, $this->projectid, $this->BuildId);
}
} else {
if ($name == "SITE" || $this->HasSiteTag == false && $name == "TEST-RESULTS") {
if (strlen($this->EndTimeStamp) > 0 && $this->UpdateEndTime) {
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
// The EndTimeStamp
$this->Build->UpdateEndTime($end_time);
}
// Update the number of tests in the Build table
$this->Build->UpdateTestNumbers($this->NumberTestsPassed, $this->NumberTestsFailed, $this->NumberTestsNotRun);
$this->Build->ComputeTestTiming();
}
}
}