|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Simple test runner using PHPUnit directly to avoid Pest configuration issues |
| 4 | +echo "Running LaravelRabbitMQ Tests..." |
| 5 | + |
| 6 | +# Set environment variables |
| 7 | +export APP_ENV=testing |
| 8 | +export BCRYPT_ROUNDS=4 |
| 9 | +export CACHE_DRIVER=array |
| 10 | +export DB_CONNECTION=testing |
| 11 | +export MAIL_MAILER=array |
| 12 | +export QUEUE_CONNECTION=sync |
| 13 | +export SESSION_DRIVER=array |
| 14 | +export TELESCOPE_ENABLED=false |
| 15 | +export RABBITMQ_HOST=127.0.0.1 |
| 16 | +export RABBITMQ_PORT=5673 |
| 17 | +export RABBITMQ_USER=laravel |
| 18 | +export RABBITMQ_PASSWORD=secret |
| 19 | +export RABBITMQ_VHOST=b2b-field |
| 20 | + |
| 21 | +echo "Checking AMQP extension..." |
| 22 | +if php -m | grep -q amqp; then |
| 23 | + echo "AMQP extension is available" |
| 24 | +else |
| 25 | + echo "AMQP extension is not available - this is expected in some environments" |
| 26 | +fi |
| 27 | + |
| 28 | +# Clear any cache files that might cause issues |
| 29 | +rm -rf .phpunit.cache |
| 30 | +rm -rf .pest.cache |
| 31 | +find . -name "*.cache" -type f -delete 2>/dev/null || true |
| 32 | + |
| 33 | +# Run tests with PHPUnit directly |
| 34 | +echo "Running Unit Tests..." |
| 35 | +if ./vendor/bin/phpunit --testsuite Unit --no-coverage --colors=never; then |
| 36 | + echo "Unit tests passed, running Feature tests..." |
| 37 | + if ./vendor/bin/phpunit --testsuite Feature --no-coverage --colors=never; then |
| 38 | + echo "All tests passed!" |
| 39 | + exit 0 |
| 40 | + else |
| 41 | + echo "Feature tests failed" |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | +else |
| 45 | + echo "Unit tests failed" |
| 46 | + exit 1 |
| 47 | +fi |
0 commit comments