-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DBAL-3082] Updated convertParamType(), added a functional test
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\DBAL\Functional; | ||
|
||
use Doctrine\DBAL\Driver\PDOConnection; | ||
use Doctrine\DBAL\Schema\Table; | ||
use Doctrine\Tests\DbalFunctionalTestCase; | ||
use PDO; | ||
use function extension_loaded; | ||
|
||
class PDOStatementTest extends DbalFunctionalTestCase | ||
{ | ||
protected function setUp() | ||
{ | ||
if (! extension_loaded('pdo')) { | ||
$this->markTestSkipped('PDO is not installed'); | ||
} | ||
|
||
parent::setUp(); | ||
|
||
if (! $this->_conn->getWrappedConnection() instanceof PDOConnection) { | ||
$this->markTestSkipped('PDO-only test'); | ||
} | ||
|
||
$table = new Table('stmt_test'); | ||
$table->addColumn('id', 'integer'); | ||
$table->addColumn('name', 'text'); | ||
$this->_conn->getSchemaManager()->dropAndCreateTable($table); | ||
} | ||
|
||
/** | ||
* @group legacy | ||
* @expectedDeprecation Using a PDO fetch mode or their combination (%d given) is deprecated and will cause an error in Doctrine 3.0 | ||
*/ | ||
public function testPDOSpecificModeIsAccepted() | ||
{ | ||
$this->_conn->insert('stmt_test', [ | ||
'id' => 1, | ||
'name' => 'Alice', | ||
]); | ||
$this->_conn->insert('stmt_test', [ | ||
'id' => 2, | ||
'name' => 'Bob', | ||
]); | ||
|
||
$data = $this->_conn->query('SELECT id, name FROM stmt_test ORDER BY id') | ||
->fetchAll(PDO::FETCH_KEY_PAIR); | ||
|
||
self::assertSame([ | ||
1 => 'Alice', | ||
2 => 'Bob', | ||
], $data); | ||
} | ||
} |