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


PHP Build::GetDate方法代码示例

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


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

示例1: testBuildGetDate

 public function testBuildGetDate()
 {
     $retval = 0;
     $build = new Build();
     $build->Id = 1;
     $build->ProjectId = 1;
     $build->Filled = true;
     $row = pdo_single_row_query('SELECT nightlytime FROM project WHERE id=1');
     $original_nightlytime = $row['nightlytime'];
     // Test the case where the project's start time is in the evening.
     pdo_query("UPDATE project SET nightlytime = '20:00:00' WHERE id=1");
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 19:59:59'));
     $expected_date = '2009-02-23';
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Evening case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 20:00:00'));
     $expected_date = '2009-02-24';
     $build->NightlyStartTime = false;
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Evening case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     // Test the case where the project's start time is in the morning.
     pdo_query("UPDATE project SET nightlytime = '09:00:00' WHERE id=1");
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 08:59:59'));
     $expected_date = '2009-02-22';
     $build->NightlyStartTime = false;
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Morning case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     $build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 09:00:00'));
     $expected_date = '2009-02-23';
     $build->NightlyStartTime = false;
     $date = $build->GetDate();
     if ($date !== $expected_date) {
         $this->fail("Morning case: expected {$expected_date}, found {$date}");
         $retval = 1;
     }
     pdo_query("UPDATE project SET nightlytime = '{$original_nightlytime}' WHERE id=1");
     if ($retval === 0) {
         $this->pass('Tests passed');
     }
     return $retval;
 }
开发者ID:kitware,项目名称:cdash,代码行数:50,代码来源:test_buildgetdate.php

示例2: testGithubPRComment

 public function testGithubPRComment()
 {
     echo "1. testGithubPRComment\n";
     global $configure;
     $this->login();
     // Create a project named CDash and set its repository information.
     $settings = ['Name' => 'CDash', 'Description' => 'CDash', 'CvsUrl' => 'github.com/Kitware/CDash', 'CvsViewerType' => 'github', 'BugTrackerFileUrl' => 'http://public.kitware.com/Bug/view.php?id=', 'repositories' => [['url' => 'https://github.com/Kitware/CDash', 'branch' => 'master', 'username' => $configure['github_username'], 'password' => $configure['github_password']]]];
     $this->ProjectId = $this->createProject($settings);
     if ($this->ProjectId < 1) {
         return 1;
     }
     // Setup subprojects by submitting the Project.xml file.
     global $configure;
     // Submit the file.
     $url = $this->url . '/submit.php?project=CDash';
     $result = $this->uploadfile($url, dirname(__FILE__) . '/data/GithubPR/Project.xml');
     $this->deleteLog($this->logfilename);
     // Submit a failing test.
     echo "Submitting Test.xml\n";
     if (!$this->submitPullRequestFile(dirname(__FILE__) . '/data/GithubPR/Test.xml')) {
         return 1;
     }
     // Submit a broken build.
     echo "Submitting Build.xml\n";
     if (!$this->submitPullRequestFile(dirname(__FILE__) . '/data/GithubPR/Build.xml')) {
         return 1;
     }
     // Submit a failed configure.
     echo "Submitting Configure.xml\n";
     if (!$this->submitPullRequestFile(dirname(__FILE__) . '/data/GithubPR/Configure.xml')) {
         return 1;
     }
     // Make sure these builds link back to the GitHub PR.
     $row = pdo_single_row_query("SELECT id, parentid FROM build\n                WHERE name = 'test_PR_comment' AND parentid>0 LIMIT 1");
     $build = new Build();
     $build->Id = $row['id'];
     $build->FillFromId($build->Id);
     $date = $build->GetDate();
     // Parent view
     $content = $this->connect($this->url . "/api/v1/index.php?project=CDash&date={$date}");
     $jsonobj = json_decode($content, true);
     $buildgroup = array_pop($jsonobj['buildgroups']);
     $build_response = $buildgroup['builds'][0];
     if ($build_response['changelink'] !== 'github.com/Kitware/CDash/pull/80') {
         $this->fail("Expected changelink not found for parent build.  Found: " . $build_response['changelink']);
     }
     if ($build_response['changeicon'] !== 'img/Octocat.png') {
         $this->fail("Expected changeicon not found for parent build.  Found: " . $build_response['changeicon']);
     }
     // Child view
     $parentid = $row['parentid'];
     $content = $this->connect($this->url . "/api/v1/index.php?project=CDash&parentid={$parentid}");
     $jsonobj = json_decode($content, true);
     if ($jsonobj['changelink'] !== 'github.com/Kitware/CDash/pull/80') {
         $this->fail("Expected changelink not found for parent build");
     }
     if ($jsonobj['changeicon'] !== 'img/Octocat.png') {
         $this->fail("Expected changeicon not found for parent build");
     }
     // Delete the project now that we're done with it.
     $this->deleteProject($this->ProjectId);
 }
开发者ID:kitware,项目名称:cdash,代码行数:62,代码来源:test_github_PR_comment.php

示例3: echo_main_dashboard_JSON

