Skip to content

Commit ef0d90e

Browse files
author
farhadzand
committed
refactor: transition from Pest to PHPUnit and update testing configurations
- Updated README to reflect the switch from Pest to PHPUnit for testing. - Modified `run-tests.sh` to enhance RabbitMQ configuration and cleanup. - Adjusted GitHub Actions workflows to use the correct RabbitMQ ports and clear PHPUnit cache. - Removed Pest-related files to streamline the testing process.
1 parent 53ef5a3 commit ef0d90e

File tree

4 files changed

+29
-74
lines changed

4 files changed

+29
-74
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
RABBITMQ_DEFAULT_PASS: secret
3636
RABBITMQ_DEFAULT_VHOST: b2b-field
3737
ports:
38-
- 5673:5672
39-
- 15673:15672
38+
- 5672:5672
39+
- 15672:15672
4040
options: >-
4141
--health-cmd "rabbitmq-diagnostics -q ping"
4242
--health-interval 10s
@@ -59,18 +59,16 @@ jobs:
5959
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
6060
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
6161
62-
- name: Clear Pest cache
62+
- name: Clear PHPUnit cache
6363
run: |
64-
rm -rf vendor/pestphp/pest/cache
6564
rm -rf .phpunit.cache
66-
rm -rf .pest.cache
67-
find . -name "*.cache" -type f -delete 2>/dev/null || true
65+
rm -rf .phpunit.result.cache
6866
6967
- name: Wait for RabbitMQ
7068
run: |
7169
echo "Waiting for RabbitMQ to be ready..."
7270
for i in {1..30}; do
73-
if curl -f http://localhost:15673/api/overview -u laravel:secret >/dev/null 2>&1; then
71+
if curl -f http://localhost:15672/api/overview -u laravel:secret >/dev/null 2>&1; then
7472
echo "RabbitMQ is ready!"
7573
break
7674
fi
@@ -81,14 +79,14 @@ jobs:
8179
- name: Verify RabbitMQ
8280
run: |
8381
echo "RabbitMQ Status:"
84-
curl -u laravel:secret http://localhost:15673/api/overview 2>/dev/null | jq -r '.rabbitmq_version // "Unable to get version"'
82+
curl -u laravel:secret http://localhost:15672/api/overview 2>/dev/null | jq -r '.rabbitmq_version // "Unable to get version"'
8583
echo "Available vhosts:"
86-
curl -u laravel:secret http://localhost:15673/api/vhosts 2>/dev/null | jq -r '.[].name // "Unable to get vhosts"'
84+
curl -u laravel:secret http://localhost:15672/api/vhosts 2>/dev/null | jq -r '.[].name // "Unable to get vhosts"'
8785
8886
- name: Run tests
8987
env:
9088
RABBITMQ_HOST: 127.0.0.1
91-
RABBITMQ_PORT: 5673
89+
RABBITMQ_PORT: 5672
9290
RABBITMQ_USER: laravel
9391
RABBITMQ_PASSWORD: secret
9492
RABBITMQ_VHOST: b2b-field

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ A robust and production-ready RabbitMQ queue driver implementation for Laravel,
2525
- **Connection Management** - Lazy connections, keepalive, and heartbeat support
2626

2727
### Developer Experience
28-
- **Comprehensive Testing** - Extensive test suite with Pest framework
28+
- **Comprehensive Testing** - Extensive test suite with PHPUnit framework
2929
- **Modern Architecture** - Clean separation of concerns with contracts and dedicated components
3030
- **Docker Ready** - Optimized for containerized environments
3131
- **Monitoring Support** - Integration-ready for monitoring and observability tools
@@ -486,22 +486,19 @@ public function failed(\Throwable $exception)
486486

487487
## Testing
488488

489-
This package includes comprehensive testing with Pest:
489+
This package includes comprehensive testing with PHPUnit:
490490

491491
### Running Tests
492492

493493
```bash
494494
# Run all tests
495495
composer test
496496

497-
# Run tests with HTML coverage report
498-
composer test-coverage
497+
# Run unit tests only
498+
composer test:unit
499499

500-
# Run tests with Clover coverage report (for CI)
501-
composer test-coverage-clover
502-
503-
# Run tests in parallel
504-
composer test-parallel
500+
# Run feature tests only
501+
composer test:feature
505502

506503
# Format code
507504
composer format

run-tests.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Simple test runner using PHPUnit directly to avoid Pest configuration issues
3+
# Simple test runner using PHPUnit
44
echo "Running LaravelRabbitMQ Tests..."
55

66
# Set environment variables
@@ -12,11 +12,19 @@ export MAIL_MAILER=array
1212
export QUEUE_CONNECTION=sync
1313
export SESSION_DRIVER=array
1414
export TELESCOPE_ENABLED=false
15-
export RABBITMQ_HOST=rabbitmq
16-
export RABBITMQ_PORT=5672
17-
export RABBITMQ_USER=laravel
18-
export RABBITMQ_PASSWORD=secret
19-
export RABBITMQ_VHOST=b2b-field
15+
16+
# RabbitMQ configuration - use environment variables if set, otherwise use defaults
17+
export RABBITMQ_HOST=${RABBITMQ_HOST:-rabbitmq}
18+
export RABBITMQ_PORT=${RABBITMQ_PORT:-5672}
19+
export RABBITMQ_USER=${RABBITMQ_USER:-laravel}
20+
export RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD:-secret}
21+
export RABBITMQ_VHOST=${RABBITMQ_VHOST:-b2b-field}
22+
23+
echo "RabbitMQ Configuration:"
24+
echo " Host: $RABBITMQ_HOST"
25+
echo " Port: $RABBITMQ_PORT"
26+
echo " User: $RABBITMQ_USER"
27+
echo " VHost: $RABBITMQ_VHOST"
2028

2129
echo "Checking AMQP extension..."
2230
if php -m | grep -q amqp; then
@@ -27,8 +35,7 @@ fi
2735

2836
# Clear any cache files that might cause issues
2937
rm -rf .phpunit.cache
30-
rm -rf .pest.cache
31-
find . -name "*.cache" -type f -delete 2>/dev/null || true
38+
rm -rf .phpunit.result.cache
3239

3340
# Run tests with PHPUnit directly
3441
echo "Running Unit Tests..."

tests/Pest.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)