Skip to content

Latest commit

 

History

History
188 lines (122 loc) · 5.51 KB

CONTRIBUTING.md

File metadata and controls

188 lines (122 loc) · 5.51 KB

Contributing to Docusign bundle

First of all, thank you for contributing, you're awesome!

To have your code integrated in the Docusign bundle, there are some rules to follow, but don't panic, it's easy!

Reporting Bugs

If you happen to find a bug, we kindly request you to report it. However, before submitting it, please:

  • Check the documentation.

Then, if it appears that it's a real bug, you may report it using GitHub by following these 3 points:

  • Check if the bug is not already reported!
  • A clear title to resume the issue
  • A description of the workflow needed to reproduce the bug

NOTE: Don't hesitate giving as much information as you can (OS, PHP version extensions...)

Pull Requests

Writing a Pull Request

First of all, you must decide on what branch your changes will be based depending of the nature of the change. If this is a bug, you should target the branch where the bug appeared. If this is a new feature, you should target master.

Matching Coding Standards

The Docusign bundle follows Symfony coding standards. But don't worry, you can fix CS issues automatically using the PHP CS Fixer tool:

$ vendor/bin/php-cs-fixer fix

And then, add the fixed file to your commit before pushing. Be sure to add only your modified files. If any other file is fixed by cs tools, just revert it before committing.

Sending a Pull Request

When you send a PR, just make sure that:

  • You add valid test cases.
  • Tests are green.
  • You've added documentation when necessary
  • You make the PR on the same branch you based your changes on. If you see commits that you did not make in your PR, you're doing it wrong.
  • Also don't forget to add a comment when you update a PR with a ping to maintainer (@gregoirehebert or @vincentchalamon)
  • Squash your commits into one commit (see the next chapter).

All Pull Requests must include this header.

Static code analysis

vendor/bin/phpstan analyze

PHPUnit and Coverage Generation

To launch unit tests:

vendor/bin/phpunit

If you want coverage, you will need the phpdbg package and run:

phpdbg -qrr vendor/bin/phpunit --coverage-html coverage

Sometimes there might be an error with too many open files when generating coverage. To fix this, you can increase the ulimit, for example:

ulimit -n 4000

Coverage will be available in coverage/index.html.

Squash your Commits

If you have 3 commits, start with:

git rebase -i HEAD~3

An editor will be opened with your 3 commits, all prefixed by pick.

Replace all pick prefixes by fixup (or f) except the first commit of the list.

Save and quit the editor.

After that, all your commits will be squashed into the first one and the commit message will be the first one.

If you would like to rename your commit message, type:

git commit --amend

Now force push to update your PR:

git push --force-with-lease

Run the project locally

Create the features/.env.local.php file as following:

<?php

return [
    'DOCUSIGN_INTEGRATION_KEY' => 'your-personal-integration-key',
    'DOCUSIGN_USER_GUID' => 'your-personal-user-guid',
    'DOCUSIGN_ACCOUNT_ID' => your-personal-account-id,
    'DOCUSIGN_CLICKWRAP_ID' => 'your-clickwrap-id',
    'DOCUSIGN_API_ACCOUNT_ID' => 'your-api-account-id',
    'DOCUSIGN_SECRET' => 'your-secret',
    'DOCUSIGN_DEFAULT_SIGNER_NAME' => 'your-name',
    'DOCUSIGN_DEFAULT_SIGNER_EMAIL' => 'your-email',
    'DOCUSIGN_EMAIL' => 'your-docusign-email',
    'DOCUSIGN_PASSWORD' => 'your-docusign-password',
    'APP_ENV' => 'test',
    'APP_DEBUG' => true,
];

Then, you must define the following urls in the Redirect URIs section on DocuSign Admin:

https://127.0.0.1:8000 https://127.0.0.1:8000/docusign/authorization_code/embedded_auth_code https://127.0.0.1:8000/docusign/authorization_code/remote_auth_code

Finally, generate an RSA key pair on DocuSign and store the private key on features/var/jwt/docusign.pem.

Starting the demo project

You must install the Symfony binary, then start the server:

symfony serve --document-root=features/public

Then go to http://127.0.0.1:8000.

Debugging

The WebProfilerBundle is available at http://127.0.0.1:8000/_profiler/.

List of documents

To access the list of documents, you'll need to login as admin:4dm1n on http://127.0.0.1:8000/.

Running tests

You must add the following urls in the Redirect URIs section on DocuSign Admin:

http://127.0.0.1:9080 http://127.0.0.1:9080/docusign/authorization_code/embedded_auth_code http://127.0.0.1:9080/docusign/authorization_code/remote_auth_code

Detect and download the browser drivers automatically:

vendor/bin/bdi detect drivers

Then, run the following command to execute e2e tests:

vendor/bin/phpunit --testdox

License and Copyright Attribution

When you open a Pull Request to the Docusign bundle, you agree to license your code under the MIT license and to transfer the copyright on the submitted code to Grégoire Hébert.

Be sure to you have the right to do that (if you are a professional, ask your company)!

If you include code from another project, please mention it in the Pull Request description and credit the original author.