You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ Let's get into it.
24
24
25
25
-[Installation](#installation)
26
26
-[Frontend Build](#frontend-build)
27
+
27
28
-[Hooks](#hooks)
28
29
-[Configuration](#configuration)
29
30
-[Custom Routes](#custom-routes)
@@ -85,6 +86,48 @@ HMR is configured by default to use `http://localhost:5173` for serving assets.
85
86
86
87
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.
87
88
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
+
88
131
## Hooks
89
132
90
133
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