Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 578eb29

Browse filesBrowse files
alexandre-dauboisnicolas-grekas
authored andcommitted
[Cache] Fix failing test
1 parent 8b14fb3 commit 578eb29
Copy full SHA for 578eb29

File tree

2 files changed

+10
-18
lines changed
Filter options

2 files changed

+10
-18
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Tests/Adapter/CouchbaseCollectionAdapterTest.php
+9-18Lines 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 <aj.cerezo@gmail.com>
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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/composer.json
+1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.