Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 875713f

Browse files
[Cache] Deprecate CouchbaseBucketAdapter, use CouchbaseCollectionAdapter
1 parent c4e97eb commit 875713f

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

UPGRADE-7.1.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 7.0 to 7.1
22
=======================
33

4+
Cache
5+
-----
6+
7+
* Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter`
8+
49
Workflow
510
--------
611

src/Symfony/Component/Cache/Adapter/CouchbaseBucketAdapter.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* @author Antonio Jose Cerezo Aranda <[email protected]>
21+
*
22+
* @deprecated since Symfony 7.1, use {@see CouchbaseCollectionAdapter} instead
2123
*/
2224
class CouchbaseBucketAdapter extends AbstractAdapter
2325
{

src/Symfony/Component/Cache/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add option `sentinel_master` as an alias for `redis_sentinel`
8+
* Deprecate `CouchbaseBucketAdapter`, use `CouchbaseCollectionAdapter`
89

910
7.0
1011
---

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

+8-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Cache\Tests\Adapter;
1313

1414
use Psr\Cache\CacheItemPoolInterface;
15+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1516
use Symfony\Component\Cache\Adapter\AbstractAdapter;
1617
use Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter;
1718

@@ -25,19 +26,19 @@
2526
*/
2627
class CouchbaseBucketAdapterTest extends AdapterTestCase
2728
{
29+
use ExpectDeprecationTrait;
30+
2831
protected $skippedTests = [
2932
'testClearPrefix' => 'Couchbase cannot clear by prefix',
3033
];
3134

32-
protected static \CouchbaseBucket $client;
35+
protected \CouchbaseBucket $client;
3336

34-
public static function setupBeforeClass(): void
37+
protected function setUp(): void
3538
{
36-
if (!CouchbaseBucketAdapter::isSupported()) {
37-
self::markTestSkipped('Couchbase >= 2.6.0 < 3.0.0 is required.');
38-
}
39+
$this->expectDeprecation('Since symfony/cache 7.1: The "Symfony\Component\Cache\Adapter\CouchbaseBucketAdapter" class is deprecated, use "Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter" instead.');
3940

40-
self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
41+
$this->client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
4142
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
4243
);
4344
}
@@ -50,7 +51,7 @@ public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface
5051
.':'.getenv('COUCHBASE_PASS')
5152
.'@'.getenv('COUCHBASE_HOST')
5253
.'/cache')
53-
: self::$client;
54+
: $this->client;
5455

5556
return new CouchbaseBucketAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
5657
}

0 commit comments

Comments
 (0)