mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Replacing driver type check now that the key "datasource" is to be used instead of "driver"
This commit is contained in:
parent
e8a93aef93
commit
2cc4e0e3cb
1 changed files with 11 additions and 11 deletions
|
@ -79,8 +79,8 @@ class ModelReadTest extends BaseModelTest {
|
||||||
*/
|
*/
|
||||||
function testGroupBy() {
|
function testGroupBy() {
|
||||||
$db = ConnectionManager::getDataSource('test');
|
$db = ConnectionManager::getDataSource('test');
|
||||||
$isStrictGroupBy = in_array($db->config['driver'], array('postgres', 'oracle', 'sqlite'));
|
$isStrictGroupBy = $this->db instanceof Postgres || $this->db instanceof Sqlite || $this->db instanceof Oracle;
|
||||||
$message = '%s Postgres and Oracle have strict GROUP BY and are incompatible with this test.';
|
$message = 'Postgres and Oracle have strict GROUP BY and are incompatible with this test.';
|
||||||
|
|
||||||
if ($this->skipIf($isStrictGroupBy, $message )) {
|
if ($this->skipIf($isStrictGroupBy, $message )) {
|
||||||
return;
|
return;
|
||||||
|
@ -367,10 +367,10 @@ class ModelReadTest extends BaseModelTest {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testVeryStrangeUseCase() {
|
function testVeryStrangeUseCase() {
|
||||||
$message = "%s skipping SELECT * FROM ? WHERE ? = ? AND ? = ?; prepared query.";
|
$message = "skipping SELECT * FROM ? WHERE ? = ? AND ? = ?; prepared query.";
|
||||||
$message .= " MSSQL is incompatible with this test.";
|
$message .= " MSSQL is incompatible with this test.";
|
||||||
|
|
||||||
if ($this->skipIf($this->db->config['driver'] == 'mssql', $message)) {
|
if ($this->skipIf($this->db instanceof Mssql, $message)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4021,7 +4021,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$result = $TestModel->find('all', compact('conditions', 'recursive', 'order'));
|
$result = $TestModel->find('all', compact('conditions', 'recursive', 'order'));
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
if ($this->skipIf($this->db->config['driver'] == 'postgres', 'The rest of testFindAllWithConditionsHavingMixedDataTypes test is not compatible with Postgres')) {
|
if ($this->skipIf($this->db instanceof Postgres, 'The rest of testFindAllWithConditionsHavingMixedDataTypes test is not compatible with Postgres')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$conditions = array('id' => array('1', 2, '3.0'));
|
$conditions = array('id' => array('1', 2, '3.0'));
|
||||||
|
@ -6229,7 +6229,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
// These tests are expected to fail on SQL Server since the LIMIT/OFFSET
|
// These tests are expected to fail on SQL Server since the LIMIT/OFFSET
|
||||||
// hack can't handle small record counts.
|
// hack can't handle small record counts.
|
||||||
if ($this->db->config['driver'] != 'mssql') {
|
if ($this->db instanceof Mssql) {
|
||||||
$result = $TestModel->find('all', array('limit' => 3, 'page' => 2));
|
$result = $TestModel->find('all', array('limit' => 3, 'page' => 2));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array(
|
array(
|
||||||
|
@ -6255,7 +6255,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testGenerateFindList() {
|
function testGenerateFindList() {
|
||||||
$this->loadFixtures('Article', 'Apple', 'Post', 'Author', 'User');
|
$this->loadFixtures('Article', 'Apple', 'Post', 'Author', 'User', 'Comment');
|
||||||
|
|
||||||
$TestModel = new Article();
|
$TestModel = new Article();
|
||||||
$TestModel->displayField = 'title';
|
$TestModel->displayField = 'title';
|
||||||
|
@ -6272,7 +6272,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
$db = ConnectionManager::getDataSource('test');
|
$db = ConnectionManager::getDataSource('test');
|
||||||
if ($db->config['driver'] == 'mysql') {
|
if ($db instanceof Mysql) {
|
||||||
$result = $TestModel->find('list', array(
|
$result = $TestModel->find('list', array(
|
||||||
'order' => array('FIELD(Article.id, 3, 2) ASC', 'Article.title ASC')
|
'order' => array('FIELD(Article.id, 3, 2) ASC', 'Article.title ASC')
|
||||||
));
|
));
|
||||||
|
@ -6624,7 +6624,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
*/
|
*/
|
||||||
function testFindCountDistinct() {
|
function testFindCountDistinct() {
|
||||||
$skip = $this->skipIf(
|
$skip = $this->skipIf(
|
||||||
$this->db->config['driver'] == 'sqlite',
|
$this->db instanceof Sqlite,
|
||||||
'SELECT COUNT(DISTINCT field) is not compatible with SQLite'
|
'SELECT COUNT(DISTINCT field) is not compatible with SQLite'
|
||||||
);
|
);
|
||||||
if ($skip) {
|
if ($skip) {
|
||||||
|
@ -6647,7 +6647,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testFindCountWithDbExpressions() {
|
function testFindCountWithDbExpressions() {
|
||||||
if ($this->skipIf($this->db->config['driver'] == 'postgres', '%s testFindCountWithExpressions is not compatible with Postgres')) {
|
if ($this->skipIf($this->db instanceof Postgres, 'testFindCountWithExpressions is not compatible with Postgres')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->loadFixtures('Project');
|
$this->loadFixtures('Project');
|
||||||
|
@ -7472,7 +7472,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testVirtualFieldsMysql() {
|
public function testVirtualFieldsMysql() {
|
||||||
if ($this->skipIf($this->db->config['driver'] != 'mysql', 'The rest of virtualFieds test is not compatible with Postgres')) {
|
if ($this->skipIf(!($this->db instanceof Mysql), 'The rest of virtualFieds test is not compatible with Postgres')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->loadFixtures('Post', 'Author');
|
$this->loadFixtures('Post', 'Author');
|
||||||
|
|
Loading…
Reference in a new issue