/** * 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 setAndGetExistingModelPathFails() { Manager::setModelPath("./"); $this->assertEquals("./", Manager::getModelPath("./")); }
/** * 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::setModelPath(dirname(__FILE__) . '/_testdata/'); $this->expected = array("properties" => array("id" => array("field" => "user_id", "type" => "integer", 'default' => null, "size" => 11, "unique" => true), "name" => array("field" => "full_name", "type" => "string", "size" => 255, "null" => true, "default" => "Jane"), "username" => array("field" => "email", "type" => "string", "size" => 128, "default" => "Doe Doe"), "created" => array("field" => "created", "type" => "DateTime", 'default' => null), "updated" => array("field" => "updated", "type" => "DateTime", 'default' => null, "null" => true)), "fields" => array("user_id" => array('property' => 'id', "field" => "user_id", "type" => "integer", "size" => 11, "unique" => true, 'default' => null), "full_name" => array('property' => 'name', "field" => "full_name", "type" => "string", "size" => 255, "null" => true, "default" => "Jane"), "email" => array('property' => 'username', "field" => "email", "type" => "string", "size" => 128, "default" => "Doe Doe"), "created" => array('property' => 'created', "field" => "created", "type" => "DateTime", 'default' => null), "updated" => array('property' => 'updated', "field" => "updated", "type" => "DateTime", "null" => true, 'default' => null))); }
/** * 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::setModelPath(dirname(__FILE__) . '/_testdata/'); }