Пример #1
0
 public function tearDown()
 {
     unset($this->query);
     Connections::reset();
     $this->db->dropDB('lithium_test');
     Connections::config($this->_configs);
 }
Пример #2
0
 /**
  * Teardown method run after every test method.
  */
 public function tearDown()
 {
     Connections::reset();
     foreach ($this->_backup as $name => $config) {
         Connections::add($name, $config);
     }
 }
 public function testConnectionGetAndReset()
 {
     Connections::add('conn-test', $this->config);
     Connections::add('conn-test-2', $this->config);
     $this->assertEqual(array('conn-test', 'conn-test-2'), Connections::get());
     $expected = $this->config + array('type' => 'database', 'filters' => array());
     $this->assertEqual($expected, Connections::get('conn-test', array('config' => true)));
     $this->assertNull(Connections::reset());
     $this->assertFalse(Connections::get());
     Connections::__init();
     $this->assertTrue(is_array(Connections::get()));
 }
Пример #4
0
 public function setUp()
 {
     if (empty($this->_backup)) {
         foreach (Connections::get() as $conn) {
             $this->_backup[$conn] = Connections::get($conn, array('config' => true));
         }
     }
     Connections::reset();
     Connections::add('mongo', array('type' => 'MongoDb', 'autoConnect' => false));
     Connections::add('couch', array('type' => 'http', 'adapter' => 'CouchDb'));
     MockDocumentPost::config(array('connection' => 'mongo'));
     MockDocumentMultipleKey::config(array('connection' => 'couch'));
 }
Пример #5
0
 public function testConnectionGetAndReset()
 {
     Connections::add('conn-test', $this->config);
     Connections::add('conn-test-2', $this->config);
     $this->assertEqual(array('conn-test', 'conn-test-2'), Connections::get());
     $message = 'Your PHP was not compiled with the MySQL extension';
     $this->skipIf(!extension_loaded('mysql'), $message);
     $expected = $this->config + array('type' => 'database', 'filters' => array());
     $this->assertEqual($expected, Connections::get('conn-test', array('config' => true)));
     $this->assertNull(Connections::reset());
     $this->assertFalse(Connections::get());
     $this->assertTrue(is_array(Connections::get()));
 }
Пример #6
0
 /**
  * This hack is a necessary optimization until these tests are properly mocked out.
  *
  * @param array $options Options for the parent class' method.
  */
 public function run(array $options = array())
 {
     $this->_results = array();
     try {
         $this->skip();
     } catch (Exception $e) {
         $this->_handleException($e);
         return $this->_results;
     }
     $this->_configs = Connections::config();
     $result = parent::run($options);
     Connections::get('lithium_mongo_test')->dropDB('lithium_test');
     Connections::reset();
     Connections::config($this->_configs);
     return $result;
 }
 public function testGetNullAdapter()
 {
     Connections::reset();
     $this->assertTrue(Connections::get(false) instanceof Mock);
 }
Пример #8
0
 public function testGetNullAdapter()
 {
     Connections::reset();
     $this->assertInstanceOf('lithium\\data\\source\\Mock', Connections::get(false));
 }
Пример #9
0
 public function tearDown()
 {
     Connections::reset();
     Connections::config($this->_configs);
 }
Пример #10
0
 public function tearDown()
 {
     Connections::reset();
     Connections::config($this->_backup['connections']);
 }