Inheritance: extends lithium\test\Integration
Exemple #1
0
 /**
  * Skip the test if no test database connection available.
  */
 public function skip()
 {
     parent::connect($this->_connection);
     if (!class_exists('li3_fixtures\\test\\Fixtures')) {
         $this->skipIf(true, 'Need `li3_fixtures` to run tests.');
     }
 }
Exemple #2
0
 /**
  * Skip the test if no test database connection available.
  */
 public function skip()
 {
     parent::connect($this->_connection);
     if (!class_exists('li3_fixtures\\test\\Fixtures')) {
         $this->skipIf(true, "These tests need `'li3_fixtures'` to be runned.");
     }
 }
Exemple #3
0
 /**
  * Skip the test if no allowed database connection available.
  */
 public function skip()
 {
     parent::connect($this->_connection);
     if (!class_exists('li3_fixtures\\test\\Fixtures')) {
         $this->skipIf(true, "These tests need `'li3_fixtures'` to be runned.");
     }
     $this->skipIf(!$this->with(array('MySql', 'PostgreSql', 'Sqlite3')));
     $this->_export = Libraries::path('lithium\\tests\\fixture\\model\\gallery\\export', array('dirs' => true));
 }
Exemple #4
0
 /**
  * Skip the test if no allowed database connection available.
  */
 public function skip()
 {
     parent::connect($this->_connection);
     $this->skipIf(!$this->with(array('MongoDb', 'CouchDb')));
 }
Exemple #5
0
 /**
  * Skip the test if a MySQL adapter configuration is unavailable.
  *
  * @todo Tie into the Environment class to ensure that the test database is being used.
  */
 public function skip()
 {
     parent::connect($this->_connection);
     $this->skipIf(!$this->with(array('MySql', 'PostgreSql', 'Sqlite3')));
 }
Exemple #6
0
 /**
  * Prove that two distinct models each having a different connection to a different
  * database are working independently upon the correct databases.
  */
 public function testSwitchingDatabaseDistinctModels()
 {
     $connection1 = $this->_connection;
     $connection2 = $this->_connection . '_alternative';
     $connectionConfig1 = Connections::get($connection1, array('config' => true));
     $connectionConfig2 = Connections::get($connection2, array('config' => true));
     parent::connect($connection2);
     $this->skipIf(!$connectionConfig2, "The `'{$connection2}' connection is not available`.");
     $this->skipIf(!$this->with(array('MySql', 'PostgreSql', 'Sqlite3')));
     $bothInMemory = $connectionConfig1['database'] == ':memory:';
     $bothInMemory = $bothInMemory && $connectionConfig2['database'] == ':memory:';
     $this->skipIf($bothInMemory, 'Cannot use two connections with in memory databases');
     Fixtures::save('db_alternative');
     Galleries::config(array('meta' => array('connection' => $connection1)));
     Images::config(array('meta' => array('connection' => $connection1)));
     $galleriesCountOriginal = Galleries::find('count');
     $imagesCountOriginal = Images::find('count');
     $gallery = Galleries::create(array('name' => 'record_in_db'));
     $gallery->save();
     $image = Images::find('first', array('conditions' => array('id' => 1)));
     $image->delete();
     Galleries::config(array('meta' => array('connection' => $connection2)));
     $expected = $galleriesCountOriginal;
     $result = Galleries::find('count');
     $this->assertEqual($expected, $result);
     $expected = $imagesCountOriginal - 1;
     $result = Images::find('count');
     $this->assertEqual($expected, $result);
     Fixtures::clear('db_alternative');
 }
Exemple #7
0
 /**
  * Skip the test if a MySQL adapter configuration is unavailable.
  */
 public function skip()
 {
     parent::connect($this->_connection);
     $this->skipIf(!$this->with(array('MySql')));
 }