Skip to content

Commit 6b560d8

Browse files
pesektomas66Ton99
authored andcommitted
updated contributing
1 parent fdb4874 commit 6b560d8

File tree

2 files changed

+21
-53
lines changed

2 files changed

+21
-53
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,42 @@ Contributing
88
cd /path/to/your/projects
99
git clone https://github.com/formapro/JsFormValidatorBundle.git
1010
```
11-
2) Install vendors
11+
2) Install vendors via docker
1212
```bash
1313
cd JsFormValidatorBundle
14-
php composer.phar install --dev
14+
docker-compose up -d
15+
docker exec -it PHP-CONTAINER-NAME bash
16+
composer install --dev
1517
```
16-
3) Install assests
17-
```bash
18-
Tests/app/console assets:install Tests/app
19-
```
20-
4) Fix permissions
21-
```bash
22-
sudo chmod -R 0777 Tests/app/cache Tests/app/logs Resources/public/js/fp_js_validator.js
23-
```
24-
5) Create a new virtual host and set the ```Tests/app``` directory as a root
25-
6) Restart apache
18+
4) Create var folder and set permissions
2619
```bash
27-
sudo service apache2 restart
20+
mkdir Tests/app/var
21+
sudo chmod -R 0777 Tests/app/var
2822
```
29-
7) Copy the ```Tests/app/Resources/local_config.php.tpl``` file as local_config.php
30-
8) Open this file and change the host name to your own
31-
9) Run selenium. If you do not have it yet:
23+
3) Install assests
3224
```bash
33-
curl http://selenium.googlecode.com/files/selenium-server-standalone-2.33.0.jar > selenium.jar
34-
java -jar selenium.jar
25+
npm i
26+
27+
cd Tests/app/
28+
./bin/console assets:install Tests/app/public
29+
npm run build
3530
```
36-
10) Run tests
31+
4) Run tests
3732
```bash
38-
phpunit
33+
npm run test
3934
```
4035

4136
## Tests
4237

43-
Basically the bundle covered by functional selenium tests
38+
Basically the bundle covered by unit jest's test and e2e cypress test.
4439
The main test case is placed in ```Tests/Functional/MainFunctionalTest.php```
45-
It calls pages which are defined in ```Tests/TestBundles/DefaultTestBundle```
46-
47-
The main idea of most tests is:
48-
1) create an action ```mytestAction``` in ```Tests/TestBundles/DefaultTestBundle/Controller/FunctionalTestsController.php``` with a form that has specified list of validation rules
49-
1.1) use a general route to call this action ```test/{controller}/{type}/{js}```
50-
1.2) so, in your action you can get the ```$type``` and ```$js``` parameters
51-
1.3) ```type``` variable can be used to check if the form should be filled out with valid or invalid data (1/0)
52-
1.4) ```js``` variable - to check if JS should be enabled or disabled (1/0)
53-
2) bind valid values to the form (call with ```type = 1```)
54-
3) call this form with disabled JS (native Symfony validation) and get the list of errors ```test/mytest/1/0``` (1 - form is valid, 0 - js is disabled)
55-
4) call the form with enabled JS (here works our bundle) and get list of errors ```test/mytest/1/1``` (1 - form is valid, 1- js is enabled)
56-
5) compare errors from #3 and #4 steps - they should be equal
57-
6) bind invalid values to the form (call with ```type = 0```)
58-
7) repeat steps #3, #4, #5 (```test/mytest/0/0``` and ```test/mytest/0/0```)
40+
Unit tests are placed in main resource folder with suffix ```.test.js```
41+
e2e test is placed in cypress folder in project root ```cypress/integration/form_spec.js```
5942

60-
[How to run tests on a real project](Resources/doc/4.md)
43+
The main idea of unit tests is covered constrain logic.
44+
The main idea of e2e test is visit route with example form with all symfony constraint and find used error messages.
6145

6246
## Javascripts
6347

6448
All the javascripts placed in the ```Resources/pulic/js``` folder
65-
All of them are merged and included by assetic bundle for the dev/test environments.
66-
The ```/Resources/public/js/fp_js_validator.js``` file is a merged library that uses as main included file.
67-
Thera no reason to edit this file becauset it is updated automatically each time when you run dev/test
49+
All of them are merged and included by assets command to the dev/test environments.

src/Resources/doc/4.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)