composer
composer copied to clipboard
Extensions not working
Hi, I'm a bit new to GitHub Actions and I'm using the composer version to include PDO as well as PHPunit in my .yml I get this error when I run my Github Action:
13) App\test\model\ProductTest::testUpdateProduct
PDOException: could not find driver
So far this is my .yml:
name: CI
on:
push:
branches:
- OOP
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
php_version: "8.2"
php_extensions: pdo_mysql
- name: PHPUnit Tests
uses: php-actions/phpunit@master
with:
version: 9.6
bootstrap: vendor/autoload.php
configuration: ./phpunit.xml
args: --coverage-text
Am I doing something wrong?
Each step in your workflow runs isolated, so you're able to specify the PHP version and available extensions on the composer and phpunit step individually. You've specified the extension in the Composer step, but not on your unit tests, so PHPUnit won't be running in a container with access to that extension.