diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fc046f5..2ca725a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -168,6 +168,12 @@ 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: + +```shell +vendor/bin/bdi detect drivers +``` + Then, run the following command to execute e2e tests: ```shell diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9727563..f632022 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,6 +115,7 @@ jobs: run: | mkdir -p build/screenshots build/logs/phpunit openssl aes-256-cbc -d -a -pbkdf2 -salt -in features/var/jwt/docusign.pem.enc -out features/var/jwt/docusign.pem -pass env:DOCUSIGN_RSA_PASSPHRASE + vendor/bin/bdi detect drivers - name: Run PHPUnit tests with coverage if: matrix.coverage diff --git a/.gitignore b/.gitignore index 20138be..85f8fc1 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /features/.env.* !features/var/storage/dummy.pdf /completed.pdf +/drivers/ diff --git a/composer.json b/composer.json index 8891da0..f8d29cd 100644 --- a/composer.json +++ b/composer.json @@ -43,6 +43,7 @@ "webmozart/assert": "^1.5" }, "require-dev": { + "dbrekelmans/bdi": "^0.3.0", "doctrine/annotations": "^1.11", "league/flysystem-bundle": "^1.2", "nyholm/symfony-bundle-test": "dev-master", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d079da4..7d34460 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,7 +10,7 @@ - + diff --git a/src/Controller/Callback.php b/src/Controller/Callback.php index 7883b04..4513f71 100644 --- a/src/Controller/Callback.php +++ b/src/Controller/Callback.php @@ -23,9 +23,8 @@ final class Callback implements TranslatorAwareInterface { - public const EVENT_COMPLETE = 'signing_complete'; - use TranslatorAwareTrait; + public const EVENT_COMPLETE = 'signing_complete'; public function __invoke(Request $request, EventDispatcherInterface $eventDispatcher): Response { diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index bf6d3fd..f9856df 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -158,7 +158,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->validate() ->ifString() ->then(static function ($v) { - @trigger_error('The "grant_type" configuration key has been deprecated since 5.3.0 and will be removed in 6.0. Implicit authentication should not be used in this bundle.', E_USER_DEPRECATED); + @trigger_error('The "grant_type" configuration key has been deprecated since 5.3.0 and will be removed in 6.0. Implicit authentication should not be used in this bundle.', \E_USER_DEPRECATED); return $v; }) diff --git a/src/DependencyInjection/DocusignExtension.php b/src/DependencyInjection/DocusignExtension.php index cf71d77..71afda3 100644 --- a/src/DependencyInjection/DocusignExtension.php +++ b/src/DependencyInjection/DocusignExtension.php @@ -89,7 +89,7 @@ public function load(array $configs, ContainerBuilder $container): void // Clickwrap mode if (EnvelopeBuilder::MODE_CLICKWRAP === $value['mode']) { $clickwrapExtensionDefinition->addMethodCall('addConfig', [$name, $value['demo'], [ - 'environment' => pathinfo($value['api_uri'], PATHINFO_DIRNAME), + 'environment' => pathinfo($value['api_uri'], \PATHINFO_DIRNAME), 'accountId' => $value['auth_clickwrap']['api_account_id'], 'clientUserId' => $value['auth_clickwrap']['user_guid'], 'clickwrapId' => $value['auth_clickwrap']['clickwrap_id'], diff --git a/src/EnvelopeCreator/DefineEnvelope.php b/src/EnvelopeCreator/DefineEnvelope.php index e67e2eb..aa6d629 100644 --- a/src/EnvelopeCreator/DefineEnvelope.php +++ b/src/EnvelopeCreator/DefineEnvelope.php @@ -24,9 +24,8 @@ final class DefineEnvelope implements EnvelopeBuilderCallableInterface, TranslatorAwareInterface { - public const EMAIL_SUBJECT = 'Please sign this document'; - use TranslatorAwareTrait; + public const EMAIL_SUBJECT = 'Please sign this document'; private $router; private $envelopeBuilder; diff --git a/src/EnvelopeCreator/GetViewUrl.php b/src/EnvelopeCreator/GetViewUrl.php index 58dbf37..0db6b6b 100644 --- a/src/EnvelopeCreator/GetViewUrl.php +++ b/src/EnvelopeCreator/GetViewUrl.php @@ -19,7 +19,7 @@ use DocusignBundle\Utils\CallbackRouteGenerator; use Symfony\Component\Routing\RouterInterface; -/*final */class GetViewUrl implements EnvelopeBuilderCallableInterface +/*final */ class GetViewUrl implements EnvelopeBuilderCallableInterface { private $router; private $envelopeBuilder; diff --git a/src/Grant/JwtGrant.php b/src/Grant/JwtGrant.php index 1e6d3be..4258cf6 100644 --- a/src/Grant/JwtGrant.php +++ b/src/Grant/JwtGrant.php @@ -88,7 +88,7 @@ private function createToken(): string ->relatedTo($this->userGuid) // sub ->issuedAt($time) // iat ->expiresAt($time->modify("$this->ttl sec")) // exp - ->permittedFor(parse_url($this->accountApiUri, PHP_URL_HOST)) // aud + ->permittedFor(parse_url($this->accountApiUri, \PHP_URL_HOST)) // aud ->withClaim('scope', 'signature impersonation') // scope ->getToken($config->signer(), $config->signingKey()) ->toString(); @@ -101,7 +101,7 @@ private function createToken(): string ->relatedTo($this->userGuid) // sub ->issuedAt($time) // iat ->expiresAt($time + $this->ttl) // exp - ->permittedFor(parse_url($this->accountApiUri, PHP_URL_HOST)) // aud + ->permittedFor(parse_url($this->accountApiUri, \PHP_URL_HOST)) // aud ->withClaim('scope', 'signature impersonation') // scope ->getToken(new Sha256(), new Key("file://$this->privateKey")); } diff --git a/src/TokenEncoder/TokenEncoder.php b/src/TokenEncoder/TokenEncoder.php index 979c659..104c00e 100644 --- a/src/TokenEncoder/TokenEncoder.php +++ b/src/TokenEncoder/TokenEncoder.php @@ -31,7 +31,7 @@ public function encode(array $parameters): string return password_hash(http_build_query($parameters + [ 'integration_key' => $this->integrationKey, - ]), PASSWORD_BCRYPT); + ]), \PASSWORD_BCRYPT); } public function isTokenValid(array $parameters, ?string $token): bool diff --git a/tests/EmbeddedAuthCodeTest.php b/tests/EmbeddedAuthCodeTest.php index 0d29c06..59a007d 100644 --- a/tests/EmbeddedAuthCodeTest.php +++ b/tests/EmbeddedAuthCodeTest.php @@ -117,6 +117,6 @@ public function testICanSignAnEmbeddedDocument(): void $crawler = $client->waitFor('.alert'); $this->assertSame('The document has been successfully signed!', $crawler->filter('.alert')->text()); - $this->assertSame('/embedded_auth_code', parse_url($crawler->getUri(), PHP_URL_PATH)); + $this->assertSame('/embedded_auth_code', parse_url($crawler->getUri(), \PHP_URL_PATH)); } } diff --git a/tests/EmbeddedTest.php b/tests/EmbeddedTest.php index 015e2aa..6f0165e 100644 --- a/tests/EmbeddedTest.php +++ b/tests/EmbeddedTest.php @@ -92,6 +92,6 @@ public function testICanSignAnEmbeddedDocument(): void $crawler = $client->waitFor('.alert'); $this->assertSame('The document has been successfully signed!', $crawler->filter('.alert')->text()); - $this->assertSame('/embedded', parse_url($crawler->getUri(), PHP_URL_PATH)); + $this->assertSame('/embedded', parse_url($crawler->getUri(), \PHP_URL_PATH)); } } diff --git a/tests/RemoteAuthCodeTest.php b/tests/RemoteAuthCodeTest.php index 2ddff9f..02d5478 100644 --- a/tests/RemoteAuthCodeTest.php +++ b/tests/RemoteAuthCodeTest.php @@ -92,6 +92,6 @@ public function testICanSentARemoteDocumentToBeSigned(): void $crawler = $client->waitFor('.alert'); $this->assertSame('The document has been successfully sent to the signer!', $crawler->filter('.alert')->text()); - $this->assertSame('/remote_auth_code', parse_url($crawler->getUri(), PHP_URL_PATH)); + $this->assertSame('/remote_auth_code', parse_url($crawler->getUri(), \PHP_URL_PATH)); } } diff --git a/tests/RemoteTest.php b/tests/RemoteTest.php index ebee443..0e49119 100644 --- a/tests/RemoteTest.php +++ b/tests/RemoteTest.php @@ -67,6 +67,6 @@ public function testICanSentARemoteDocumentToBeSigned(): void $crawler = $client->waitFor('.alert'); $this->assertSame('The document has been successfully sent to the signer!', $crawler->filter('.alert')->text()); - $this->assertSame('/remote', parse_url($crawler->getUri(), PHP_URL_PATH)); + $this->assertSame('/remote', parse_url($crawler->getUri(), \PHP_URL_PATH)); } } diff --git a/tests/config/chromedriver b/tests/config/chromedriver deleted file mode 100755 index 722ede5..0000000 Binary files a/tests/config/chromedriver and /dev/null differ