Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value with unit tests #40

Draft
wants to merge 3 commits into
base: feature/value-and-unit-field
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
14 changes: 14 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,17 @@ jobs:
docker network create frontend
docker compose run --rm --user root phpfpm composer install --no-scripts
docker compose run --rm --user root phpfpm bin/console biomejs:ci .

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
name: Run tests
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run tests
run: |
docker network create frontend
docker compose run --rm --user root phpfpm composer install --no-scripts
docker compose run --rm --user root phpfpm bin/phpunit
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@
/public/assets/
/assets/vendor/
###< symfony/asset-mapper ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
6 changes: 6 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,9 @@ tasks:
cmds:
- task composer -- update-api-spec
silent: true

test:
desc: "Run tests"
cmds:
- task compose -- exec phpfpm bin/phpunit {{.CLI_ARGS}}
silent: true
23 changes: 23 additions & 0 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@
"friendsofphp/php-cs-fixer": "^3.20",
"hautelook/alice-bundle": "^2.12",
"kocal/biome-js-bundle": "^1.3",
"symfony/browser-kit": "7.2.*",
"symfony/css-selector": "7.2.*",
"symfony/debug-bundle": "~7.2.0",
"symfony/maker-bundle": "*",
"symfony/phpunit-bridge": "^7.2",
"symfony/stopwatch": "~7.2.0",
"symfony/web-profiler-bundle": "~7.2.0",
"vincentlanglet/twig-cs-fixer": "^3.3",
Expand Down Expand Up @@ -84,12 +87,15 @@
}
},
"config": {
"//": "See https://github.com/api-platform/api-platform/issues/2437#issuecomment-1540620564 for details on why prepend-autoloader is set",
"allow-plugins": {
"ergebnis/composer-normalize": true,
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"optimize-autoloader": true,
"prepend-autoloader": false,
"sort-packages": true
},
"extra": {
Expand Down
Loading
Loading