本文整理汇总了PHP中Build::AddError方法的典型用法代码示例。如果您正苦于以下问题:PHP Build::AddError方法的具体用法?PHP Build::AddError怎么用?PHP Build::AddError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Build
的用法示例。
在下文中一共展示了Build::AddError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBuildRemovalWorksAsExpected
public function testBuildRemovalWorksAsExpected()
{
require_once 'include/common.php';
require_once 'include/pdo.php';
require_once 'models/build.php';
require_once 'models/buildconfigure.php';
require_once 'models/builderror.php';
require_once 'models/buildfailure.php';
require_once 'models/buildgroup.php';
require_once 'models/buildnote.php';
require_once 'models/buildupdate.php';
require_once 'models/coverage.php';
require_once 'models/dynamicanalysis.php';
require_once 'models/dynamicanalysissummary.php';
require_once 'models/image.php';
require_once 'models/label.php';
require_once 'models/test.php';
require_once 'models/uploadfile.php';
$time = gmdate(FMT_DATETIME);
// Find an existing site.
$row = pdo_single_row_query('SELECT id FROM site LIMIT 1');
$siteid = $row['id'];
// Label
$label = new Label();
$label->SetText('remove me');
// Build
$build = new Build();
$build->Name = 'RemovalWorksAsExpected';
$build->SetStamp('20160822-1810-Experimental');
$build->ProjectId = 1;
$build->InsertErrors = true;
$build->SiteId = $siteid;
$build->StartTime = $time;
$build->EndTime = $time;
$build->SubmitTime = $time;
$build->AddLabel($label);
$buildgroup = new BuildGroup();
$build->GroupId = $buildgroup->GetGroupIdFromRule($build);
$info = new BuildInformation();
$info->SetValue('OSNAME', 'Windows');
$build->Information = $info;
// BuildError
$error = new BuildError();
$error->Text = 'error: asdf';
$build->AddError($error);
// BuildFailure
$failure = new BuildFailure();
$failure->StdError = 'failure: asdf';
$failure->AddArgument('arg1');
$failure->AddLabel($label);
$build->AddError($failure);
$build->Save();
// Create another build to test shared resources.
$existing_build = new Build();
$existing_build->Id = $build->Id;
$existing_build->FillFromId($build->Id);
$existing_build->SetStamp('20160822-1811-Experimental');
$existing_build->SubmitTime = $time;
$existing_build->InsertErrors = true;
$existing_build->AddError($failure);
$existing_build->Id = null;
$existing_build->Save();
// BuildConfigure
$configure = new BuildConfigure();
$configure->BuildId = $build->Id;
$configure->StartTime = $time;
$configure->EndTime = $time;
$configure->Command = 'cmake';
$configure->Log = "precontext\nWARNING: bar\npostcontext";
$configure->Status = 5;
$configure->AddLabel($label);
$configure->Insert();
$configure->ComputeWarnings();
$configure->ComputeErrors();
// BuildNote
$note = new BuildNote();
$note->Name = 'my note';
$note->Text = 'note text';
$note->Time = $time;
$note->BuildId = $build->Id;
$note->Insert();
$shared_note = new BuildNote();
$shared_note->Name = 'my shared note';
$shared_note->Text = 'shared note text';
$shared_note->Time = $time;
$shared_note->BuildId = $build->Id;
$shared_note->Insert();
$shared_note->BuildId = $existing_build->Id;
$shared_note->Insert();
// buildtesttime
$build->SaveTotalTestsTime(8);
// BuildUpdate
$updatefile = new BuildUpdateFile();
$updatefile->Author = 'My Self';
$updatefile->Committer = 'My Self';
$updatefile->Email = 'my@self.com';
$updatefile->CommitterEmail = 'my@self.com';
$updatefile->Revision = 2;
$updatefile->PriorRevision = 1;
$updatefile->Filename = 'foo.cpp';
//.........这里部分代码省略.........
示例2: testBuildModel
//.........这里部分代码省略.........
if ($build->GetName() !== false) {
$this->fail("GetName didn't return false for empty build id");
return 1;
}
if ($build->GetLabels() !== false) {
$this->fail("GetLabels didn't return false for empty build id");
return 1;
}
if ($build->GetGroup() !== false) {
$this->fail("GetGroup didn't return false for empty build id");
return 1;
}
if ($build->GetNumberOfErrors() !== false) {
$this->fail("GetNumberOfErrors didn't return false for empty build id");
return 1;
}
if ($build->GetNumberOfWarnings() !== false) {
$this->fail("GetNumberOfWarnings didn't return false for empty build id");
return 1;
}
if ($build->SetSubProject('1234') !== false) {
$this->fail("SetSubProject didn't return false for empty project id");
return 1;
}
if ($build->GetSubProjectName() !== false) {
$this->fail("GetSubProjectName didn't return false for empty build id");
return 1;
}
if ($build->GetErrorDifferences() !== false) {
$this->fail("GetErrorDifferences didn't return false for empty build id");
return 1;
}
if ($build->ComputeUpdateStatistics() !== false) {
$this->fail("ComputeUpdateStatistics didn't return false for empty build id");
return 1;
}
if ($build->ComputeDifferences() !== false) {
$this->fail("ComputeDifferences didn't return false for empty build id");
return 1;
}
if ($build->ComputeConfigureDifferences() !== false) {
$this->fail("ComputeConfigureDifferences didn't return false for empty build id");
return 1;
}
if ($build->ComputeTestTiming() !== false) {
$this->fail("ComputeTestTiming didn't return false for empty build id");
return 1;
}
if ($build->InsertLabelAssociations() !== false) {
$this->fail("InsertLabelAssocations didn't return false for empty build id");
return 1;
}
if ($build->UpdateEndTime('2010-08-07') !== false) {
$this->fail("UpdateEndTime didn't return false for empty build id");
return 1;
}
if ($build->SaveTotalTestsTime('100') !== false) {
$this->fail("SaveTotalTestsTime didn't return false for empty build id");
return 1;
}
$build->Id = '1';
if ($build->ComputeTestTiming() !== false) {
$this->fail("ComputeTestTiming didn't return false for empty project id");
return 1;
}
if ($build->ComputeUpdateStatistics() !== false) {
$this->fail("ComputeUpdateStatistics didn't return false for empty project id");
return 1;
}
$build->ProjectId = '2';
$build->SiteId = '1';
$build->SetSubProject('8567');
if (strpos(file_get_contents($this->logfilename), "New subproject detected") === false) {
$this->fail("'New subproject detected' not found in log after calling SetSubProject for invalid subproject id");
return 1;
}
if ($build->Exists() == false) {
$this->fail("Exists returned false for a valid build id");
return 1;
}
$build->Id = '98765';
$build->SetStamp('20100610-1901-Experimental');
$build->Type = '';
//force this empty for coverage purposes
$build->StartTime = '2009-12-18 14:19:11';
$build->EndTime = '2009-12-18 14:20:23';
$build->SubmitTime = '2012-01-25 16:43:11';
if ($build->Exists() == true) {
$this->fail("Exists returned true for an invalid build id");
return 1;
}
$build->Save();
$build->Append = true;
$build->InsertErrors = true;
$build->AddError($builderror);
$build->AddError($buildwarning);
$build->Save();
$this->stopCodeCoverage();
return 0;
}