Level 102
Do you have a Feature folder in tests?
Curious why the whole app is inside src? I have never seen this before
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hello , I have been trying to run a test on GIT Actions . Everything is working , but the test is not working . this is my code -
# GitHub Action for Laravel with MySQL and Redis
name: Testing Laravel with MySQL
on: [push, pull_request]
jobs:
laravel:
name: Laravel (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
env:
DB_DATABASE: laravel
DB_USERNAME: root
DB_PASSWORD: password
BROADCAST_DRIVER: log
CACHE_DRIVER: redis
QUEUE_CONNECTION: redis
SESSION_DRIVER: redis
# Docs: https://docs.github.com/en/actions/using-containerized-services
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: laravel
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-versions: ['8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug
# Local MySQL service in GitHub hosted environments is disabled by default.
# If you are using it instead of service containers, make sure you start it.
# - name: Start mysql service
# run: sudo systemctl start mysql.service
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
working-directory: ./src
run: composer install --no-interaction
- name: Prepare the application
working-directory: ./src
run: |
php -r "file_exists('.env') || copy('.env.example', '.env');"
php artisan key:generate
- name: Clear Config
working-directory: ./src
run: php artisan config:clear
- name: Migrate Test Database
working-directory: ./src
run: php artisan migrate --env=testing --seed --force
env:
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
- name: Change Directory Permissions
working-directory: ./src
run: chmod -R 777 storage bootstrap/cache
- name: Execute tests (Unit and Feature tests) via PHPUnit
working-directory: ./src
run: php artisan test
It is showing this error -
Execute tests (Unit and Feature tests) via PHPUnit
Run php artisan test
Warning: TTY mode requires /dev/tty to be read/writable.
PHPUnit 9.5.21 #StandWithUkraine
Test directory "/home/runner/work/laravel-docker-enviroment/laravel-docker-enviroment/src/./tests/Feature" not found
Error: Process completed with exit code 2.
I tried as well run like -
- name: Execute tests (Unit and Feature tests) via PHPUnit
working-directory: ./src
run: vendor/bin/phpunit
- name: Execute tests (Unit and Feature tests) via PHPUnit
working-directory: ./src
run: ./vendor/bin/phpunit
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: ./vendor/bin/phpunit
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: php ./vendor/bin/phpunit
- name: Execute tests (Unit and Feature tests) via PHPUnit
working-directory: ./src
run: php ./vendor/bin/phpunit
....
Please or to participate in this conversation.