|
2 | 2 |
|
3 | 3 | # BEA - Sanitize Filename |
4 | 4 |
|
| 5 | +Current version: `2.0.9` |
| 6 | + |
5 | 7 | This plugin will remove all punctuation and accents from the filename of uploaded files, which is pretty handy. |
6 | 8 | You could then ask "Why it's not already into core?". This is [make WordPress core](https://core.trac.wordpress.org/ticket/22363) ! |
7 | 9 |
|
@@ -45,43 +47,44 @@ An [issue](https://github.com/BeAPI/bea-sanitize-filename/issues/1) is open abou |
45 | 47 |
|
46 | 48 | ### Introduction |
47 | 49 |
|
48 | | -The tests are based on [WP-Browser](https://github.com/lucatume/wp-browser). |
| 50 | +The tests are based on PHPUnit and run inside [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/). |
49 | 51 |
|
50 | | -You have WPUnit and Acceptance tests. |
| 52 | +Only unit tests are available. |
51 | 53 |
|
52 | 54 | ### Installation |
53 | 55 |
|
54 | | -1. Install [Lando](https://docs.devwithlando.io/installation/installing.html) |
55 | | -2. From command line into the project folder execute `./bin/lando-start.sh` |
56 | | -3. From command line into the project folder execute `lando composer install` |
57 | | - |
58 | | -The local url will be https://beasanitizefilename.lndo.site and credentials will be |
59 | | -* user : admin |
60 | | -* password : admin |
| 56 | +1. Install [Docker](https://www.docker.com/) and [Node.js](https://nodejs.org/) (>= 18) |
| 57 | +2. Install dependencies: `npm install && composer install` |
| 58 | +3. Run tests: `npm run test:unit` |
61 | 59 |
|
62 | 60 | ### Tools |
63 | 61 | To test the code, just launch : |
64 | | -* For Wpunit tests and desktop : `lando test-local` |
65 | | -* For desktop mobile : `lando test-mobile` |
66 | | - |
67 | | -If you need to test the code on BrowserStack, you need to define two environments variables : |
68 | | -* `BROWSERSTACK_USERNAME_REAL` : the usernmae of your browserStack account |
69 | | -* `BROWSERSTACK_KEY` : the key of your browserStack account |
70 | | - |
71 | | -/!\ Do not commit theses credentials /!\ |
72 | | - |
73 | | -## Customization |
74 | | - |
75 | | -Need to customize the environment variables ? every codeception file can be overrided bit by bit by creating a new file without the .dist. |
76 | | -So to customize the .env file you'l need to : |
77 | | - |
78 | | -* Create a codeception.yml file |
79 | | -* Put into the file : |
80 | | -``` |
81 | | -params: |
82 | | -- .env.local |
83 | | -``` |
84 | | -* Create a .env.local file and change the desired environment variables like `BROWSERSTACK_KEY` |
| 62 | +* For unit tests: `npm run test:unit` |
| 63 | +* For a readable report: `npm run test:unit:report` |
| 64 | +* For one-shot start + test + stop: `npm run test:unit:once` |
| 65 | + |
| 66 | +### Operating procedure |
| 67 | + |
| 68 | +1. Initialize once on your machine: |
| 69 | + - `npm install` |
| 70 | + - `composer install` |
| 71 | +2. Run test suite: |
| 72 | + - `npm run test:unit` |
| 73 | +3. Read result directly in terminal output: |
| 74 | + - Success: exit code `0` and PHPUnit success line. |
| 75 | + - Failure: exit code `1` or `2` with failing test names and stack traces. |
| 76 | +4. Stop environment if needed: |
| 77 | + - `npm run wp-env:stop` |
| 78 | + |
| 79 | +### Troubleshooting |
| 80 | + |
| 81 | +- Error `service "cli" is not running`: |
| 82 | + - `npm run wp-env:start` |
| 83 | + - `npm run test:unit` |
| 84 | +- If environment is corrupted: |
| 85 | + - `npm run wp-env:clean` |
| 86 | + - `npm run wp-env:start` |
| 87 | + - `npm run test:unit` |
85 | 88 |
|
86 | 89 | ## Changelog |
87 | 90 | Please refer to the [contributing guidelines](.github/CONTRIBUTING.md) to increase the chance of your pull request to be merged and/or receive the best support for your issue. |
|
0 commit comments