Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Cover few limits issue
Browse files Browse the repository at this point in the history
  • Loading branch information
autowp committed Aug 1, 2017
1 parent d2c0e4f commit 95efe84
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/Adapter/Platform/MysqlIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace ZendTest\Db\Adapter\Platform;

use Zend\Db\Adapter\Adapter;
use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Select;
use Zend\Db\Adapter\Platform\Mysql;
use Zend\Db\Adapter\Driver\Mysqli;
use Zend\Db\Adapter\Driver\Pdo;
Expand Down Expand Up @@ -48,4 +51,28 @@ public function testQuoteValueWithPdoMysql()
$value = $mysql->quoteValue('value');
$this->assertEquals('\'value\'', $value);
}

public function testFewLimitValueNotMerged()
{
if (!$this->adapters['pdo_mysql'] instanceof \PDO) {
$this->markTestSkipped('MySQL (PDO_Mysql) not configured in unit test configuration file');
}
$driver = new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_mysql']));
$mysql = new Mysql($driver);
$adapter = new Adapter($driver, $mysql);
$sql = new Sql($adapter, 'table');

$subSelect = new Select('foo');
$subSelect->columns(['column'])->limit(1);

$select = new Select('bar');
$select->columns(['column' => $subSelect])->limit(99);

$statement = $sql->prepareStatementForSqlObject($select);

$parametersCount = $statement->getParameterContainer()->count();
$placeholdersCount = substr_count($statement->getSql(), ':');

$this->assertEquals($parametersCount, $placeholdersCount, 'Count of parameters and placeholder not the same');
}
}

0 comments on commit 95efe84

Please sign in to comment.