This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f2abe5
commit d9869f4
Showing
12 changed files
with
60 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## Tool: | ||
We use `codeception` for testing. You shall have installed `codeception` via `composer` in order to run the tests. | ||
|
||
|
||
## How to write tests: | ||
All tests shall be in `__tests__/Unit/` folder. And shall be named as `*Test.php`. All test functions shall be named as `test*` (see example). | ||
|
||
Import sdk: | ||
|
||
```php | ||
require_once(dirname(dirname(__DIR__)) . '/vendor/autoload.php'); | ||
``` | ||
|
||
Good practice is to use `_before` to configure sdks APIs: | ||
```php | ||
|
||
//example | ||
protected function _before() | ||
{ | ||
//load .env | ||
$env = parse_ini_file('.env'); | ||
|
||
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Id', $env["X_APP_ID"]); | ||
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', $env["X_APP_TOKEN"]); | ||
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setHost($env["VOUCHERIFY_HOST"]); | ||
|
||
$this->productsApiInstance = new OpenAPI\Client\Api\ProductsApi( | ||
new GuzzleHttp\Client(), | ||
$config | ||
); | ||
$this->campaignsApiInstance = new OpenAPI\Client\Api\CampaignsApi( | ||
new GuzzleHttp\Client(), | ||
$config | ||
); | ||
$this->redemptionsApiInstance = new OpenAPI\Client\Api\RedemptionsApi( | ||
new GuzzleHttp\Client(), | ||
$config | ||
); | ||
} | ||
|
||
``` | ||
|
||
Test example: | ||
```php | ||
//example | ||
public function testListRedemptions() | ||
{ | ||
$this->redemptionsApiInstance->listRedemptions(1, 1); | ||
} | ||
``` | ||
|
||
|
||
## Environment variables: | ||
`.env` file shall be in the root of the project and shall contain `X_APP_ID`, `X_APP_TOKEN` and `VOUCHERIFY_HOST` variables. Check `.env.example` for reference. |
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters