mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-22 00:51:01 +00:00
Merge pull request #7163 from yguedidi/run-tests-with-phpunit-directly
Run tests with PHPUnit directly
This commit is contained in:
commit
709abfb564
5 changed files with 58 additions and 29 deletions
5
.github/CONTRIBUTING.md
vendored
5
.github/CONTRIBUTING.md
vendored
|
@ -52,8 +52,9 @@ All pull requests need to pass the tests and the code needs match the style guid
|
|||
|
||||
To run the tests locally run:
|
||||
|
||||
- when testing using Docker: `docker-compose run --rm php make test`
|
||||
- otherwise: `make test`
|
||||
- when testing using Docker: `docker-compose run --rm php bin/phpunit` (or `docker-compose run --rm php make test` if you
|
||||
prefer using `make`)
|
||||
- otherwise: `bin/phpunit` (or `make test`)
|
||||
|
||||
To run the PHP formatter:
|
||||
|
||||
|
|
14
.github/workflows/continuous-integration.yml
vendored
14
.github/workflows/continuous-integration.yml
vendored
|
@ -75,11 +75,8 @@ jobs:
|
|||
with:
|
||||
composer-options: "--optimize-autoloader --prefer-dist"
|
||||
|
||||
- name: "Prepare database"
|
||||
run: "make prepare DB=${{ matrix.database }}"
|
||||
|
||||
- name: "Prepare fixtures"
|
||||
run: "make fixtures"
|
||||
- name: "Prepare database configuration"
|
||||
run: cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
|
||||
|
||||
- name: "Run PHPUnit"
|
||||
run: "php bin/phpunit -v"
|
||||
|
@ -146,11 +143,8 @@ jobs:
|
|||
with:
|
||||
composer-options: "--optimize-autoloader --prefer-dist"
|
||||
|
||||
- name: "Prepare database"
|
||||
run: "make prepare DB=${{ matrix.database }}"
|
||||
|
||||
- name: "Prepare fixtures"
|
||||
run: "make fixtures"
|
||||
- name: "Prepare database configuration"
|
||||
run: cp app/config/tests/parameters_test.${{ matrix.database }}.yml app/config/parameters_test.yml
|
||||
|
||||
- name: "Run PHPUnit"
|
||||
run: "php bin/phpunit -v"
|
||||
|
|
18
GNUmakefile
18
GNUmakefile
|
@ -14,9 +14,6 @@ endif
|
|||
help: ## Display this help menu
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
clean: ## Clear the application cache
|
||||
rm -rf var/cache/*
|
||||
|
||||
install: ## Install wallabag with the latest version
|
||||
@./scripts/install.sh $(ENV)
|
||||
|
||||
|
@ -34,18 +31,7 @@ build: ## Run webpack
|
|||
@yarn install
|
||||
@yarn build:$(ENV)
|
||||
|
||||
prepare: clean ## Prepare database for testsuite
|
||||
ifdef DB
|
||||
cp app/config/tests/parameters_test.$(DB).yml app/config/parameters_test.yml
|
||||
endif
|
||||
-php bin/console doctrine:database:drop --force --env=test
|
||||
php bin/console doctrine:database:create --env=test
|
||||
php bin/console doctrine:migrations:migrate --no-interaction --env=test -vv
|
||||
|
||||
fixtures: ## Load fixtures into database
|
||||
php bin/console doctrine:fixtures:load --no-interaction --env=test
|
||||
|
||||
test: prepare fixtures ## Launch wallabag testsuite
|
||||
test: ## Launch wallabag testsuite
|
||||
XDEBUG_MODE=off php -dmemory_limit=-1 bin/phpunit -v
|
||||
|
||||
release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`).
|
||||
|
@ -57,6 +43,6 @@ endif
|
|||
deploy: ## Deploy wallabag
|
||||
@bundle exec cap staging deploy
|
||||
|
||||
.PHONY: help clean prepare install fixtures update build test release deploy run dev
|
||||
.PHONY: help install update build test release deploy run dev
|
||||
|
||||
.DEFAULT_GOAL := install
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
>
|
||||
|
||||
<testsuites>
|
||||
|
|
48
tests/bootstrap.php
Normal file
48
tests/bootstrap.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
(new Filesystem())->remove(__DIR__ . '/../var/cache/test');
|
||||
|
||||
(new Process([
|
||||
'php',
|
||||
__DIR__ . '/../bin/console',
|
||||
'doctrine:database:drop',
|
||||
'--force',
|
||||
'--env=test',
|
||||
]))->run(function ($type, $buffer) {
|
||||
echo $buffer;
|
||||
});
|
||||
|
||||
(new Process([
|
||||
'php',
|
||||
__DIR__ . '/../bin/console',
|
||||
'doctrine:database:create',
|
||||
'--env=test',
|
||||
]))->mustRun(function ($type, $buffer) {
|
||||
echo $buffer;
|
||||
});
|
||||
|
||||
(new Process([
|
||||
'php',
|
||||
__DIR__ . '/../bin/console',
|
||||
'doctrine:migrations:migrate',
|
||||
'--no-interaction',
|
||||
'--env=test',
|
||||
'-vv',
|
||||
]))->mustRun(function ($type, $buffer) {
|
||||
echo $buffer;
|
||||
});
|
||||
|
||||
(new Process([
|
||||
'php',
|
||||
__DIR__ . '/../bin/console',
|
||||
'doctrine:fixtures:load',
|
||||
'--no-interaction',
|
||||
'--env=test',
|
||||
]))->mustRun(function ($type, $buffer) {
|
||||
echo $buffer;
|
||||
});
|
Loading…
Reference in a new issue