Skip to content

Commit

Permalink
Update other tests referencing ConnectionManager.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 24, 2013
1 parent 1dc2960 commit d48c085
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
11 changes: 5 additions & 6 deletions lib/Cake/Console/Command/Task/DbConfigTask.php
Expand Up @@ -20,7 +20,7 @@

use Cake\Console\Shell;
use Cake\Core\Configure;
use Cake\Model\ConnectionManager;
use Cake\Database\ConnectionManager;

/**
* Task class for creating and updating the database configuration file.
Expand Down Expand Up @@ -346,16 +346,15 @@ public function bake($configs) {
* @return void
*/
public function getConfig() {
$configs = ConnectionManager::enumConnectionObjects();
$configs = ConnectionManager::configured();

$useDbConfig = key($configs);
$useDbConfig = current($configs);
if (!is_array($configs) || empty($configs)) {
return $this->execute();
}
$connections = array_keys($configs);

if (count($connections) > 1) {
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') . ':', $connections, $useDbConfig);
if (count($configs) > 1) {
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') . ':', $configs, $useDbConfig);
}
return $useDbConfig;
}
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/TestCase/Cache/CacheTest.php
Expand Up @@ -152,6 +152,7 @@ public static function configProvider() {
}],
];
}

/**
* testConfig method
*
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/TestCase/ORM/BufferedResultSetTest.php
Expand Up @@ -17,7 +17,7 @@
namespace Cake\Test\TestCase\ORM;

use Cake\Core\Configure;
use Cake\Model\ConnectionManager;
use Cake\Database\ConnectionManager;
use Cake\ORM\BufferedResultSet;
use Cake\ORM\Query;
use Cake\ORM\Table;
Expand All @@ -32,7 +32,7 @@ class BufferedResultSetTest extends TestCase {

public function setUp() {
parent::setUp();
$this->connection = ConnectionManager::getDataSource('test');
$this->connection = ConnectionManager::get('test');
$this->table = new Table(['table' => 'articles', 'connection' => $this->connection]);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/TestCase/ORM/QueryTest.php
Expand Up @@ -19,7 +19,7 @@
use Cake\Core\Configure;
use Cake\Database\Expression\OrderByExpression;
use Cake\Database\Expression\QueryExpression;
use Cake\Model\ConnectionManager;
use Cake\Database\ConnectionManager;
use Cake\ORM\Query;
use Cake\ORM\ResultSet;
use Cake\ORM\Table;
Expand All @@ -36,7 +36,7 @@ class QueryTest extends TestCase {

public function setUp() {
parent::setUp();
$this->connection = ConnectionManager::getDataSource('test');
$this->connection = ConnectionManager::get('test');
$schema = ['id' => ['type' => 'integer']];
$schema1 = [
'id' => ['type' => 'integer'],
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/TestCase/ORM/ResultSetTest.php
Expand Up @@ -17,7 +17,7 @@
namespace Cake\Test\TestCase\ORM;

use Cake\Core\Configure;
use Cake\Model\ConnectionManager;
use Cake\Database\ConnectionManager;
use Cake\ORM\Query;
use Cake\ORM\ResultSet;
use Cake\ORM\Table;
Expand All @@ -32,7 +32,7 @@ class ResultSetTest extends TestCase {

public function setUp() {
parent::setUp();
$this->connection = ConnectionManager::getDataSource('test');
$this->connection = ConnectionManager::get('test');
$this->table = new Table(['table' => 'articles', 'connection' => $this->connection]);

$this->fixtureData = [
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Test/TestCase/ORM/TableTest.php
Expand Up @@ -17,7 +17,7 @@
namespace Cake\Test\TestCase\ORM;

use Cake\Core\Configure;
use Cake\Model\ConnectionManager;
use Cake\Database\ConnectionManager;
use Cake\ORM\Table;

/**
Expand Down Expand Up @@ -58,7 +58,7 @@ class TableTest extends \Cake\TestSuite\TestCase {

public function setUp() {
parent::setUp();
$this->connection = ConnectionManager::getDataSource('test');
$this->connection = ConnectionManager::get('test');
}

public function tearDown() {
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/TestSuite/Fixture/FixtureManager.php
Expand Up @@ -232,7 +232,7 @@ public function unload(TestCase $test) {
$fixture = $this->_loaded[$f];
if (!empty($fixture->created)) {
foreach ($fixture->created as $ds) {
$db = ConnectionManager::getDataSource($ds);
$db = ConnectionManager::get($ds);
$fixture->truncate($db);
}
}
Expand All @@ -253,7 +253,7 @@ public function loadSingle($name, $db = null, $dropTables = true) {
if (isset($this->_fixtureMap[$name])) {
$fixture = $this->_fixtureMap[$name];
if (!$db) {
$db = ConnectionManager::getDataSource($fixture->connection);
$db = ConnectionManager::get($fixture->connection);
}
$this->_setupTable($fixture, $db, $dropTables);
$fixture->truncate($db);
Expand All @@ -278,7 +278,7 @@ public function shutDown() {
foreach ($this->_loaded as $fixture) {
if (!empty($fixture->created)) {
foreach ($fixture->created as $ds) {
$db = ConnectionManager::getDataSource($ds);
$db = ConnectionManager::get($ds);
$fixture->drop($db);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/TestSuite/Fixture/TestFixture.php
Expand Up @@ -17,11 +17,11 @@

use Cake\Core\App;
use Cake\Database\Connection;
use Cake\Database\ConnectionManager;
use Cake\Database\Schema\Collection as SchemaCollection;
use Cake\Database\Schema\Table;
use Cake\Error;
use Cake\Log\Log;
use Cake\Model\ConnectionManager;
use Cake\Utility\Hash;
use Cake\Utility\Inflector;

Expand Down Expand Up @@ -193,7 +193,7 @@ protected function _schemaFromImport() {
throw new Error\Exception(__d('cake_dev', 'Cannot import from undefined table.'));
}

$db = ConnectionManager::getDataSource($import['connection']);
$db = ConnectionManager::get($import['connection']);
$schemaCollection = $db->schemaCollection();
$table = $schemaCollection->describe($import['table']);
$this->_schema = $table;
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Utility/ClassRegistry.php
Expand Up @@ -17,7 +17,7 @@

use Cake\Core\App;
use Cake\Error;
use Cake\Model\ConnectionManager;
use Cake\Database\ConnectionManager;
use Cake\Model\Model;

/**
Expand Down Expand Up @@ -151,7 +151,7 @@ public static function init($class, $strict = false) {
if (isset($defaultProperties['useDbConfig'])) {
$useDbConfig = $defaultProperties['useDbConfig'];
if ($availableDs === null) {
$availableDs = array_keys(ConnectionManager::enumConnectionObjects());
$availableDs = ConnectionManager::configured();
}
if (in_array('test_' . $useDbConfig, $availableDs)) {
$useDbConfig = 'test_' . $useDbConfig;
Expand Down

0 comments on commit d48c085

Please sign in to comment.