mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
cleaning up some tests, adding missing parameters in DboSource to match declaration on DataSource
This commit is contained in:
parent
9caba98780
commit
47c6132b24
6 changed files with 24 additions and 24 deletions
|
@ -263,7 +263,7 @@ class DataSource extends Object {
|
|||
* @param Model $model
|
||||
* @return array Array of Metadata for the $model
|
||||
*/
|
||||
public function describe(&$model) {
|
||||
public function describe($model) {
|
||||
if ($this->cacheSources === false) {
|
||||
return null;
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ class DataSource extends Object {
|
|||
* @param string $key Key name to make
|
||||
* @return string Key name for model.
|
||||
*/
|
||||
public function resolveKey(&$model, $key) {
|
||||
public function resolveKey($model, $key) {
|
||||
return $model->alias . $key;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ class DboMysql extends DboSource {
|
|||
*
|
||||
* @return array Array of tablenames in the database
|
||||
*/
|
||||
function listSources() {
|
||||
function listSources($data = null) {
|
||||
$cache = parent::listSources();
|
||||
if ($cache != null) {
|
||||
return $cache;
|
||||
|
|
|
@ -362,7 +362,7 @@ class DboSource extends DataSource {
|
|||
*
|
||||
* @return integer Number of affected rows
|
||||
*/
|
||||
function lastAffected() {
|
||||
function lastAffected($source = null) {
|
||||
if ($this->hasResult()) {
|
||||
return $this->_result->rowCount();
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ class DboSource extends DataSource {
|
|||
*
|
||||
* @return integer Number of rows in resultset
|
||||
*/
|
||||
function lastNumRows() {
|
||||
function lastNumRows($source = null) {
|
||||
if ($this->hasResult()) {
|
||||
$i = 0;
|
||||
foreach ($this->_result as $row) {
|
||||
|
|
|
@ -650,7 +650,7 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'field_two' => array('type' => 'string', 'null' => false, 'length' => 50),
|
||||
)
|
||||
));
|
||||
$result = $this->db->alterSchema($schema2->compare($schema1));
|
||||
$result = $this->Dbo->alterSchema($schema2->compare($schema1));
|
||||
$this->assertEqual(2, substr_count($result, 'field_two'), 'Too many fields');
|
||||
}
|
||||
|
||||
|
@ -728,8 +728,8 @@ class DboMysqlTest extends CakeTestCase {
|
|||
'other__field' => 'SUM(id)'
|
||||
);
|
||||
|
||||
$this->db->virtualFieldSeparator = '_$_';
|
||||
$result = $this->db->fields($model, null, array('data', 'other__field'));
|
||||
$this->Dbo->virtualFieldSeparator = '_$_';
|
||||
$result = $this->Dbo->fields($model, null, array('data', 'other__field'));
|
||||
$expected = array('`BinaryTest`.`data`', '(SUM(id)) AS `BinaryTest_$_other__field`');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
@ -759,10 +759,10 @@ class DboMysqlTest extends CakeTestCase {
|
|||
)
|
||||
));
|
||||
|
||||
$this->db->execute($this->db->createSchema($schema));
|
||||
$this->Dbo->execute($this->Dbo->createSchema($schema));
|
||||
$model = new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes'));
|
||||
$result = $this->db->describe($model);
|
||||
$this->db->execute($this->db->dropSchema($schema));
|
||||
$result = $this->Dbo->describe($model);
|
||||
$this->Dbo->execute($this->Dbo->dropSchema($schema));
|
||||
|
||||
$this->assertEqual($result['stringy']['collate'], 'cp1250_general_ci');
|
||||
$this->assertEqual($result['stringy']['charset'], 'cp1250');
|
||||
|
|
|
@ -807,7 +807,7 @@ class DboPostgresTest extends CakeTestCase {
|
|||
*/
|
||||
function testUpdateAllWithNonQualifiedConditions() {
|
||||
$this->loadFixtures('Article');
|
||||
$Article =& new Article();
|
||||
$Article = new Article();
|
||||
$result = $Article->updateAll(array('title' => "'Awesome'"), array('title' => 'Third Article'));
|
||||
$this->assertTrue($result);
|
||||
|
||||
|
@ -823,7 +823,7 @@ class DboPostgresTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testAlteringTwoTables() {
|
||||
$schema1 =& new CakeSchema(array(
|
||||
$schema1 = new CakeSchema(array(
|
||||
'name' => 'AlterTest1',
|
||||
'connection' => 'test',
|
||||
'altertest' => array(
|
||||
|
@ -835,7 +835,7 @@ class DboPostgresTest extends CakeTestCase {
|
|||
'name' => array('type' => 'string', 'null' => false, 'length' => 50),
|
||||
)
|
||||
));
|
||||
$schema2 =& new CakeSchema(array(
|
||||
$schema2 = new CakeSchema(array(
|
||||
'name' => 'AlterTest1',
|
||||
'connection' => 'test',
|
||||
'altertest' => array(
|
||||
|
|
|
@ -992,36 +992,36 @@ class DboSourceTest extends CakeTestCase {
|
|||
|
||||
// EMPTY STRING
|
||||
$result = $this->testDb->value('', 'boolean');
|
||||
$this->assertEqual($result, 0);
|
||||
$this->assertEqual($result, "'0'");
|
||||
|
||||
|
||||
// BOOLEAN
|
||||
$result = $this->testDb->value('true', 'boolean');
|
||||
$this->assertEqual($result, 1);
|
||||
$this->assertEqual($result, "'1'");
|
||||
|
||||
$result = $this->testDb->value('false', 'boolean');
|
||||
$this->assertEqual($result, 1);
|
||||
$this->assertEqual($result, "'1'");
|
||||
|
||||
$result = $this->testDb->value(true, 'boolean');
|
||||
$this->assertEqual($result, 1);
|
||||
$this->assertEqual($result, "'1'");
|
||||
|
||||
$result = $this->testDb->value(false, 'boolean');
|
||||
$this->assertEqual($result, 0);
|
||||
$this->assertEqual($result, "'0'");
|
||||
|
||||
$result = $this->testDb->value(1, 'boolean');
|
||||
$this->assertEqual($result, 1);
|
||||
$this->assertEqual($result, "'1'");
|
||||
|
||||
$result = $this->testDb->value(0, 'boolean');
|
||||
$this->assertEqual($result, 0);
|
||||
$this->assertEqual($result, "'0'");
|
||||
|
||||
$result = $this->testDb->value('abc', 'boolean');
|
||||
$this->assertEqual($result, 1);
|
||||
$this->assertEqual($result, "'1'");
|
||||
|
||||
$result = $this->testDb->value(1.234, 'boolean');
|
||||
$this->assertEqual($result, 1);
|
||||
$this->assertEqual($result, "'1'");
|
||||
|
||||
$result = $this->testDb->value('1.234e05', 'boolean');
|
||||
$this->assertEqual($result, 1);
|
||||
$this->assertEqual($result, "'1'");
|
||||
|
||||
// NUMBERS
|
||||
$result = $this->testDb->value(123, 'integer');
|
||||
|
|
Loading…
Add table
Reference in a new issue