8000 [Cache] Fix CI failing tests by alexandre-daubois · Pull Request #53124 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Cache] Fix CI failing tests #53124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use Couchbase\Collection;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\CouchbaseCollectionAdapter;

Expand All @@ -21,41 +21,32 @@
* @requires extension couchbase >=3.0.0
*
* @group integration
* @group legacy
*
* @author Antonio Jose Cerezo Aranda <aj.cerezo@gmail.com>
*/
class CouchbaseCollectionAdapterTest extends AdapterTestCase
{
use ExpectDeprecationTrait;

protected $skippedTests = [
'testClearPrefix' => 'Couchbase cannot clear by prefix',
];

protected static Collection $client;

public static function setupBeforeClass(): void
public static function setUpBeforeClass(): void
{
if (!CouchbaseCollectionAdapter::isSupported()) {
self::markTestSkipped('Couchbase >= 3.0.0 < 4.0.0 is required.');
}

self::$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
);
}

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

$client = $defaultLifetime
? AbstractAdapter::createConnection('couchbase://'
.getenv('COUCHBASE_USER')
.':'.getenv('COUCHBASE_PASS')
.'@'.getenv('COUCHBASE_HOST')
.'/cache')
: self::$client;
$client = AbstractAdapter::createConnection('couchbase://'.getenv('COUCHBASE_HOST').'/cache',
['username' => getenv('COUCHBASE_USER'), 'password' => getenv('COUCHBASE_PASS')]
);

return new CouchbaseCollectionAdapter($client, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Cache/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"psr/cache": "^2.0|^3.0",
"psr/log": "^1.1|^2|^3",
"symfony/cache-contracts": "^2.5|^3",
"symfony/deprecation-contracts": "^2.5|^3.0",
"symfony/service-contracts": "^2.5|^3",
"symfony/var-exporter": "^6.4|^7.0"
},
Expand Down
0