Skip to content

Commit

Permalink
Migrated ConnectionManager to phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Jun 5, 2010
1 parent 7aa01c4 commit fd4db41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo/dbo_mssql.php
Expand Up @@ -701,7 +701,7 @@ function fetchResult() {
* @param string $fields
* @param array $values
*/
protected function insertMulti($table, $fields, $values) {
public function insertMulti($table, $fields, $values) {
$primaryKey = $this->_getPrimaryKey($table);
$hasPrimaryKey = $primaryKey != null && (
(is_array($fields) && in_array($primaryKey, $fields)
Expand Down
12 changes: 6 additions & 6 deletions cake/tests/cases/libs/model/connection_manager.test.php
Expand Up @@ -34,7 +34,7 @@ class ConnectionManagerTest extends CakeTestCase {
* @return void
*/
function setUp() {
$this->ConnectionManager =& ConnectionManager::getInstance();
$this->ConnectionManager = ConnectionManager::getInstance();
}

/**
Expand Down Expand Up @@ -79,12 +79,12 @@ function testEnumConnectionObjects() {
*/
function testGetDataSource() {
$connections = ConnectionManager::enumConnectionObjects();
$this->assertTrue(count(array_keys($connections) >= 1));
$this->assertTrue((bool)(count(array_keys($connections) >= 1)));

$source = ConnectionManager::getDataSource(key($connections));
$this->assertTrue(is_object($source));

$this->expectError(new PatternExpectation('/Non-existent data source/i'));
$this->expectError();

$source = ConnectionManager::getDataSource('non_existent_source');
$this->assertEqual($source, null);
Expand Down Expand Up @@ -212,7 +212,7 @@ function testGetSourceName() {

$this->assertEqual($result, $name);

$source =& new StdClass();
$source = new StdClass();
$result = ConnectionManager::getSourceName($source);
$this->assertEqual($result, null);
}
Expand All @@ -238,7 +238,7 @@ function testLoadDataSource() {
}

$connection = array('classname' => 'NonExistentDataSource', 'filename' => 'non_existent');
$this->expectError(new PatternExpectation('/Unable to import DataSource class/i'));
$this->expectError();

$loaded = ConnectionManager::loadDataSource($connection);
$this->assertEqual($loaded, null);
Expand All @@ -254,7 +254,7 @@ function testCreateDataSourceWithIntegrationTests() {
$name = 'test_created_connection';

$connections = ConnectionManager::enumConnectionObjects();
$this->assertTrue(count(array_keys($connections) >= 1));
$this->assertTrue((bool)(count(array_keys($connections) >= 1)));

$source = ConnectionManager::getDataSource(key($connections));
$this->assertTrue(is_object($source));
Expand Down

0 comments on commit fd4db41

Please sign in to comment.