forked from doctrine/dbal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release [2.11.1](https://github.com/doctrine/dbal/milestone/80) 2.11.1 ====== - Total issues resolved: **2** - Total pull requests resolved: **8** - Total contributors: **6** Documentation ------------- - [4299: Link to contributing guide](doctrine#4299) thanks to @greg0ire SQLite,Test Suite,pdo_sqlite ---------------------------- - [4297: Fix ExceptionTest::testConnectionExceptionSqLite() on macOS](doctrine#4297) thanks to @morozov - [4296: Increase indent in definition lists](doctrine#4296) thanks to @greg0ire Deprecation,Prepared Statements ------------------------------- - [4291: Deprecate Abstraction\Result](doctrine#4291) thanks to @morozov BC Fix,Quoting -------------- - [4287: Restore PDOStatement::quote() for backward compatibility](doctrine#4287) thanks to @morozov and @Shahelm BC Fix,Query ------------ - [4286: Fix BC break: QueryBuilder::andWhere() etc. should ignore empty strings](doctrine#4286) thanks to @BenMorel and @infabo Bug,Documentation,Prepared Statements ------------------------------------- - [4285: Fix phpdoc on deprecated functions](doctrine#4285) thanks to @qdequippe Bug,PDO,Prepared Statements --------------------------- - [4173: Fix Third parameter not allowed for PDO::FETCH&doctrine#95;COLUMN](doctrine#4173) thanks to @BenMorel # gpg: Signature made Sun Sep 27 06:35:40 2020 # gpg: using DSA key 1BEDEE0A820BC30D858F9F0C2C3A645671828132 # gpg: Can't check signature: No public key
- Loading branch information
Showing
15 changed files
with
250 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Doctrine has [general contributing guidelines][contributor workflow], make | ||
sure you follow them. | ||
|
||
[contributor workflow]: https://www.doctrine-project.org/contribute/index.html |
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
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
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
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
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
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
70 changes: 70 additions & 0 deletions
70
tests/Doctrine/Tests/DBAL/Functional/ExternalPDOInstanceTest.php
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,70 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\DBAL\Functional; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Doctrine\DBAL\Driver\PDO\SQLite\Driver as PDOSqliteDriver; | ||
use Doctrine\DBAL\FetchMode; | ||
use Doctrine\DBAL\Schema\Table; | ||
use Doctrine\Tests\DbalTestCase; | ||
use Doctrine\Tests\TestUtil; | ||
use PDO; | ||
|
||
class ExternalPDOInstanceTest extends DbalTestCase | ||
{ | ||
/** @var Connection */ | ||
protected $connection; | ||
|
||
protected function setUp(): void | ||
{ | ||
if (! TestUtil::getConnection()->getDriver() instanceof PDOSqliteDriver) { | ||
$this->markTestSkipped('External PDO instance tests are only run on PDO SQLite for now'); | ||
} | ||
|
||
$pdo = new PDO('sqlite::memory:'); | ||
|
||
$this->connection = new Connection(['pdo' => $pdo], new PDOSqliteDriver()); | ||
|
||
$table = new Table('stmt_fetch_all'); | ||
$table->addColumn('a', 'integer'); | ||
$table->addColumn('b', 'integer'); | ||
|
||
$this->connection->getSchemaManager()->createTable($table); | ||
|
||
$this->connection->insert('stmt_fetch_all', [ | ||
'a' => 1, | ||
'b' => 2, | ||
]); | ||
} | ||
|
||
public function testFetchAllWithOneArgument(): void | ||
{ | ||
$stmt = $this->connection->prepare('SELECT a, b FROM stmt_fetch_all'); | ||
$stmt->execute(); | ||
|
||
self::assertEquals([[1, 2]], $stmt->fetchAll(FetchMode::NUMERIC)); | ||
} | ||
|
||
public function testFetchAllWithTwoArguments(): void | ||
{ | ||
$stmt = $this->connection->prepare('SELECT a, b FROM stmt_fetch_all'); | ||
$stmt->execute(); | ||
|
||
self::assertEquals([2], $stmt->fetchAll(FetchMode::COLUMN, 1)); | ||
} | ||
|
||
public function testFetchAllWithThreeArguments(): void | ||
{ | ||
$stmt = $this->connection->prepare('SELECT a, b FROM stmt_fetch_all'); | ||
$stmt->execute(); | ||
|
||
[$obj] = $stmt->fetchAll(FetchMode::CUSTOM_OBJECT, StatementTestModel::class, ['foo', 'bar']); | ||
|
||
$this->assertInstanceOf(StatementTestModel::class, $obj); | ||
|
||
self::assertEquals(1, $obj->a); | ||
self::assertEquals(2, $obj->b); | ||
self::assertEquals('foo', $obj->x); | ||
self::assertEquals('bar', $obj->y); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/Doctrine/Tests/DBAL/Functional/StatementTestModel.php
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,24 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\DBAL\Functional; | ||
|
||
class StatementTestModel | ||
{ | ||
public function __construct(string $x, string $y) | ||
{ | ||
$this->x = $x; | ||
$this->y = $y; | ||
} | ||
|
||
/** @var int */ | ||
public $a; | ||
|
||
/** @var int */ | ||
public $b; | ||
|
||
/** @var string */ | ||
public $x; | ||
|
||
/** @var string */ | ||
public $y; | ||
} |
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