1<?php
2//
3// After including cdash_test_case.php, subsequent require_once calls are
4// relative to the top of the CDash source tree
5//
6require_once(dirname(__FILE__).'/cdash_test_case.php');
7
8require_once('cdash/common.php');
9require_once('cdash/pdo.php');
10
11class DeleteDailyUpdateTestCase extends KWWebTestCase
12{
13  function __construct()
14    {
15    parent::__construct();
16
17    global $db;
18    $this->databaseName = $db['name'];
19
20    $this->deleteLog($this->logfilename);
21    }
22
23  function testDeleteDailyUpdate()
24    {
25    //double check that it's the testing database before doing anything hasty...
26    if($this->databaseName !== "cdash4simpletest")
27      {
28      $this->fail("can only test on a database named 'cdash4simpletest'");
29      return 1;
30      }
31
32    //remove the daily update entry for some projects so that subsequent tests
33    //will cover dailyupdate.php more thoroughly
34
35    $cvsID = get_project_id("InsightExample");
36    if(!$query = pdo_query("DELETE FROM dailyupdate WHERE projectid='$cvsID'"))
37      {
38      $this->fail("pdo_query returned false");
39      return 1;
40      }
41    $svnID = get_project_id("EmailProjectExample");
42    if(!$query = pdo_query("DELETE FROM dailyupdate WHERE projectid='$svnID'"))
43      {
44      $this->fail("pdo_query returned false");
45      return 1;
46      }
47    $gitID = get_project_id("PublicDashboard");
48    if(!$query = pdo_query("DELETE FROM dailyupdate WHERE projectid='$gitID'"))
49      {
50      $this->fail("pdo_query returned false");
51      return 1;
52      }
53    $this->pass("Passed");
54    }
55}
56
57?>
58