Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
pull_request:
branches:
- master
types:
- opened
- synchronize
- reopened
- ready_for_review

jobs:
test:
Expand Down Expand Up @@ -57,4 +62,4 @@ jobs:
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: vendor/bin/phpspec
run: vendor/bin/phpunit
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ composer.lock
mm.log
/vin
/bin
/tests
.phpunit.result.cache
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ For more details on application configuration, see `README.md`.

## Testing

This project uses PHPSpec. PHPSpec leverages mocks so that we only test the code that we have written and assume that external libraries and integrations, such as the Salesforce REST API, are working correctly. You can read more about PHPSpec here: `http://www.phpspec.net/en/stable/`
This project uses PHPUnit for unit coverage. The test suite focuses on package behavior with mocked collaborators and PSR-7 responses rather than live Salesforce integration tests.

Run package tests from the Forrest directory, not the Laravel application root:

1. `cd libraries/forrest`
2. `composer update`
3. `vendor/bin/phpspec run` (it should be fast!)
3. `vendor/bin/phpunit`

All tests are located in the `spec` folder and use namespaces that mirror the files in `src`.
All tests are located in the `tests` folder and generally mirror the areas under `src`.

If you add new test methods, please use descriptive method naming. For instance, `it_should_not_call_refresh_method_if_there_is_no_token`
If you add new test methods, please use descriptive names that explain the behavior being asserted.
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@
"guzzlehttp/guzzle": "~6.0|~7.0"
},
"require-dev": {
"phpspec/phpspec": "~6.0|~7.0|^8.0"
"phpunit/phpunit": "^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.0"
},
"autoload": {
"psr-4": {
"Omniphx\\Forrest\\": "src/Omniphx/Forrest/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"test": "vendor/bin/phpspec run"
"test": "vendor/bin/phpunit"
},
"config": {
"sort-packages": true
Expand Down
4 changes: 0 additions & 4 deletions phpspec.yml

This file was deleted.

8 changes: 8 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Forrest">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
Loading