Skip to content

Commit d4989bc

Browse files
committed
feat: update alchemy docs
1 parent d60e5b1 commit d4989bc

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

src/docs/utils/testing.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ leaf install alchemy
1515
```
1616

1717
```bash:no-line-numbers [Composer]
18-
composer require leafs/alchemy
18+
composer require leafs/alchemy --dev
1919
```
2020

2121
:::
2222

23-
Once installed, Alchemy will automatically set up an `alchemy.yml` file in your project's root which you can use to configure your tests, linting and github actions.
23+
Once installed, you need to run the setup command to configure Alchemy for your project.
24+
25+
```bash:no-line-numbers
26+
./vendor/bin/alchemy install
27+
```
28+
29+
This will automatically set up an `alchemy.yml` file in your project's root which you can use to configure your tests, linting and github actions. It also sets up commands for testing and linting in your `composer.json` file.
2430

2531
## Configuring Alchemy
2632

@@ -39,7 +45,8 @@ tests:
3945
files:
4046
- '*.test.php'
4147
coverage:
42-
processUncoveredFiles: true
48+
local: false
49+
actions: true
4350

4451
lint:
4552
preset: PSR12
@@ -52,31 +59,37 @@ actions:
5259
run:
5360
- lint
5461
- tests
62+
os:
63+
- ubuntu-latest
5564
php:
56-
extensions: json, zip
65+
extensions: json, zip, dom, curl, libxml, mbstring
5766
versions:
5867
- '8.3'
59-
event:
68+
events:
6069
- push
6170
- pull_request
6271
```
6372
64-
You can make edits to this file to suit your needs. The `app` key is an array of directories to look for your app files in. The `tests` key is an array of configurations for your tests. The `lint` key is an array of configurations for your code styling checks. Once you're done setting up your `alchemy.yml` file, you can run the setup script.
73+
You can make edits to this file to suit your needs. The `app` key is an array of directories to look for your app files in. The `tests` key is an array of configurations for your tests. The `lint` key is an array of configurations for your code styling checks. Once you're done setting up your `alchemy.yml` file, you can run your test command, lint command, GitHub actions command or the alchemy command to do all of that at once.
6574

6675
::: code-group
6776

6877
```bash:no-line-numbers [Leaf CLI]
69-
leaf run alchemy
78+
leaf run test # Generate/Run tests
79+
leaf run lint # Generate/Run code styling checks
80+
leaf run actions # Generate GitHub Actions
81+
leaf run alchemy # Run all of the above
7082
```
7183

7284
```bash:no-line-numbers [Composer]
73-
composer run alchemy
85+
composer run test # Generate/Run tests
86+
composer run lint # Generate/Run code styling checks
87+
composer run actions # Generate GitHub Actions
88+
composer run alchemy # Run all of the above
7489
```
7590

7691
:::
7792

78-
This will install your test engine, PHP CS Fixer and any other dependencies you might need, and then generate dummy tests using the test engine you chose. It will then lint your code, run your tests and also add `test` and `lint` commands to your `composer.json` file which you can use to run your tests and lint your code respectively. Finally, Alchemy will generate a `.github/workflows` directory with a `tests.yml` file and a `lint.yml` file which you can use to run your tests and linting on github actions.
79-
8093
## Configuring Tests
8194

8295
If you don't want to use Pest, Alchemy also supports PHPUnit. You can change the testing framework by editing the `alchemy.yml` file in your project root, add your tests to the `tests` directory, and run the test command again. You don't need to worry about setting up PHPUnit or Pest as Alchemy will handle that for you.
@@ -96,7 +109,8 @@ tests:
96109
files:
97110
- '*.test.php'
98111
coverage:
99-
processUncoveredFiles: true
112+
local: false
113+
actions: true
100114
```
101115

102116
- `app`: This is a list of directories that contain your application code. Alchemy will use these directories to lint your code and also in code coverage reports. If you want to use the root directory, you can just remove the entire `app` section.
@@ -110,7 +124,7 @@ tests:
110124
- `tests.files`: The files to look for tests in.
111125

112126
- `tests.coverage`: Configuration for code coverage.
113-
- You can set `processUncoveredFiles` to `true` to process files that are not covered by tests.
127+
- You can configure `local` to generate code coverage reports locally. By default, Alchemy will generate code coverage reports only on GitHub Actions.
114128
- You can also set `include` to include specific directories in your code coverage report. By default Alchemy will just use the directories defined in the `app` configuration.
115129

116130
If you don't want code coverage reports, you can just remove the entire `coverage` section.
@@ -164,6 +178,10 @@ actions:
164178
run:
165179
- lint
166180
- tests
181+
os:
182+
- ubuntu-latest
183+
- windows-latest
184+
- macos-latest
167185
php:
168186
extensions: json, zip
169187
versions:

0 commit comments

Comments
 (0)