本文整理汇总了PHP中ConnectionManager::drop方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionManager::drop方法的具体用法?PHP ConnectionManager::drop怎么用?PHP ConnectionManager::drop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionManager
的用法示例。
在下文中一共展示了ConnectionManager::drop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
function tearDown()
{
ConnectionManager::drop('testapi');
ConnectionManager::drop('testapiToken');
Configure::delete('Copula.testapi.Auth');
unset($this->controller, $this->Oauth);
parent::tearDown();
}
示例2: tearDown
function tearDown()
{
parent::tearDown();
Cache::clear(false, 'default');
ConnectionManager::drop('cacher');
unset($this->CacheData);
unset($this->dataSource);
}
示例3: tearDown
public function tearDown()
{
$manager = ConnectionManager::getDataSource('testMongoFixture')->getSchemaManager();
$manager->dropDocumentCollection('User');
$manager->dropDocumentCollection('Account');
App::build();
ClassRegistry::flush();
ConnectionManager::drop('testMongoFixture');
}
示例4: testGetTokenRefresh
public function testGetTokenRefresh()
{
$config = array('datasource' => 'Copula.RemoteTokenSource', 'login' => 'login', 'password' => 'password', 'authMethod' => 'OAuthV2', 'access' => 'token', 'scheme' => 'https', 'host' => 'accounts.example.com');
ConnectionManager::create('testapiToken', $config);
$testapi = ConnectionManager::getDataSource('testapiToken');
$testapi->Http = $this->getMock('HttpSocketOauth');
$refresh = new HttpSocketResponse();
$refresh->code = 200;
$body = array('access_token' => 'token', 'refresh_token' => 'refresh', 'expires_in' => '1234');
$refresh->body = json_encode($body);
$refresh->headers['Content-Type'] = 'application/json';
$request = array('method' => 'POST', 'uri' => array('host' => 'accounts.example.com', 'path' => 'token', 'scheme' => 'https'), 'body' => array('client_id' => 'login', 'client_secret' => 'password', 'grant_type' => 'refresh_token', 'refresh_token' => 'canHasRefresh'));
$testapi->Http->expects($this->once())->method('request')->will($this->returnValueMap(array(array($request, $refresh))));
$token = $this->tokenV2;
$token['modified'] = '1970-01-01 00:00:00';
CakeSession::write('Copula.testapi.42', $token);
$result = $this->Token->getToken('42', 'testapi');
$expected = array_merge($token, $body);
$this->assertEquals($expected, $result);
ConnectionManager::drop('testapiToken');
}
示例5: testModelPrefixFromDatasource
/**
* Tests that tablePrefix is taken from the datasource if none is defined in the model
*
* @return void
* @see http://cakephp.lighthouseapp.com/projects/42648/tickets/2277-caketestmodels-in-test-cases-do-not-set-model-tableprefix
*/
public function testModelPrefixFromDatasource()
{
ConnectionManager::create('mock', array('datasource' => 'DboMock', 'prefix' => 'custom_prefix_'));
$Article = new Article(false, null, 'mock');
$this->assertEquals('custom_prefix_', $Article->tablePrefix);
ConnectionManager::drop('mock');
}
示例6: testGetMockForModelSecondaryDatasource
/**
* Test getMockForModel on secondary datasources.
*
* @return void
*/
public function testGetMockForModelSecondaryDatasource()
{
App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'Model/Datasource/Database' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS . 'Database' . DS)), App::RESET);
CakePlugin::load('TestPlugin');
ConnectionManager::create('test_secondary', array('datasource' => 'Database/TestLocalDriver'));
$post = $this->getMockForModel('SecondaryPost', array('save'));
$this->assertEquals('test_secondary', $post->useDbConfig);
ConnectionManager::drop('test_secondary');
}
示例7: tearDown
public function tearDown()
{
ConnectionManager::drop('testapi');
unset($this->components, $this->auth, $this->request);
parent::tearDown();
}
示例8: testDrop
/**
* Tests that a connection configuration can be deleted in runtime
*
* @return void
*/
public function testDrop()
{
App::build(array('Model/Datasource' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS)));
ConnectionManager::create('droppable', array('datasource' => 'Test2Source'));
$connections = ConnectionManager::enumConnectionObjects();
$this->assertEquals(array('datasource' => 'Test2Source'), $connections['droppable']);
$this->assertTrue(ConnectionManager::drop('droppable'));
$connections = ConnectionManager::enumConnectionObjects();
$this->assertFalse(isset($connections['droppable']));
}
示例9: tearDownAfterClass
public static function tearDownAfterClass()
{
ConnectionManager::drop('test_twitter_app');
ConnectionManager::drop('test_twitter2');
parent::tearDownAfterClass();
}
示例10: tearDownAfterClass
static function tearDownAfterClass()
{
ConnectionManager::drop('test_twitter_component');
ConnectionManager::drop('fake_twitter');
}
示例11: tearDown
public function tearDown()
{
ConnectionManager::drop('testapi');
unset($this->Source, $this->Model);
parent::tearDown();
}
示例12: __testDbConnection
/**
* Test the two db connections 'default', and 'test' using the passed db config params
*
* @access private
* @param array $dbConfig
* @param array $connectionName name of the database we are trying to connect to
* @return array
*/
private function __testDbConnection($dbConfig, $connectionName)
{
$connected = false;
try {
$this->out("Trying '{$connectionName}' database connection");
ConnectionManager::create($connectionName, $dbConfig);
$this->out("++ Successfully connected to database using entered connection parameters");
$connected = true;
} catch(MissingConnectionException $ex) {
ConnectionManager::drop($connectionName);
$this->out("** ERROR ** '" . ucfirst($connectionName) . "' database connection parameters failed");
}
return $connected;
}
示例13: tearDown
public function tearDown()
{
parent::tearDown();
ConnectionManager::drop($this->testDatasourceName);
ConnectionManager::drop($this->mockDatasourceName);
}
示例14: tearDown
public function tearDown()
{
ConnectionManager::drop('testapi');
unset($this->model, $this->Apis);
ClassRegistry::flush();
parent::tearDown();
}
示例15: testSchemaReadWithAppModel
/**
* testSchemaReadWithAppModel method
*
* @return void
*/
public function testSchemaReadWithAppModel()
{
$connections = ConnectionManager::enumConnectionObjects();
ConnectionManager::drop('default');
ConnectionManager::create('default', $connections['test']);
try {
$this->Schema->read(array('connection' => 'default', 'name' => 'TestApp', 'models' => array('AppModel')));
} catch (MissingTableException $mte) {
ConnectionManager::drop('default');
$this->fail($mte->getMessage());
}
ConnectionManager::drop('default');
}