示例#1
0
 /**
  * Checks if all expected parameters and only these are set
  *
  * @param string[] $expectedAnnotations
  * @param ezcReflectionAnnotation[] $annotations
  * @param ezcTestCase $test
  */
 public static function expectedParams($expectedParams, $params, $test)
 {
     foreach ($params as $param) {
         $test->assertType('ezcReflectionParameter', $param);
         $test->assertContains($param->getName(), $expectedParams);
         self::deleteFromArray($param->getName(), $expectedParams);
     }
     $test->assertEquals(0, count($expectedParams));
 }
 public function setUp()
 {
     parent::setUp();
     if (version_compare(phpversion(), '5.1.3', '<')) {
         $this->markTestSkipped("These tests required atleast PHP 5.1.3");
     }
 }
示例#3
0
 public function _checkInvariant($functionName, $parameters)
 {
     $parameterText = "";
     foreach ($parameters as $key => $parameter) {
         if ($key > 0) {
             $parameterText .= ",";
         }
         $parameterText .= str_replace(array("\r", "\n", "\t"), array("\\r", "\\n", "\\t"), var_export($parameter, true));
     }
     ezcTestCase::assertTrue($this->receiver->line >= 1, "Invariant <{$functionName}({$parameterText})>: Property <line> should not be less than 1, was <" . $this->receiver->line . ">");
     ezcTestCase::assertTrue($this->receiver->column >= 0, "Invariant <{$functionName}({$parameterText})>: Property <column> should not be less than 0, was <" . $this->receiver->column . ">");
     ezcTestCase::assertTrue($this->receiver->position >= 0, "Invariant <{$functionName}({$parameterText})>: Property <position> should not be less than 0, was <" . $this->receiver->position . ">");
     ezcTestCase::assertTrue($this->receiver->position <= strlen($this->receiver->text), "Invariant <{$functionName}({$parameterText})>: Property <position> should not be larger than the text length <" . strlen($this->receiver->text) . ">, was <<" . $this->receiver->position . ">");
     // Check if position, line and column are coherent
     $lines = preg_split("#\r\n|\r|\n#", substr($this->receiver->text, 0, $this->receiver->position));
     if (count($lines) > 0) {
         $endLine = 1 + count($lines) - 1;
         $lastLine = $lines[count($lines) - 1];
         $endColumn = strlen($lastLine);
     } else {
         $endLine = 1;
         $endColumn = 0;
     }
     ezcTestCase::assertSame($endLine, $this->receiver->line, "Invariant <{$functionName}({$parameterText})>: Property <line> does not correlate with the calculated line number (from <position>).");
     ezcTestCase::assertSame($endColumn, $this->receiver->column, "Invariant <{$functionName}({$parameterText})>: Property <line> does not correlate with the calculated line number (from <position>).");
 }
示例#4
0
 public function __construct($id, ezcwebdavClientTestSetup $setup, array $testData)
 {
     parent::__construct(sprintf('%s %s', $id, $testData['request']['server']['REQUEST_METHOD']));
     $this->id = $id;
     $this->testData = $testData;
     $this->setup = $setup;
 }
示例#5
0
文件: log_test.php 项目: bmdevel/ezc
 public function __construct($string = "")
 {
     parent::__construct($string);
     // These instances yield for all these tests.
     // $this->log = ezcLog::getInstance();
     date_default_timezone_set("UTC");
 }
示例#6
0
 public function setUp()
 {
     parent::setUp();
     if (version_compare(phpversion(), '5.1.3', '<')) {
         $this->markTestSkipped("This test requires PHP 5.1.3 or later.");
     }
 }
示例#7
0
 protected function setUp()
 {
     parent::setUp();
     $this->xmlStorage = new ezcWorkflowDefinitionStorageXml(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR);
     if (!class_exists('ServiceObject', false)) {
         $this->getMock('ezcWorkflowServiceObject', array(), array(), 'ServiceObject');
     }
 }
 public function __construct()
 {
     if (self::SORT_MODE === 'mtime') {
         // Sort by modification time to get updated tests first
         usort($this->files, array($this, 'sortTestsByMtime'));
     } else {
         // Sort it, then the file a.in will be processed first. Handy for development.
         usort($this->files, array($this, 'sortTestsByName'));
     }
     parent::__construct();
 }
示例#9
0
 /**
  * Runs the bare test sequence.
  *
  * @access public
  */
 public function runBare()
 {
     // Backup server array if requested
     if ($this->backupServerArray) {
         $serverBackup = $_SERVER;
     }
     // Run original test method
     parent::runBare();
     // Restore server array
     if ($this->backupServerArray) {
         $_SERVER = $serverBackup;
     }
 }
示例#10
0
 public function __construct()
 {
     parent::__construct();
     // Initialize directory to store backend dumps in
     if (self::STORE_BACKEND && self::$backendDir === null) {
         self::$backendDir = $this->createTempDir('WebdavBackendDump');
     }
     $this->setupTestEnvironment();
     // Reset the backend at start of the suite
     foreach (glob($this->dataDir . '/*request_server.php') as $testSetFile) {
         $this->testSets[] = substr($testSetFile, 0, -19);
     }
 }
示例#11
0
 public function __construct()
 {
     parent::__construct();
     $this->regressionDir = dirname(__FILE__) . "/regression_tests";
     $directories = array();
     $this->readDirRecursively($this->regressionDir, $directories, "in");
     if (isset($_ENV['EZC_TEST_TEMPLATE_SORT']) && $_ENV['EZC_TEST_TEMPLATE_SORT'] == 'mtime') {
         // Sort by modification time to get updated tests first
         usort($directories, array($this, 'sortTestsByMtime'));
     } else {
         // Sort it, then the file a.in will be processed first. Handy for development.
         usort($directories, array($this, 'sortTestsByName'));
     }
     $this->directories = $directories;
     // Check for environment variables which turns on special features
     if (isset($_ENV['EZC_TEST_INTERACTIVE'])) {
         $this->interactiveMode = (bool) $_ENV['EZC_TEST_INTERACTIVE'];
     }
 }
示例#12
0
 public function tearDown()
 {
     // Reset old timezone
     date_default_timezone_set($this->oldTimezone);
     if (!$this->hasFailed() || self::KEEP_TEMP_DIR === false) {
         $this->removeTempDir();
     }
     parent::tearDown();
 }
示例#13
0
 protected function tearDown()
 {
     ezcWebdavServer::getInstance()->reset();
     parent::tearDown();
 }