Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 2.13.x into 3.1.x #4632

Merged
merged 7 commits into from May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
@@ -1,10 +1,10 @@
# Doctrine DBAL

| [4.0-dev][4.0] | [3.0][3.0] | [2.13][2.13] |
| [4.0-dev][4.0] | [3.1][3.1] | [2.13][2.13] |
|:----------------:|:----------:|:----------:|
| [![GitHub Actions][GA 4.0 image]][GA 4.0] | [![GitHub Actions][GA 3.0 image]][GA 3.0] | [![GitHub Actions][GA 2.13 image]][GA 2.13] |
| [![AppVeyor][AppVeyor 4.0 image]][AppVeyor 4.0] | [![AppVeyor][AppVeyor 3.0 image]][AppVeyor 3.0] | [![AppVeyor][AppVeyor 2.13 image]][AppVeyor 2.13] |
| [![Code Coverage][Coverage image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.0 image]][CodeCov 3.0] | [![Code Coverage][Coverage 2.13 image]][CodeCov 2.13] |
| [![GitHub Actions][GA 4.0 image]][GA 4.0] | [![GitHub Actions][GA 3.1 image]][GA 3.1] | [![GitHub Actions][GA 2.13 image]][GA 2.13] |
| [![AppVeyor][AppVeyor 4.0 image]][AppVeyor 4.0] | [![AppVeyor][AppVeyor 3.1 image]][AppVeyor 3.1] | [![AppVeyor][AppVeyor 2.13 image]][AppVeyor 2.13] |
| [![Code Coverage][Coverage image]][CodeCov 4.0] | [![Code Coverage][Coverage 3.1 image]][CodeCov 3.1] | [![Code Coverage][Coverage 2.13 image]][CodeCov 2.13] |
| N/A | [![Code Coverage][TypeCov 3.1 image]][TypeCov 3.1] | N/A |

Powerful database abstraction layer with many features for database schema introspection, schema management and PDO abstraction.
Expand All @@ -23,13 +23,13 @@ Powerful database abstraction layer with many features for database schema intro
[GA 4.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A4.0.x
[GA 4.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg

[Coverage 3.0 image]: https://codecov.io/gh/doctrine/dbal/branch/3.0.x/graph/badge.svg
[3.0]: https://github.com/doctrine/dbal/tree/3.0.x
[CodeCov 3.0]: https://codecov.io/gh/doctrine/dbal/branch/3.0.x
[AppVeyor 3.0]: https://ci.appveyor.com/project/doctrine/dbal/branch/3.0.x
[AppVeyor 3.0 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/3.0.x?svg=true
[GA 3.0]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.0.x
[GA 3.0 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.0.x
[Coverage 3.1 image]: https://codecov.io/gh/doctrine/dbal/branch/3.1.x/graph/badge.svg
[3.1]: https://github.com/doctrine/dbal/tree/3.1.x
[CodeCov 3.1]: https://codecov.io/gh/doctrine/dbal/branch/3.1.x
[AppVeyor 3.1]: https://ci.appveyor.com/project/doctrine/dbal/branch/3.1.x
[AppVeyor 3.1 image]: https://ci.appveyor.com/api/projects/status/i88kitq8qpbm0vie/branch/3.1.x?svg=true
[GA 3.1]: https://github.com/doctrine/dbal/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A3.1.x
[GA 3.1 image]: https://github.com/doctrine/dbal/workflows/Continuous%20Integration/badge.svg?branch=3.1.x

[Coverage 2.13 image]: https://codecov.io/gh/doctrine/dbal/branch/2.13.x/graph/badge.svg
[2.13]: https://github.com/doctrine/dbal/tree/2.13.x
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -33,7 +33,7 @@
"require": {
"php": "^7.3 || ^8.0",
"composer/package-versions-deprecated": "^1.11.99",
"doctrine/cache": "^1.0",
"doctrine/cache": "^1.0|^2.0",
"doctrine/deprecations": "^0.5.3",
"doctrine/event-manager": "^1.0"
},
Expand All @@ -45,6 +45,7 @@
"phpunit/phpunit": "9.5.0",
"psalm/plugin-phpunit": "0.13.0",
"squizlabs/php_codesniffer": "3.6.0",
"symfony/cache": "^5.2",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "4.6.4"
},
Expand Down
25 changes: 21 additions & 4 deletions tests/Functional/ResultCacheTest.php
Expand Up @@ -3,15 +3,19 @@
namespace Doctrine\DBAL\Tests\Functional;

use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\Cache;
use Doctrine\Common\Cache\Psr6\DoctrineProvider;
use Doctrine\DBAL\Cache\QueryCacheProfile;
use Doctrine\DBAL\Logging\DebugStack;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;

use function array_change_key_case;
use function array_shift;
use function array_values;
use function class_exists;
use function is_array;

use const CASE_LOWER;
Expand Down Expand Up @@ -47,7 +51,7 @@ protected function setUp(): void
$config = $this->connection->getConfiguration();
$config->setSQLLogger($this->sqlLogger = new DebugStack());

$cache = new ArrayCache();
$cache = $this->getArrayCache();
$config->setResultCacheImpl($cache);
}

Expand Down Expand Up @@ -213,7 +217,7 @@ public function testDontFinishNoCache(): void
*/
public function testFetchingAllRowsSavesCache(callable $fetchAll): void
{
$layerCache = new ArrayCache();
$layerCache = $this->getArrayCache();

$result = $this->connection->executeQuery(
'SELECT * FROM caching WHERE test_int > 500',
Expand Down Expand Up @@ -256,7 +260,7 @@ public function testFetchColumn(): void
$query = $this->connection->getDatabasePlatform()
->getDummySelectSQL('1');

$qcp = new QueryCacheProfile(0, null, new ArrayCache());
$qcp = new QueryCacheProfile(0, null, $this->getArrayCache());

$result = $this->connection->executeCacheQuery($query, [], [], $qcp);
$result->fetchFirstColumn();
Expand Down Expand Up @@ -335,7 +339,7 @@ public function testChangeCacheImpl(): void
return $result->fetchAssociative();
});

$secondCache = new ArrayCache();
$secondCache = $this->getArrayCache();

$stmt = $this->connection->executeQuery(
'SELECT * FROM caching WHERE test_int > 500',
Expand Down Expand Up @@ -412,4 +416,17 @@ private function hydrateViaIteration(Result $result, callable $fetch): array

return $data;
}

private function getArrayCache(): Cache
{
if (class_exists(DoctrineProvider::class)) {
return DoctrineProvider::wrap(new ArrayAdapter());
}

if (class_exists(ArrayCache::class)) {
return new ArrayCache();
}

self::fail('Cannot instantiate cache backend.');
}
}