コード例 #1
0
 /**
  * @covers ::getConnection
  * @covers ::clearConnection
  * @covers ::createConnection
  */
 public function testGetInvalidConnection()
 {
     ConnectionManager::clearConnection();
     Utilities::injectDatabaseConfiguration();
     Configuration::set('database_driver', null);
     // Try to make connection now, with no configurations
     try {
         ConnectionManager::getConnection();
         $this->assertTrue(false);
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
     // Again with no host
     ConnectionManager::clearConnection();
     Utilities::injectDatabaseConfiguration();
     Configuration::set('database_host', null);
     // Try to make connection now, with no configurations
     try {
         ConnectionManager::getConnection();
         $this->assertTrue(false);
     } catch (\Exception $e) {
         $this->assertTrue(true);
     }
 }
コード例 #2
0
ファイル: EntityTest.php プロジェクト: tomvlk/sweet-orm
 public function setUp()
 {
     // Prepare by injecting configuration
     ConnectionManager::clearConnection();
     Utilities::injectDatabaseConfiguration();
 }