当前位置: 首页>>代码示例>>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;未经允许,请勿转载。