Skip to content

Commit f62c869

Browse files
minor symfony#53124 [Cache] Fix CI failing tests (alexandre-daubois)
This PR was merged into the 7.1 branch. Discussion ---------- [Cache] Fix CI failing tests | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Fixes CI, `AbstractAdapter::createConnection` checks the bucket support before falling back to Collection when the DSN starts with `couchbase`. Should fix CI in all versions with symfony#53054 Commits ------- 578eb29 [Cache] Fix failing test
2 parents e901313 + 578eb29 commit f62c869

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

14-
use Couchbase\Collection;
1514
use Psr\Cache\CacheItemPoolInterface;
15+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1616
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1717
use Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter;
1818

@@ -21,41 +21,32 @@
2121
* @requires extension couchbase >=3.0.0
2222
*
2323
* @group integration
24+
* @group legacy
2425
*
2526
* @author Antonio Jose Cerezo Aranda <[email protected]>
2627
*/
2728
class CouchbaseCollectionAdapterTest extends AdapterTestCase
2829
{
30+
use ExpectDeprecationTrait;
31+
2932
protected $skippedTests = [
3033
'testClearPrefix' => 'Couchbase cannot clear by prefix',
3134
];
3235

33-
protected static Collection $client;
34-
35-
public static function setupBeforeClass(): void
36+
public static function setUpBeforeClass(): void
3637
{
3738
if (!CouchbaseCollectionAdapter::isSupported()) {
3839
self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
3940
}
40-
41-
self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
42-
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
43-
);
4441
}
4542

4643
public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface
4744
{
48-
if (!CouchbaseCollectionAdapter::isSupported()) {
49-
self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
50-
}
45+
$this->expectDeprecation('Since symfony/cache 7.1: The "Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter" class is deprecated, use "Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter" instead.');
5146

52-
$client = $defaultLifetime
53-
? AbstractAdapter::createConnection('couchbase://'
54-
.getenv('COUCHBASE_USER')
55-
.':'.getenv('COUCHBASE_PASS')
56-
.'@'.getenv('COUCHBASE_HOST')
57-
.'/cache')
58-
: self::$client;
47+
$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
48+
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
49+
);
5950

6051
return new CouchbaseCollectionAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
6152
}

src/Symfony/Component/Cache/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"psr/cache": "^2.0|^3.0",
2626
"psr/log": "^1.1|^2|^3",
2727
"symfony/cache-contracts": "^2.5|^3",
28+
"symfony/deprecation-contracts": "^2.5|^3.0",
2829
"symfony/service-contracts": "^2.5|^3",
2930
"symfony/var-exporter": "^6.4|^7.0"
3031
},

0 commit comments

Comments
 (0)