function echo_main_dashboard_JSON($project_instance, $date)
{
    $start = microtime_float();
    $noforcelogin = 1;
    include_once dirname(dirname(dirname(__DIR__))) . '/config/config.php';
    require_once 'include/pdo.php';
    include 'public/login.php';
    include_once 'models/banner.php';
    include_once 'models/build.php';
    include_once 'models/subproject.php';
    $response = array();
    $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
    if (!$db) {
        $response['error'] = 'Error connecting to CDash database server';
        echo json_encode($response);
        return;
    }
    if (!pdo_select_db("{$CDASH_DB_NAME}", $db)) {
        $response['error'] = 'Error selecting CDash database';
        echo json_encode($response);
        return;
    }
    $projectid = $project_instance->Id;
    $project = pdo_query("SELECT * FROM project WHERE id='{$projectid}'");
    if (pdo_num_rows($project) > 0) {
        $project_array = pdo_fetch_array($project);
        $projectname = $project_array['name'];
        if (isset($project_array['testingdataurl']) && $project_array['testingdataurl'] != '') {
            $testingdataurl = make_cdash_url(htmlentities($project_array['testingdataurl']));
        }
    } else {
        $response['error'] = "This project doesn't exist. Maybe the URL you are trying to access is wrong.";
        echo json_encode($response);
        return;
    }
    if (!checkUserPolicy(@$_SESSION['cdash']['loginid'], $project_array['id'], 1)) {
        $response['requirelogin'] = 1;
        echo json_encode($response);
        return;
    }
    $response = begin_JSON_response();
    $response['title'] = "CDash - {$projectname}";
    $response['feed'] = $CDASH_ENABLE_FEED;
    $response['showcalendar'] = 1;
    $Banner = new Banner();
    $Banner->SetProjectId(0);
    $text = $Banner->GetText();
    $banners = array();
    if ($text !== false) {
        $banners[] = $text;
    }
    $Banner->SetProjectId($projectid);
    $text = $Banner->GetText();
    if ($text !== false) {
        $banners[] = $text;
    }
    $response['banners'] = $banners;
    $site_response = array();
    // If parentid is set we need to lookup the date for this build
    // because it is not specified as a query string parameter.
    if (isset($_GET['parentid'])) {
        $parentid = pdo_real_escape_numeric($_GET['parentid']);
        $parent_build = new Build();
        $parent_build->Id = $parentid;
        $date = $parent_build->GetDate();
        $response['parentid'] = $parentid;
    } else {
        $response['parentid'] = -1;
    }
    list($previousdate, $currentstarttime, $nextdate) = get_dates($date, $project_array['nightlytime']);
    // Main dashboard section
    get_dashboard_JSON($projectname, $date, $response);
    $response['displaylabels'] = $project_array['displaylabels'];
    $page_id = 'index.php';
    $response['childview'] = 0;
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/models/proProject.php')) {
        include_once 'local/models/proProject.php';
        $pro = new proProject();
        $pro->ProjectId = $projectid;
        $response['proedition'] = $pro->GetEdition(1);
    }
    if ($currentstarttime > time() && !isset($_GET['parentid'])) {
        $response['error'] = 'CDash cannot predict the future (yet)';
        echo json_encode($response);
        return;
    }
    // Menu definition
    $response['menu'] = array();
    $beginning_timestamp = $currentstarttime;
    $end_timestamp = $currentstarttime + 3600 * 24;
    $beginning_UTCDate = gmdate(FMT_DATETIME, $beginning_timestamp);
    $end_UTCDate = gmdate(FMT_DATETIME, $end_timestamp);
    if ($project_instance->GetNumberOfSubProjects($end_UTCDate) > 0) {
        $response['menu']['subprojects'] = 1;
    }
    if (isset($_GET['parentid'])) {
        $page_id = 'indexchildren.php';
        $response['childview'] = 1;
        // When a parentid is specified, we should link to the next build,
        // not the next day.
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:index.php

示例4: htmlspecialchars

include 'public/login.php';
include_once 'include/common.php';
include 'include/version.php';
require_once 'include/filterdataFunctions.php';
include_once 'models/build.php';
@($date = $_GET['date']);
if ($date != null) {
    $date = htmlspecialchars(pdo_real_escape_string($date));
}
// If parentid is set we need to lookup the date for this build
// because it is not specified as a query string parameter.
if (isset($_GET['parentid'])) {
    $parentid = pdo_real_escape_numeric($_GET['parentid']);
    $parent_build = new Build();
    $parent_build->Id = $parentid;
    $date = $parent_build->GetDate();
}
@($projectname = $_GET['project']);
if ($projectname != null) {
    $projectname = htmlspecialchars(pdo_real_escape_string($projectname));
}
$response = begin_JSON_response();
$response['title'] = "CDash : {$projectname}";
$response['showcalendar'] = 1;
$start = microtime_float();
$db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
pdo_select_db("{$CDASH_DB_NAME}", $db);
if ($projectname == '') {
    $project_array = pdo_single_row_query('SELECT * FROM project LIMIT 1');
} else {
    $project_array = pdo_single_row_query("SELECT * FROM project WHERE name='{$projectname}'");
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:queryTests.php


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