Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
FIXTURES_SIZE=none
34 changes: 34 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Execute CI tests

on:
push:
branches:
- main
pull_request: ~

jobs:
test-smoke:
name: Run smoke tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install the project for test environment
run: make test-install

- name: Run smoke tests
run: make test-smoke

test-functional:
name: Run functional tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install the project for test environment
run: make test-install

- name: Run functional tests
run: make test-functional
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ compose.override.yaml
###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###

###> phpunit/phpunit ###
/.phpunit.cache/
###< phpunit/phpunit ###
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('var')
->notPath([
'tests/bootstrap.php',
])
;

return (new PhpCsFixer\Config())
Expand Down
28 changes: 27 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ RUN_PHP_ALONE=$(DOCKER_COMPOSE) run --no-deps --rm $(DOCKER_PHP_CONTAINER)
COMPOSER=$(EXEC_PHP) composer
CONSOLE=$(EXEC_PHP) bin/console

test-%: RUN_PHP=$(DOCKER_COMPOSE) run --rm --env APP_ENV=test --env XDEBUG_MODE=off $(DOCKER_PHP_CONTAINER)
test-%: CONSOLE=$(RUN_PHP) bin/console
test-%: COMPOSER=$(RUN_PHP) composer

##
###--------------#
### Docker #
Expand Down Expand Up @@ -54,8 +58,9 @@ start: up ## Alias for up
start-all: up-all ## Alias for up-all

install: pull compose.override.yaml up vendor db-schema-force generate-keypair db-fixtures ## Install the project
test-install: pull vendor generate-keypair db-create db-schema-force db-fixtures ## Install the project for test environment.

.PHONY: up stop down pull sh build bash start start-all install
.PHONY: up stop down pull sh build bash start start-all install test-install

##
###----------------#
Expand Down Expand Up @@ -105,6 +110,27 @@ db-execute-down: ## Execute the latest migration versions down manually.
.PHONY: db-create db-drop db-migrate db-validate db-schema db-schema-force db-diff db-update
.PHONY: db-fixtures fixtures db-execute-up db-execute-down

##
###-------------#
### Tests #
###-------------#
##

test-smoke: ## Run smoke tests
$(RUN_PHP) bin/phpunit --no-extensions --testsuite smoke

test-debug: ## Run tests with debug group/tags
$(RUN_PHP) bin/phpunit --group debug

test-functional: ## Run functional tests
$(RUN_PHP) bin/phpunit --testsuite functional

tests: test-smoke test-functional ## Execute all tests
ts: test-smoke ## Alias for test-smoke
tf: test-functional ## Alias for test-functional

.PHONY: test-smoke test-debug tests test-functional ts tf

##
###-----------------#
### Q&A tools #
Expand Down
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';
}
2 changes: 2 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ services:
depends_on:
postgres:
condition: service_healthy
maildev:
condition: service_started
volumes:
- "./:/var/www:rw"
environment:
Expand Down
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"symfony/framework-bundle": "7.2.*",
"symfony/intl": "7.2.*",
"symfony/mailer": "7.2.*",
"symfony/monolog-bundle": "^3.10",
"symfony/property-access": "7.2.*",
"symfony/property-info": "7.2.*",
"symfony/runtime": "7.2.*",
Expand All @@ -52,12 +53,17 @@
"symfony/yaml": "7.2.*"
},
"require-dev": {
"dama/doctrine-test-bundle": "^8.3",
"doctrine/doctrine-fixtures-bundle": "^4.1",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^2.1.17",
"phpstan/phpstan-doctrine": "^2.0.3",
"phpstan/phpstan-strict-rules": "^2.0.4",
"phpstan/phpstan-symfony": "^2.0.6",
"phpunit/phpunit": "^12.2",
"symfony/browser-kit": "7.2.*",
"symfony/css-selector": "7.2.*",
"symfony/http-client": "7.2.*",
"symfony/maker-bundle": "^1.63",
"symfony/stopwatch": "7.2.*",
"symfony/web-profiler-bundle": "7.2.*",
Expand Down
Loading