当前位置: 首页>>代码示例>>PHP>>正文


PHP Build::AddLabel方法代码示例

本文整理汇总了PHP中Build::AddLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Build::AddLabel方法的具体用法?PHP Build::AddLabel怎么用?PHP Build::AddLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Build的用法示例。


在下文中一共展示了Build::AddLabel方法的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';
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:test_removebuilds.php

示例2: CreateParentBuild

 /** Create a new build as a parent of $this and sets $this->ParentId.
  * Assumes many fields have been set prior to calling this function.
  **/
 public function CreateParentBuild($numErrors, $numWarnings)
 {
     if ($numErrors < 0) {
         $numErrors = 0;
     }
     if ($numWarnings < 0) {
         $numWarnings = 0;
     }
     // Check if there's an existing build that should be the parent.
     // This would be a standalone build (parent=0) with no subproject
     // that matches our name, site, stamp, and projectid.
     $query = "SELECT id FROM build\n            WHERE parentid = 0 AND name = '{$this->Name}' AND\n            siteid = '{$this->SiteId}' AND stamp = '{$this->Stamp}' AND\n            projectid = '{$this->ProjectId}'\n            ";
     $result = pdo_query($query);
     if (pdo_num_rows($result) > 0) {
         $result_array = pdo_fetch_array($result);
         $this->SetParentId($result_array['id']);
         // Mark it as a parent (parentid of -1).
         pdo_query("UPDATE build SET parentid = -1 WHERE id = {$this->ParentId}");
     } else {
         // Generate a UUID for the parent build.  It is distinguished
         // from its children by the lack of SubProject (final parameter).
         $uuid = Build::GenerateUuid($this->Stamp, $this->Name, $this->SiteId, $this->ProjectId, '');
         // Create the parent build here.  Note how parent builds
         // are indicated by parentid == -1.
         $query = "INSERT INTO build\n                (parentid, siteid, projectid, stamp, name, type, generator,\n                 starttime, endtime, submittime, builderrors, buildwarnings,\n                 uuid, changeid)\n                VALUES\n                ('-1', '{$this->SiteId}', '{$this->ProjectId}', '{$this->Stamp}',\n                 '{$this->Name}', '{$this->Type}', '{$this->Generator}',\n                 '{$this->StartTime}', '{$this->EndTime}', '{$this->SubmitTime}',\n                 {$numErrors}, {$numWarnings}, '{$uuid}', '{$this->PullRequest}')";
         if (!pdo_query($query)) {
             // Check if somebody else beat us to creating this parent build.
             $existing_id_result = pdo_single_row_query("SELECT id FROM build WHERE uuid = '{$uuid}'");
             if ($existing_id_result && array_key_exists('id', $existing_id_result)) {
                 $this->SetParentId($existing_id_result['id']);
                 return false;
             } else {
                 add_last_sql_error('Build Insert Parent', $this->ProjectId, $this->Id);
                 return false;
             }
         }
         if (!$this->ParentId) {
             $this->SetParentId(pdo_insert_id('build'));
         }
     }
     // Update the parent's tally of build errors & warnings.
     $this->UpdateBuild($this->ParentId, $numErrors, $numWarnings);
     // Give the parent a label for this build's subproject.
     $label = new Label();
     $label->Text = $this->SubProjectName;
     $parent = new Build();
     $parent->Id = $this->ParentId;
     $parent->AddLabel($label);
     $parent->InsertLabelAssociations();
     // Since we just created a parent we should also update any existing
     // builds that should be a child of this parent but aren't yet.
     // This happens when Update.xml is parsed first, because it doesn't
     // contain info about what subproject it came from.
     // TODO: maybe we don't need this any more?
     $query = "UPDATE build SET parentid={$this->ParentId}\n            WHERE parentid=0 AND siteid='{$this->SiteId}' AND\n            name='{$this->Name}' AND stamp='{$this->Stamp}' AND\n            projectid={$this->ProjectId}";
     if (!pdo_query($query)) {
         add_last_sql_error('Build Insert Update Parent', $this->ProjectId, $this->ParentId);
     }
     return true;
 }
开发者ID:kitware,项目名称:cdash,代码行数:63,代码来源:build.php


注:本文中的Build::AddLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。