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:
@@ -7,16 +7,44 @@ use App\Framework\Queue\InMemoryQueue;
|
||||
use App\Framework\Queue\ValueObjects\JobPayload;
|
||||
use App\Framework\Queue\ValueObjects\QueuePriority;
|
||||
|
||||
// Test job classes
|
||||
class SimpleTestJob
|
||||
{
|
||||
public function handle(): string
|
||||
{
|
||||
return 'test job executed';
|
||||
}
|
||||
}
|
||||
|
||||
class CounterTestJob
|
||||
{
|
||||
public function __construct(public int $id)
|
||||
{
|
||||
}
|
||||
|
||||
public function handle(): string
|
||||
{
|
||||
return "job {$this->id} executed";
|
||||
}
|
||||
}
|
||||
|
||||
class PriorityTestJob
|
||||
{
|
||||
public function __construct(public string $priority)
|
||||
{
|
||||
}
|
||||
|
||||
public function handle(): string
|
||||
{
|
||||
return "job with {$this->priority} priority executed";
|
||||
}
|
||||
}
|
||||
|
||||
describe('Queue Interface Basic Operations', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
$this->queue = new InMemoryQueue();
|
||||
$this->testJob = new class () {
|
||||
public function handle(): string
|
||||
{
|
||||
return 'test job executed';
|
||||
}
|
||||
};
|
||||
$this->testJob = new SimpleTestJob();
|
||||
});
|
||||
|
||||
describe('push() operation', function () {
|
||||
@@ -82,12 +110,8 @@ describe('Queue Interface Basic Operations', function () {
|
||||
});
|
||||
|
||||
it('processes FIFO for same priority jobs', function () {
|
||||
$job1 = new class () {
|
||||
public $id = 1;
|
||||
};
|
||||
$job2 = new class () {
|
||||
public $id = 2;
|
||||
};
|
||||
$job1 = (object)['id' => 1];
|
||||
$job2 = (object)['id' => 2];
|
||||
|
||||
$payload1 = JobPayload::create($job1, QueuePriority::normal());
|
||||
$payload2 = JobPayload::create($job2, QueuePriority::normal());
|
||||
@@ -218,7 +242,7 @@ describe('Queue Interface Basic Operations', function () {
|
||||
$this->queue->pop();
|
||||
$updatedStats = $this->queue->getStats();
|
||||
expect($updatedStats['size'])->toBe(1);
|
||||
expect($updatedStats['priority_breakdown']['critical'])->toBe(0);
|
||||
expect($updatedStats['priority_breakdown']['critical'] ?? 0)->toBe(0);
|
||||
expect($updatedStats['priority_breakdown']['normal'])->toBe(1);
|
||||
});
|
||||
});
|
||||
@@ -234,21 +258,11 @@ describe('Queue Priority Processing', function () {
|
||||
$jobs = [];
|
||||
|
||||
// Create jobs with different priorities
|
||||
$jobs['low'] = JobPayload::create(new class () {
|
||||
public $type = 'low';
|
||||
}, QueuePriority::low());
|
||||
$jobs['deferred'] = JobPayload::create(new class () {
|
||||
public $type = 'deferred';
|
||||
}, QueuePriority::deferred());
|
||||
$jobs['normal'] = JobPayload::create(new class () {
|
||||
public $type = 'normal';
|
||||
}, QueuePriority::normal());
|
||||
$jobs['high'] = JobPayload::create(new class () {
|
||||
public $type = 'high';
|
||||
}, QueuePriority::high());
|
||||
$jobs['critical'] = JobPayload::create(new class () {
|
||||
public $type = 'critical';
|
||||
}, QueuePriority::critical());
|
||||
$jobs['low'] = JobPayload::create((object)['type' => 'low'], QueuePriority::low());
|
||||
$jobs['deferred'] = JobPayload::create((object)['type' => 'deferred'], QueuePriority::deferred());
|
||||
$jobs['normal'] = JobPayload::create((object)['type' => 'normal'], QueuePriority::normal());
|
||||
$jobs['high'] = JobPayload::create((object)['type' => 'high'], QueuePriority::high());
|
||||
$jobs['critical'] = JobPayload::create((object)['type' => 'critical'], QueuePriority::critical());
|
||||
|
||||
// Push in random order
|
||||
$this->queue->push($jobs['normal']);
|
||||
@@ -267,15 +281,9 @@ describe('Queue Priority Processing', function () {
|
||||
});
|
||||
|
||||
it('handles custom priority values correctly', function () {
|
||||
$customHigh = JobPayload::create(new class () {
|
||||
public $id = 'custom_high';
|
||||
}, new QueuePriority(500));
|
||||
$customLow = JobPayload::create(new class () {
|
||||
public $id = 'custom_low';
|
||||
}, new QueuePriority(-50));
|
||||
$standardHigh = JobPayload::create(new class () {
|
||||
public $id = 'standard_high';
|
||||
}, QueuePriority::high());
|
||||
$customHigh = JobPayload::create((object)['id' => 'custom_high'], new QueuePriority(500));
|
||||
$customLow = JobPayload::create((object)['id' => 'custom_low'], new QueuePriority(-50));
|
||||
$standardHigh = JobPayload::create((object)['id' => 'standard_high'], QueuePriority::high());
|
||||
|
||||
$this->queue->push($customLow);
|
||||
$this->queue->push($standardHigh);
|
||||
@@ -309,9 +317,7 @@ describe('Queue Edge Cases', function () {
|
||||
});
|
||||
|
||||
it('maintains integrity after mixed operations', function () {
|
||||
$job = new class () {
|
||||
public $data = 'test';
|
||||
};
|
||||
$job = (object)['data' => 'test'];
|
||||
|
||||
// Complex sequence of operations
|
||||
$this->queue->push(JobPayload::create($job));
|
||||
@@ -338,12 +344,8 @@ describe('Queue Edge Cases', function () {
|
||||
|
||||
// Add 1000 jobs
|
||||
for ($i = 0; $i < 1000; $i++) {
|
||||
$job = new class () {
|
||||
public function __construct(public int $id)
|
||||
{
|
||||
}
|
||||
};
|
||||
$payload = JobPayload::create(new $job($i), QueuePriority::normal());
|
||||
$job = new CounterTestJob($i);
|
||||
$payload = JobPayload::create($job, QueuePriority::normal());
|
||||
$this->queue->push($payload);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user