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
+42-2
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,9 @@ Welcome to the readme for Mercado Pago Payment Gateway Plugin. This guide is int
24
24
25
25
8.[Contributing](#contributing)
26
26
27
-
9.[Support and Issues](#support-and-issues)
27
+
9.[Running Tests](#running-tests)
28
+
29
+
10.[Support and Issues](#support-and-issues)
28
30
29
31
30
32
@@ -114,7 +116,45 @@ class ExamplePaymentTransaction extends AbstractPaymentTransaction {
114
116
In this example, the `ExamplePaymentTransaction` class extends the payment transaction functionality and can be customized as needed.
115
117
116
118
You can see more on the github wiki page.
117
-
119
+
120
+
## Running Tests
121
+
122
+
This project uses [PHPUnit](https://phpunit.de/) for automated testing and generating code coverage reports. Follow the instructions below to run tests and generate coverage reports.
123
+
124
+
### Requirements
125
+
126
+
Ensure that all dependencies are installed by running:
127
+
128
+
```bash
129
+
composer install
130
+
```
131
+
132
+
### Test Commands
133
+
134
+
To run all project tests and generate HTML code coverage reports, you can use the pre-configured commands in `composer.json`.
135
+
136
+
- Run all tests:
137
+
138
+
```bash
139
+
composer phpunit
140
+
```
141
+
This command will execute all tests in the project and display results in the terminal.
142
+
143
+
- Run a specific test file:
144
+
```bash
145
+
composer phpunit-file path/to/your/testfile.php
146
+
```
147
+
This command allows you to focus on a single test file, which is useful for development and debugging.
148
+
149
+
### Code Coverage Reports
150
+
After running the tests, a coverage directory will be generated in the project root, containing the reports in HTML format. You can view the reports by opening coverage/index.html in a browser.
151
+
152
+
### How to mock Wordpress
153
+
154
+
To mock WordPress functions and classes in your unit tests, you can use the `WP_Mock` library. It simplifies the creation of mocks and stubs forWordPress functions, allowing you to test your codein isolation.
155
+
156
+
For more information, refer to the [WP_Mock documentation](https://wp-mock.gitbook.io/documentation).
0 commit comments