-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8a65cf
commit 7b57a94
Showing
2 changed files
with
32 additions
and
93 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,58 @@ | ||
# Testing | ||
|
||
## Installation | ||
## Requirements | ||
|
||
1. To be able to run yarn build correctly, create symlink for `node_modules` : | ||
You'll need: | ||
|
||
```bash | ||
ln -s tests/Application/node_modules node_modules | ||
``` | ||
- PHP 7.4 minimum. | ||
- docker, for the database. | ||
- symfony CLI, to run the local server. | ||
- composer, to install PHP dependencies. | ||
- npm and yarn, to install ui dependencies and build the JS/CSS files. | ||
|
||
2. From the plugin root directory, run the following commands: | ||
## Installation | ||
|
||
```bash | ||
$ (cd tests/Application && yarn install) | ||
$ (cd tests/Application && yarn build) | ||
$ (cd tests/Application && bin/console assets:install public -e test) | ||
$ (cd tests/Application && bin/console doctrine:database:create -e test) | ||
$ (cd tests/Application && bin/console doctrine:schema:create -e test) | ||
``` | ||
```bash | ||
make install | ||
``` | ||
|
||
To be able to setup the plugin's database, remember to configure your database credentials in `tests/Application/.env` | ||
and `tests/Application/.env.test`. You can also add custom configuration in `tests/Application/.env.test.local`. | ||
This will run a Sylius app (the one in `tests/Application/`) with the plugin | ||
installed and all Sylius' sample data. It uses the symfony binary. | ||
|
||
## Usage | ||
|
||
### Running plugin tests | ||
### List all available commands | ||
|
||
- PHPUnit | ||
```bash | ||
make help | ||
``` | ||
|
||
```bash | ||
$ vendor/bin/phpunit | ||
``` | ||
### Running minimum plugin tests | ||
|
||
- PHPSpec | ||
- PHPUnit | ||
|
||
```bash | ||
$ vendor/bin/phpspec run | ||
make test.phpunit | ||
``` | ||
- PHPStan | ||
|
||
- PHP CS fixer | ||
|
||
```bash | ||
$ vendor/bin/phpstan analyse src | ||
make test.phpcs | ||
``` | ||
|
||
### Opening Sylius with the plugin | ||
> Tip: You can fix your code with `make test.phpcs.fix`! | ||
|
||
- Using `test` environment: | ||
- PHPSpec | ||
|
||
```bash | ||
$ (cd tests/Application && bin/console sylius:fixtures:load -e test) | ||
$ (cd tests/Application && bin/console server:run -d public -e test) | ||
make test.phpspec | ||
``` | ||
- Using `dev` environment: | ||
|
||
- PHPStan | ||
|
||
```bash | ||
$ (cd tests/Application && bin/console sylius:fixtures:load -e dev) | ||
$ (cd tests/Application && bin/console server:run -d public -e dev) | ||
make test.phpstan | ||
``` | ||
|
||
> Tip: You can run all tests with `make test.all`! |