Add basic tests for PDOConnection and PDOStatement
[MAILPOET-3296]
This commit is contained in:
committed by
Veljko V
parent
0ee843723e
commit
dd3538b78d
28
tests/integration/Doctrine/Driver/PDOConnectionTest.php
Normal file
28
tests/integration/Doctrine/Driver/PDOConnectionTest.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Doctrine\Driver;
|
||||
|
||||
use MailPoet\Doctrine\ConnectionFactory;
|
||||
|
||||
require_once __DIR__ . '/DummyUser.php';
|
||||
|
||||
class PDOConnectionTest extends \MailPoetTest {
|
||||
|
||||
/** @var PDOConnection */
|
||||
private $testConnection;
|
||||
|
||||
public function _before() {
|
||||
$this->testConnection = $this->diContainer->get(ConnectionFactory::class)->createConnection();
|
||||
}
|
||||
|
||||
public function testItCanQuery() {
|
||||
$statement = $this->testConnection->query("SELECT 'lojza' as name, 30 as age;");
|
||||
expect($statement)->isInstanceOf(PDOStatement::class);
|
||||
|
||||
$statement = $this->testConnection->query("SELECT 'lojza' as name, 30 as age;", \PDO::FETCH_COLUMN, 2);
|
||||
expect($statement)->isInstanceOf(PDOStatement::class);
|
||||
|
||||
$statement = $this->testConnection->query("SELECT 'lojza' as name, 30 as age;", \PDO::FETCH_CLASS, DummyUser::class, ['name', 'age']);
|
||||
expect($statement)->isInstanceOf(PDOStatement::class);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user