/** * 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"); } }
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>)."); }
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; }
public function __construct($string = "") { parent::__construct($string); // These instances yield for all these tests. // $this->log = ezcLog::getInstance(); date_default_timezone_set("UTC"); }
public function setUp() { parent::setUp(); if (version_compare(phpversion(), '5.1.3', '<')) { $this->markTestSkipped("This test requires PHP 5.1.3 or later."); } }
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(); }
/** * 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; } }
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); } }
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']; } }
public function tearDown() { // Reset old timezone date_default_timezone_set($this->oldTimezone); if (!$this->hasFailed() || self::KEEP_TEMP_DIR === false) { $this->removeTempDir(); } parent::tearDown(); }
protected function tearDown() { ezcWebdavServer::getInstance()->reset(); parent::tearDown(); }