Skip to content

Commit a8f10e4

Browse files
committed
Adds info about testing and code quality to the readme.
1 parent 91e242f commit a8f10e4

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Let's get into it.
2424

2525
- [Installation](#installation)
2626
- [Frontend Build](#frontend-build)
27+
2728
- [Hooks](#hooks)
2829
- [Configuration](#configuration)
2930
- [Custom Routes](#custom-routes)
@@ -85,6 +86,48 @@ HMR is configured by default to use `http://localhost:5173` for serving assets.
8586

8687
When running `npm run dev`, you'll still be using the normal URL for your development environment when viewing the site in your browser, since vite is configured to only have assets served up by Node.
8788

89+
## Testing & Code Quality
90+
91+
Mill 4 includes a basic automated testing setup for running unit and integration tests. To run the tests, run the following command:
92+
93+
```bash
94+
% composer test
95+
```
96+
97+
This will run the tests and generate a coverage report. You can also run the tests in a specific test suite. For example:
98+
99+
```bash
100+
% composer test:unit
101+
```
102+
103+
```bash
104+
% composer test:integration
105+
```
106+
107+
### Mocking
108+
109+
Included as a dev dependency is [Brain Monkey](https://github.com/Brain-WP/Brain-Monkey), which provides a mocking framework for PHPUnit. You can use it to mock functions, classes, and methods in your tests.
110+
111+
Also included is [WorDBless](https://github.com/Automattic/wordbless), which allows you to use WordPress core functions in your PHPUnit tests without having to set up a database and the whole WordPress environment.
112+
113+
### Code Quality
114+
115+
Mill 4 includes PHP-CS-Fixer for checking and fixing code style. The configuration is stored in the `.php-cs-fixer.php` file. You can run the following command to check the code style:
116+
117+
```bash
118+
% composer cs-check
119+
```
120+
121+
You can also run the following command to fix the code style:
122+
123+
```bash
124+
% composer cs-fix
125+
```
126+
127+
### Continuous Integration
128+
129+
Mill 4 is configured by default to run tests and code quality checks on every push to GitHub. You can view the workflow in the `.github/workflows` directory.
130+
88131
## Hooks
89132

90133
Mill 4 includes a basic hooks system for registering actions and filters. While it's not strictly necessary to use it (there's nothing stopping you from registering your own actions and filters in the theme's `functions.php` file), it's a handy way to organize your code.

0 commit comments

Comments
 (0)