public static function getInstance() { if (null === self::$instance) { self::$instance = new ImplementationLoader(); } return self::$instance; }
protected function getLoader() { if ($this->loader) { return $this->loader; } $this->loader = \ImplementationLoader::getInstance(); return $this->loader; }
public static function getInstance() { if (null === self::$instance) { global $dbConn; $fixturePath = realpath(__DIR__ . '/fixtures/doctrine'); self::$instance = new ImplementationLoader($dbConn, $fixturePath); } return self::$instance; }
public function import($fixtureName, $workspace = null) { $fixture = $this->fixturePath . DIRECTORY_SEPARATOR . $fixtureName . '.xml'; $this->setDataSet(new \PHPUnit_Extensions_Database_DataSet_XmlDataSet($fixture)); if ($workspace) { $dataSet = $this->getDataSet(); // TODO: ugly hack, since we only really ever load a 2nd fixture in combination with '10_Writing/copy.xml' $fixture = $this->fixturePath . DIRECTORY_SEPARATOR . '10_Writing/copy.xml'; $this->setDataSet(new \PHPUnit_Extensions_Database_DataSet_XmlDataSet($fixture)); $loader = \ImplementationLoader::getInstance(); $workspaceName = $loader->getOtherWorkspaceName(); $this->dataSet->getTable('phpcr_workspaces')->addRow(array('name' => $workspaceName)); foreach (array('phpcr_nodes', 'phpcr_binarydata') as $tableName) { $table = $dataSet->getTable($tableName); $targetTable = $this->dataSet->getTable($tableName); for ($i = 0; $i < $table->getRowCount(); $i++) { $row = $table->getRow($i); $row['workspace_name'] = $workspaceName; $targetTable->addRow($row); } } } $this->onSetUp(); }
protected function getTransport() { $transport = new \Jackalope\Transport\Jackrabbit\Client(new \Jackalope\Factory(), $GLOBALS['jackrabbit.uri']); $transport->login(self::$loader->getCredentials(), self::$loader->getWorkspaceName()); return $transport; }
/** * we use this place to fetch a session and possibly load fixtures. * * this speeds up the tests considerably as fixture loading can be * quite expensive * * @param string $fixtures the fixtures name to import, defaults to * general/base. if you want to load fixtures yourself, send false * * @see initProperties() */ public static function setupBeforeClass($fixtures = 'general/base') { self::$loader = \ImplementationLoader::getInstance(); $fqn = get_called_class(); list($phpcr, $tests, $chapter, $case) = explode('\\', $fqn); $case = "{$chapter}\\{$case}"; if (!self::$loader->getTestSupported($chapter, $case, null)) { throw new \PHPUnit_Framework_SkippedTestSuiteError('Test case not supported by this implementation'); } self::$staticSharedFixture = array(); date_default_timezone_set('Europe/Zurich'); //TODO put this here? self::$staticSharedFixture['ie'] = self::$loader->getFixtureLoader(); if ($fixtures) { self::$staticSharedFixture['ie']->import($fixtures); } // only load sessions once fixtures have been imported (relevant i.e. for jackalope-doctrine-dbal) self::$staticSharedFixture['session'] = self::$loader->getSession(); self::$staticSharedFixture['additionalSession'] = self::$loader->getAdditionalSession(); }