8000 [Cache] Fix failing test · symfony/symfony@578eb29 · GitHub
[go: up one dir, main page]

Skip to content

Commit 578eb29

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

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

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

+9-18
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

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
25< 6495 code>25
"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