|
11 | 11 |
|
12 | 12 | namespace Symfony\Component\Cache\Tests\Adapter;
|
13 | 13 |
|
14 |
| -use Couchbase\Collection; |
15 | 14 | use Psr\Cache\CacheItemPoolInterface;
|
| 15 | +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; |
16 | 16 | use Symfony\Component\Cache\Adapter\AbstractAdapter;
|
17 | 17 | use Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter;
|
18 | 18 |
|
|
21 | 21 | * @requires extension couchbase >=3.0.0
|
22 | 22 | *
|
23 | 23 | * @group integration
|
| 24 | + * @group legacy |
24 | 25 | *
|
25 | 26 | * @author Antonio Jose Cerezo Aranda <aj.cerezo@gmail.com>
|
26 | 27 | */
|
27 | 28 | class CouchbaseCollectionAdapterTest extends AdapterTestCase
|
28 | 29 | {
|
| 30 | + use ExpectDeprecationTrait; |
| 31 | + |
29 | 32 | protected $skippedTests = [
|
30 | 33 | 'testClearPrefix' => 'Couchbase cannot clear by prefix',
|
31 | 34 | ];
|
32 | 35 |
|
33 |
| - protected static Collection $client; |
34 |
| - |
35 |
| - public static function setupBeforeClass(): void |
| 36 | + public static function setUpBeforeClass(): void |
36 | 37 | {
|
37 | 38 | if (!CouchbaseCollectionAdapter::isSupported()) {
|
38 | 39 | self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
|
39 | 40 | }
|
40 |
| - |
41 |
| - self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache', |
42 |
| - ['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')] |
43 |
| - ); |
44 | 41 | }
|
45 | 42 |
|
46 | 43 | public function createCachePool($defaultLifetime = 0): CacheItemPoolInterface
|
47 | 44 | {
|
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.'); |
51 | 46 |
|
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 | + ); |
59 | 50 |
|
60 | 51 | return new CouchbaseCollectionAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
|
61 | 52 | }
|
|
0 commit comments