/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { Manager::addDefaultConnectionConfig('sqlite', ':memory:', null, null, '127.0.0.1', null, array(PDO::ATTR_PERSISTENT => true)); Manager::setModelPath(dirname(__FILE__) . '/_testdata/'); $storage = Manager::getStorage(); $storage->getConnection()->exec(file_get_contents(dirname(__FILE__) . '/_testdata/schema.sql')); $storage->getConnection()->exec(file_get_contents(dirname(__FILE__) . '/_testdata/fixture.sql')); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { if (extension_loaded('mongo')) { if (shell_exec('mongod --version | grep "db version"') == '') { $this->markTestSkipped('The mongod execuatable is not available.'); } } if (!extension_loaded('mongo')) { $this->markTestSkipped('The mongo extension is not available.'); } Manager::addDefaultConnectionConfig('mongodb', 'mongotest', null, null, '127.0.0.1', 27088); Manager::setModelPath(dirname(__FILE__) . '/_testdata/'); shell_exec('mongoimport --port 27088 --drop --db mongotest --collection users --file ' . dirname(__FILE__) . '/_testdata/fixture.json'); sleep(1); }
/** * Test * * @tests * * @return void */ public function defaultIsNotAddedToGlobalBeforeStorageIsRequested() { Manager::addDefaultConnectionConfig('sqlite', ':memory:'); $this->assertFalse(key_exists("TickConnection:default", $GLOBALS)); }