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


PHP Build::InsertLabelAssociations方法代码示例

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


在下文中一共展示了Build::InsertLabelAssociations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBuildModel

 function testBuildModel()
 {
     $this->startCodeCoverage();
     $build = new Build();
     $builderror = new BuildError();
     $builderror->Type = 0;
     $builderror->Text = 'error';
     $buildwarning = new BuildError();
     $buildwarning->Type = 1;
     $buildwarning->Text = 'warning';
     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;
//.........这里部分代码省略.........
开发者ID:rpshaw,项目名称:CDash,代码行数:101,代码来源:test_buildmodel.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::InsertLabelAssociations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。