示例#1
0
 /**
  * Get storage
  *
  * @return Storage
  */
 public function getStorage()
 {
     if (!$this->storage instanceof Storage) {
         $this->storage = Manager::getStorage($this->getConnectionName());
     }
     return $this->storage;
 }
示例#2
0
 /**
  * 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'));
 }
示例#3
0
 /**
  * Test
  *
  * @test
  *
  * @return void
  */
 public function getConnection()
 {
     $this->assertTrue(Manager::getStorage() instanceof Storage);
     $this->assertTrue(Manager::getStorage() instanceof MongoStorage);
 }
示例#4
0
 /**
  * Test
  *
  * @tests
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function throwsExceptionOnWrongName()
 {
     Manager::getStorage("qwe");
 }