Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.92 KB

CONTRIBUTING.md

File metadata and controls

64 lines (47 loc) · 1.92 KB

Testing

The only thing you need to have for testing is Docker.

Use Docker images to test and collect coverage (as it requires composer and xdebug).

It is more convenient to use included makefile scripts:

$ make docker-build-7
$ make docker-login-7

And then inside docker console:

$ composer update
$ composer install --prefer-dist --no-interaction
$ composer test
$ composer phar         # this is only for CI
$ composer coveralls    # this is only for CI

Run the OAuth smoke tests

After installing the dependencies, export RINGCENTRAL_SERVER_URL, RINGCENTRAL_CLIENT_ID, and RINGCENTRAL_CLIENT_SECRET for an app configured for the grant you are testing and authorized to read account details. Each test requests an access token and checks that GET /restapi/v2/accounts/~ returns an account ID, then prints the account response as JSON. A failed check exits with status 1.

Add --test-renewal to either smoke test command to simulate expiry. The test requires a valid refresh token from the initial login and verifies that the SDK makes exactly one refresh-token exchange and that the next lookup returns the same account ID.

JWT

Export RINGCENTRAL_JWT with the JWT for the user you want to authenticate.

php api-test/jwt-smoke.php
php api-test/jwt-smoke.php --test-renewal

Authorization code

Register http://localhost:5000/oauth2callback as a redirect URI for the app, or set RINGCENTRAL_REDIRECT_URI to another registered HTTP loopback URI with an explicit port. Run the test, then open the URL printed in your terminal and authorize the app. The test uses PKCE and waits up to five minutes for the browser callback.

php api-test/auth-code-smoke.php
php api-test/auth-code-smoke.php --test-renewal

Links