Inheritance: extends PHPUnit_Framework_TestCase
Esempio n. 1
0
 protected function setUp()
 {
     self::$orig_config = Config::$inst;
     $this->config = new Config();
     $this->config->setConfig(self::$test_config);
     Config::$inst = $this->config;
 }
 function checkPaths()
 {
     $version = explode('.', PHP_VERSION);
     $phptag = "php" . $version[0];
     self::$phptag = "php" . $version[0];
     self::$result1dir = "test-suite" . DIRECTORY_SEPARATOR . "results1-{$phptag}";
     self::$result2dir = "test-suite" . DIRECTORY_SEPARATOR . "results2-{$phptag}";
     self::$diffdir = "test-suite" . DIRECTORY_SEPARATOR . "diffs";
     self::$testdir = "test-suite" . DIRECTORY_SEPARATOR . "tests";
     self::$referencedir = "test-suite" . DIRECTORY_SEPARATOR . "references";
     if (!file_exists(self::$result1dir)) {
         mkdir(self::$result1dir);
     }
     if (!file_exists(self::$result2dir)) {
         mkdir(self::$result2dir);
     }
     if (!file_exists(self::$diffdir)) {
         mkdir(self::$diffdir);
     }
     self::$compare = null;
     // NOTE: This path will change between systems...
     $compares = array("/usr/bin/compare", "/usr/local/bin/compare", "test-suite" . DIRECTORY_SEPARATOR . "tools" . DIRECTORY_SEPARATOR . "compare.exe");
     foreach ($compares as $c) {
         if (file_exists($c) and is_executable($c)) {
             self::$compare = $c;
             break;
         }
     }
     if (!file_exists(self::$compare)) {
         throw new Exception("Compare path doesn't exist (or isn't executable) - do you have Imagemagick? \n");
     }
 }
 public function testSetOptionsWithOverride()
 {
     $configTest = new ConfigTest();
     $configTest->setOptions(array('option2' => 2, 'option3' => 3), true);
     $this->assertEquals(array('option2' => 2, 'option3' => 3), $configTest->getOptions());
 }
Esempio n. 4
0
 /**
  * Executed before each test.
  */
 public function setUp()
 {
     self::$_configFields = array('login' => 'login', 'hash' => 'hash', 'salt' => 'salt', 'timezone' => 'Europe/Paris', 'title' => 'title', 'titleLink' => 'titleLink', 'redirector' => '', 'disablesessionprotection' => false, 'privateLinkByDefault' => false, 'config' => array('CONFIG_FILE' => 'tests/config.php', 'DATADIR' => 'tests', 'config1' => 'config1data', 'config2' => 'config2data'));
 }
Esempio n. 5
0
        } else {
            $this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = 'Yes' WHERE `key` = 'timesheet_period_set'"));
        }
        $this->assertTrue(Config::getTimePeriodSet());
        $this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = 'No' WHERE `key` = 'timesheet_period_set'"));
        $this->assertFalse(Config::getTimePeriodSet());
    }
    public function testSetLeaveBroughtForward()
    {
        Config::setLeaveBroughtForward(date('Y'));
        $result = mysql_query("SELECT `key`, `value` FROM `hs_hr_config` WHERE `key` = 'LeaveBroughtForward" . date('Y') . "'");
        $row = mysql_fetch_array($result);
        $this->assertEquals("LeaveBroughtForward" . date('Y'), $row['key'], "Key is incorrect");
        $this->assertEquals("set", $row['value'], "Value is incorrect");
        // Setting LeaveBroughtForward should not be allowed more than once
        try {
            Config::setLeaveBroughtForward(date('Y'));
            $this->fail("Setting LeaveBroughtForward is allowed more than once");
        } catch (Exception $e) {
        }
    }
    public function testGetLeaveBroughtForward()
    {
        $this->assertTrue(Config::getLeaveBroughtForward(date('Y') + 1));
        $this->assertFalse(Config::getLeaveBroughtForward('4000'));
    }
}
// Call ConfigTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == 'ConfigTest::main') {
    ConfigTest::main();
}
Esempio n. 6
0
 public static function setUpBeforeClass()
 {
     self::$climate = new \League\CLImate\CLImate();
     self::$command = new \NHL\Command(self::$climate);
     self::$command->config = new \NHL\Config(__DIR__ . DIRECTORY_SEPARATOR . 'test.ini');
 }
Esempio n. 7
0
<?php

require_once '../conf/config.php';
//加入一个调试开关
if (array_key_exists('debug', $_GET)) {
    ConfigTest::$DEBUG = true;
}
if (!ConfigTest::$DEBUG) {
    header("Content-type: text/javascript; charset=utf-8");
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
}
/*
 * Tangram
 * Copyright 2009 Baidu Inc. All rights reserved.
 *
 * path: import.php
 * author: berg
 * version: 1.0
 * date: 2010/07/18 23:57:52
 *
 * @fileoverview * import.js的php版本
 * 接受一个f参数,格式和import.js相同,自动合并js并输出
 * 此外,本脚本支持引入一个包所有文件(其实也就是一个目录下的所有js文件,**不递归**)
 * IE下,get请求不能超过2083字节,请注意。
 */
$cov = array_key_exists('cov', $_GET) ? $_GET['cov'] : false;
$f = explode(',', $_GET['f']);
//explode() 函数把字符串分割为数组,此处$f=baidu.ajax.form
$e = array_key_exists('e', $_GET) && $_GET['e'] != '' ? explode(",", $_GET['e']) : array();
require_once dirname(__FILE__) . '/analysis.php';