feat(Docker): Upgrade to PHP 8.5.0RC3 with native ext-uri support
BREAKING CHANGE: Requires PHP 8.5.0RC3 Changes: - Update Docker base image from php:8.4-fpm to php:8.5.0RC3-fpm - Enable ext-uri for native WHATWG URL parsing support - Update composer.json PHP requirement from ^8.4 to ^8.5 - Add ext-uri as required extension in composer.json - Move URL classes from Url.php85/ to Url/ directory (now compatible) - Remove temporary PHP 8.4 compatibility workarounds Benefits: - Native URL parsing with Uri\WhatWg\Url class - Better performance for URL operations - Future-proof with latest PHP features - Eliminates PHP version compatibility issues
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Framework\Cache\CacheItem;
|
||||
use App\Framework\Cache\CacheKey;
|
||||
use App\Framework\Cache\Driver\InMemoryCache;
|
||||
use App\Framework\Core\ValueObjects\Duration;
|
||||
@@ -12,65 +13,71 @@ beforeEach(function () {
|
||||
|
||||
test('get returns miss for non-existent key', function () {
|
||||
$key = CacheKey::fromString('non-existent');
|
||||
$item = $this->cache->get($key);
|
||||
$result = $this->cache->get($key);
|
||||
|
||||
expect($item->isHit)->toBeFalse()
|
||||
->and($item->key)->toBe($key)
|
||||
->and($item->value)->toBeNull();
|
||||
expect($result->isHit)->toBeFalse()
|
||||
->and($result->value)->toBeNull();
|
||||
});
|
||||
|
||||
test('set and get stores and retrieves value', function () {
|
||||
$key = CacheKey::fromString('test-key');
|
||||
$value = 'test-value';
|
||||
|
||||
$result = $this->cache->set($key, $value);
|
||||
$result = $this->cache->set(CacheItem::forSet($key, $value));
|
||||
|
||||
expect($result)->toBeTrue();
|
||||
|
||||
$item = $this->cache->get($key);
|
||||
$cacheResult = $this->cache->get($key);
|
||||
|
||||
expect($item->isHit)->toBeTrue()
|
||||
->and($item->key)->toBe($key)
|
||||
->and($item->value)->toBe($value);
|
||||
expect($cacheResult->isHit)->toBeTrue()
|
||||
->and($cacheResult->value)->toBe($value);
|
||||
});
|
||||
|
||||
test('has returns correct existence status', function () {
|
||||
$key = CacheKey::fromString('test-key');
|
||||
|
||||
expect($this->cache->has($key))->toBeFalse();
|
||||
$hasResult = $this->cache->has($key);
|
||||
expect($hasResult['test-key'])->toBeFalse();
|
||||
|
||||
$this->cache->set($key, 'value');
|
||||
$this->cache->set(CacheItem::forSet($key, 'value'));
|
||||
|
||||
expect($this->cache->has($key))->toBeTrue();
|
||||
$hasResult = $this->cache->has($key);
|
||||
expect($hasResult['test-key'])->toBeTrue();
|
||||
});
|
||||
|
||||
test('forget removes item from cache', function () {
|
||||
$key = CacheKey::fromString('test-key');
|
||||
$this->cache->set($key, 'value');
|
||||
$this->cache->set(CacheItem::forSet($key, 'value'));
|
||||
|
||||
expect($this->cache->has($key))->toBeTrue();
|
||||
$hasResult = $this->cache->has($key);
|
||||
expect($hasResult['test-key'])->toBeTrue();
|
||||
|
||||
$result = $this->cache->forget($key);
|
||||
|
||||
expect($result)->toBeTrue()
|
||||
->and($this->cache->has($key))->toBeFalse();
|
||||
expect($result)->toBeTrue();
|
||||
|
||||
$hasResult = $this->cache->has($key);
|
||||
expect($hasResult['test-key'])->toBeFalse();
|
||||
});
|
||||
|
||||
test('clear removes all items from cache', function () {
|
||||
$key1 = CacheKey::fromString('key1');
|
||||
$key2 = CacheKey::fromString('key2');
|
||||
|
||||
$this->cache->set($key1, 'value1');
|
||||
$this->cache->set($key2, 'value2');
|
||||
$this->cache->set(CacheItem::forSet($key1, 'value1'));
|
||||
$this->cache->set(CacheItem::forSet($key2, 'value2'));
|
||||
|
||||
expect($this->cache->has($key1))->toBeTrue()
|
||||
->and($this->cache->has($key2))->toBeTrue();
|
||||
$hasResult = $this->cache->has($key1, $key2);
|
||||
expect($hasResult['key1'])->toBeTrue();
|
||||
expect($hasResult['key2'])->toBeTrue();
|
||||
|
||||
$result = $this->cache->clear();
|
||||
|
||||
expect($result)->toBeTrue()
|
||||
->and($this->cache->has($key1))->toBeFalse()
|
||||
->and($this->cache->has($key2))->toBeFalse();
|
||||
expect($result)->toBeTrue();
|
||||
|
||||
$hasResult = $this->cache->has($key1, $key2);
|
||||
expect($hasResult['key1'])->toBeFalse();
|
||||
expect($hasResult['key2'])->toBeFalse();
|
||||
});
|
||||
|
||||
test('set with ttl parameter still stores value', function () {
|
||||
@@ -78,14 +85,14 @@ test('set with ttl parameter still stores value', function () {
|
||||
$value = 'test-value';
|
||||
$ttl = Duration::fromHours(1);
|
||||
|
||||
$result = $this->cache->set($key, $value, $ttl);
|
||||
$result = $this->cache->set(CacheItem::forSet($key, $value, $ttl));
|
||||
|
||||
expect($result)->toBeTrue();
|
||||
|
||||
$item = $this->cache->get($key);
|
||||
$cacheResult = $this->cache->get($key);
|
||||
|
||||
expect($item->isHit)->toBeTrue()
|
||||
->and($item->value)->toBe($value);
|
||||
expect($cacheResult->isHit)->toBeTrue()
|
||||
->and($cacheResult->value)->toBe($value);
|
||||
});
|
||||
|
||||
test('multiple keys can be stored independently', function () {
|
||||
@@ -93,9 +100,9 @@ test('multiple keys can be stored independently', function () {
|
||||
$key2 = CacheKey::fromString('key2');
|
||||
$key3 = CacheKey::fromString('key3');
|
||||
|
||||
$this->cache->set($key1, 'value1');
|
||||
$this->cache->set($key2, 'value2');
|
||||
$this->cache->set($key3, 'value3');
|
||||
$this->cache->set(CacheItem::forSet($key1, 'value1'));
|
||||
$this->cache->set(CacheItem::forSet($key2, 'value2'));
|
||||
$this->cache->set(CacheItem::forSet($key3, 'value3'));
|
||||
|
||||
expect($this->cache->get($key1)->value)->toBe('value1')
|
||||
->and($this->cache->get($key2)->value)->toBe('value2')
|
||||
@@ -105,9 +112,9 @@ test('multiple keys can be stored independently', function () {
|
||||
test('overwriting existing key updates value', function () {
|
||||
$key = CacheKey::fromString('test-key');
|
||||
|
||||
$this->cache->set($key, 'original-value');
|
||||
$this->cache->set(CacheItem::forSet($key, 'original-value'));
|
||||
expect($this->cache->get($key)->value)->toBe('original-value');
|
||||
|
||||
$this->cache->set($key, 'updated-value');
|
||||
$this->cache->set(CacheItem::forSet($key, 'updated-value'));
|
||||
expect($this->cache->get($key)->value)->toBe('updated-value');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user