當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConnectionManager::drop方法代碼示例

本文整理匯總了PHP中Cake\Datasource\ConnectionManager::drop方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConnectionManager::drop方法的具體用法?PHP ConnectionManager::drop怎麽用?PHP ConnectionManager::drop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Datasource\ConnectionManager的用法示例。


在下文中一共展示了ConnectionManager::drop方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tearDownAfterClass

 /**
  * Purge ConnectionManager configs.
  *
  * @return void
  */
 public static function tearDownAfterClass()
 {
     foreach (self::$datasources as $ds => $configs) {
         \Cake\Datasource\ConnectionManager::drop($ds);
     }
     \Cake\Utility\Security::salt('');
 }
開發者ID:loadsys,項目名稱:cakephp-basic-seed,代碼行數:12,代碼來源:BasicSeedShellTest.php

示例2: testJunctionConnection

 /**
  * Tests the junction passes the source connection name on.
  *
  * @return void
  */
 public function testJunctionConnection()
 {
     $mock = $this->getMockBuilder('Cake\\Database\\Connection')->setMethods(['driver'])->setConstructorArgs(['name' => 'other_source'])->getMock();
     ConnectionManager::config('other_source', $mock);
     $this->article->connection(ConnectionManager::get('other_source'));
     $assoc = new BelongsToMany('Test', ['sourceTable' => $this->article, 'targetTable' => $this->tag]);
     $junction = $assoc->junction();
     $this->assertSame($mock, $junction->connection());
     ConnectionManager::drop('other_source');
 }
開發者ID:rashmi,項目名稱:newrepo,代碼行數:15,代碼來源:BelongsToManyTest.php

示例3: tearDown

 public function tearDown()
 {
     ConnectionManager::drop('twitter');
     StreamWrapper::restoreWrapper('https');
 }
開發者ID:cvo-technologies,項目名稱:cakephp-twitter,代碼行數:5,代碼來源:StatusesEndpointTest.php

示例4: testDrop

 /**
  * Tests that a connection configuration can be deleted in runtime
  *
  * @return void
  */
 public function testDrop()
 {
     ConnectionManager::config('test_variant', ['className' => __NAMESPACE__ . '\\FakeConnection', 'database' => ':memory:']);
     $result = ConnectionManager::configured();
     $this->assertContains('test_variant', $result);
     $this->assertTrue(ConnectionManager::drop('test_variant'));
     $result = ConnectionManager::configured();
     $this->assertNotContains('test_variant', $result);
     $this->assertFalse(ConnectionManager::drop('probably_does_not_exist'), 'Should return false on failure.');
 }
開發者ID:maitrepylos,項目名稱:nazeweb,代碼行數:15,代碼來源:ConnectionManagerTest.php

示例5: putenv

<?php

/**
 * Test runner bootstrap.
 *
 * Add additional configuration/setup your application needs when running
 * unit tests in this file.
 */
use Cake\Datasource\ConnectionManager;
require 'test-app/config/bootstrap.php';
if (!getenv('db_dsn')) {
    putenv('db_dsn=sqlite:///:memory:');
}
ConnectionManager::drop('test');
ConnectionManager::config('test', ['url' => getenv('db_dsn')]);
開發者ID:xavier83ar,項目名稱:image-presenter,代碼行數:15,代碼來源:bootstrap.php

示例6: getConn

 /**
  * Generates a new connection to DB.
  *
  * @return \Cake\Database\Connection|bool A connection object, or false on
  *  failure. On failure error messages are automatically set
  */
 public function getConn()
 {
     if (!$this->config('connection.className')) {
         $this->error(__d('installer', 'Database engine cannot be empty.'));
         return false;
     }
     try {
         ConnectionManager::drop('installation');
         ConnectionManager::config('installation', $this->config('connection'));
         $conn = ConnectionManager::get('installation');
         $conn->connect();
         return $conn;
     } catch (\Exception $ex) {
         $this->error(__d('installer', 'Unable to connect to database, please check your information. Details: {0}', '<p>' . $ex->getMessage() . '</p>'));
         return false;
     }
 }
開發者ID:quickapps-plugins,項目名稱:installer,代碼行數:23,代碼來源:DatabaseInstaller.php

示例7: _dropTables

 /**
  * Removes all tables in current installation DB.
  *
  * @return void
  */
 protected function _dropTables()
 {
     // drop all tables
     ConnectionManager::drop('installation');
     ConnectionManager::config('installation', $this->_getConn());
     $db = ConnectionManager::get('installation');
     $db->connect();
     $tables = $db->schemaCollection()->listTables();
     foreach ($tables as $table) {
         $Table = TableRegistry::get($table, ['connection' => $db]);
         $schema = $Table->schema();
         $sql = $schema->dropSql($db);
         foreach ($sql as $stmt) {
             $db->execute($stmt)->closeCursor();
         }
     }
     unset($db);
     ConnectionManager::drop('installation');
 }
開發者ID:quickapps-plugins,項目名稱:installer,代碼行數:24,代碼來源:DatabaseInstallerTest.php

示例8: tearDown

 public function tearDown()
 {
     ConnectionManager::drop('twitter');
 }
開發者ID:cvo-technologies,項目名稱:cakephp-twitter,代碼行數:4,代碼來源:UsersEndpointTest.php


注:本文中的Cake\Datasource\ConnectionManager::drop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。