From 3092096a3ff7bcb5b1a13698f4860ad4794d722c Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 29 Oct 2020 16:46:51 +0100 Subject: [PATCH] Support PHP 8 (#102) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Support PHP 8 * Update src/DependencyInjection/Configuration.php Co-authored-by: Grégoire Hébert * bump php version Co-authored-by: Grégoire Hébert --- .editorconfig | 64 +++++++++ .github/CONTRIBUTING.md | 10 +- .github/workflows/ci.yml | 123 +++++++++--------- .php_cs.dist | 2 +- composer.json | 26 ++-- .../DependencyInjection/TestExtension.php | 35 ----- features/bootstrap.php | 3 +- .../Resources => }/config/override.yaml | 0 features/config/routes/annotations.yaml | 3 + features/config/routes/debug.yaml | 11 ++ features/config/routes/docusign.yaml | 3 + .../Resources => }/config/services.yaml | 9 +- features/console | 1 + features/public/index.php | 1 + .../SessionAuthorizationHandler.php | 2 +- .../Controller/ClickController.php | 2 +- .../Controller/DocumentsController.php | 2 +- .../Controller/HomepageController.php | 2 +- .../Controller/LoginController.php} | 4 +- .../Controller/LogoutController.php} | 12 +- .../DocusignEventSubscriber.php | 2 +- features/{ => src}/Kernel.php | 55 ++++---- .../views => templates}/base.html.twig | 0 .../views => templates}/clickwrap.html.twig | 0 .../views => templates}/homepage.html.twig | 2 +- .../views => templates}/list.html.twig | 0 .../views => templates}/login.html.twig | 0 phpstan.neon.dist | 4 + phpstan.neon.lowest.dist | 4 +- phpunit.xml.dist | 12 +- src/DependencyInjection/Configuration.php | 12 +- src/Grant/JwtGrant.php | 13 +- tests/HomepageTest.php | 2 +- tests/config/chromedriver | Bin 10774816 -> 11214464 bytes 34 files changed, 254 insertions(+), 167 deletions(-) create mode 100644 .editorconfig delete mode 100644 features/TestBundle/DependencyInjection/TestExtension.php rename features/{TestBundle/Resources => }/config/override.yaml (100%) create mode 100644 features/config/routes/annotations.yaml create mode 100644 features/config/routes/debug.yaml create mode 100644 features/config/routes/docusign.yaml rename features/{TestBundle/Resources => }/config/services.yaml (68%) rename features/{TestBundle => src}/AuthorizationHandler/SessionAuthorizationHandler.php (95%) rename features/{TestBundle => src}/Controller/ClickController.php (94%) rename features/{TestBundle => src}/Controller/DocumentsController.php (98%) rename features/{TestBundle => src}/Controller/HomepageController.php (93%) rename features/{TestBundle/Controller/SecurityController.php => src/Controller/LoginController.php} (92%) rename features/{TestBundle/TestBundle.php => src/Controller/LogoutController.php} (58%) rename features/{TestBundle => src}/EventSubscriber/DocusignEventSubscriber.php (96%) rename features/{ => src}/Kernel.php (87%) rename features/{TestBundle/Resources/views => templates}/base.html.twig (100%) rename features/{TestBundle/Resources/views => templates}/clickwrap.html.twig (100%) rename features/{TestBundle/Resources/views => templates}/homepage.html.twig (88%) rename features/{TestBundle/Resources/views => templates}/list.html.twig (100%) rename features/{TestBundle/Resources/views => templates}/login.html.twig (100%) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ddbdaea --- /dev/null +++ b/.editorconfig @@ -0,0 +1,64 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] +# Change these settings to your own preference +indent_style = space +indent_size = 4 + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.feature] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 2 + +[*.json] +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.php] +indent_style = space +indent_size = 4 + +[*.sh] +indent_style = tab +indent_size = 4 + +[*.xml] +indent_style = space +indent_size = 4 + +[*.{yaml,yml}] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = false + +[.github/workflows/*.{yaml,yml}] +indent_style = space +indent_size = 2 + +[.php_cs{,.dist}] +indent_style = space +indent_size = 4 + +[composer.json] +indent_style = space +indent_size = 4 + +[phpunit.xml{,.dist}] +indent_style = space +indent_size = 4 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 0aec631..fc046f5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -143,19 +143,21 @@ on DocuSign and store the private key on `features/var/jwt/docusign.pem`. ## Starting the demo project +You must install the [Symfony binary](https://symfony.com/download), then start the server: + ```shell -features/console server:start +symfony serve --document-root=features/public ``` -Then go to http://localhost:8000. +Then go to http://127.0.0.1:8000. ## Debugging -The [WebProfilerBundle](https://symfony.com/web-profiler-bundle) is available at http://localhost:8000/_profiler/. +The [WebProfilerBundle](https://symfony.com/web-profiler-bundle) 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://localhost:8000/. +To access the list of documents, you'll need to login as `admin:4dm1n` on http://127.0.0.1:8000/. ## Running tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2004cf..9515500 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,102 +2,104 @@ name: CI on: schedule: - - cron: 0 2 * * 1-5 + # Every sunday at 02:00 + - cron: 0 2 * * 0 pull_request: push: branches: - v5 -env: - COVERAGE: '0' - EXT_PCOV_VERSION: '1.0.6' - jobs: tests: name: Tests PHP ${{ matrix.php }} ${{ matrix.dependency }} (Symfony ${{ matrix.symfony }}) runs-on: ubuntu-latest - container: - image: php:${{ matrix.php }} - options: >- - --tmpfs /tmp:exec strategy: - # https://github.community/t5/GitHub-Actions/GitHub-Actions-Matrix-options-dont-work-as-documented/m-p/29558 matrix: php: - '7.2' - '7.3' - '7.4' + - 'rc' symfony: - '4.4.*' - - '5.0.*' - include: - - php: '7.4' - coverage: true + - '5.1.*' dependency: - '' - 'lowest' + include: + - php: '7.4' + dependency: '' + symfony: '5.1.*' + coverage: true + bootable: true + exclude: + - symfony: '4.4.*' + dependency: 'lowest' fail-fast: false steps: - name: Checkout uses: actions/checkout@v1 - - name: "Cache dependencies installed with composer" - uses: actions/cache@v1 + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - path: ~/.composer/cache - key: ${{ matrix.php }}-composer-${{ matrix.dependency }}-${{ hashFiles('**/composer.json') }} - restore-keys: | - ${{ matrix.php }}-composer-${{ matrix.dependency }}- - - - name: Enable code coverage - if: matrix.coverage && matrix.dependency == '' - run: echo "COVERAGE=1" >> $GITHUB_ENV + php-version: ${{ matrix.php }} + extensions: composer:v2, flex + coverage: pcov + tools: php-cs-fixer - - name: Install system packages - run: | - apt-get update - apt-get install -y --no-install-recommends \ - unzip\ - libzip-dev \ - chromium \ - gnupg - docker-php-ext-install zip - - - name: Install pcov PHP extension - if: env.COVERAGE == '1' - run: | - pecl install pcov-$EXT_PCOV_VERSION - docker-php-ext-install sockets - docker-php-ext-enable pcov sockets + - name: Get Composer Cache Directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Install Composer - run: curl -sS -o - https://raw.githubusercontent.com/composer/getcomposer.org/ba13e3fc70f1c66250d1ea7ea4911d593aa1dba5/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- - name: Configure Symfony - run: | - composer global require symfony/flex - composer config extra.symfony.require "${{ matrix.symfony }}" + run: composer config extra.symfony.require "${{ matrix.symfony }}" - name: Update project dependencies if: matrix.dependency == '' - run: php -d memory_limit=-1 `which composer` update --no-progress --no-suggest --ansi --prefer-stable + run: composer update --no-progress --ansi --prefer-stable ${{ matrix.composer }} - name: Update project dependencies lowest if: matrix.dependency == 'lowest' + run: composer update --no-progress --ansi --prefer-lowest --prefer-stable + + - name: Disable deprecations notices for lowest dependencies + if: matrix.dependency == 'lowest' + run: echo "SYMFONY_DEPRECATIONS_HELPER=weak" >> $GITHUB_ENV + + - name: Bundle is bootable + if: matrix.bootable + env: + SKELETON_VERSION: ${{matrix.symfony}} run: | - php -d memory_limit=-1 `which composer` remove --dev --no-progress --no-update --ansi league/flysystem-bundle - php -d memory_limit=-1 `which composer` update --no-progress --no-suggest --ansi --prefer-stable --prefer-lowest + composer create-project "symfony/skeleton:${SKELETON_VERSION}" flex + cd flex + composer config extra.symfony.allow-contrib true + composer req --ignore-platform-reqs gheb/docusign-bundle + + - name: Run php-cs-fixer tests + if: matrix.php != 'rc' + run: php-cs-fixer fix --diff --dry-run + + - name: Install chromium + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends chromium-browser - name: Run phpstan tests if: matrix.dependency == '' - run: php -d memory_limit=-1 vendor/bin/phpstan analyze + run: vendor/bin/phpstan analyze - name: Run phpstan tests lowest if: matrix.dependency == 'lowest' - run: php -d memory_limit=-1 vendor/bin/phpstan analyze -c phpstan.neon.lowest.dist - - - name: Run php-cs-fixer tests - run: vendor/bin/php-cs-fixer fix --dry-run --diff + run: vendor/bin/phpstan analyze -c phpstan.neon.lowest.dist - name: Prepare PHPUnit tests env: @@ -107,7 +109,7 @@ jobs: 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 - name: Run PHPUnit tests with coverage - if: env.COVERAGE == '1' + if: matrix.coverage env: DOCUSIGN_INTEGRATION_KEY: ${{ secrets.DOCUSIGN_INTEGRATION_KEY }} DOCUSIGN_USER_GUID: ${{ secrets.DOCUSIGN_USER_GUID }} @@ -119,10 +121,10 @@ jobs: DOCUSIGN_DEFAULT_SIGNER_EMAIL: ${{ secrets.DOCUSIGN_DEFAULT_SIGNER_EMAIL }} DOCUSIGN_EMAIL: ${{ secrets.DOCUSIGN_EMAIL }} DOCUSIGN_PASSWORD: ${{ secrets.DOCUSIGN_PASSWORD }} - run: vendor/bin/phpunit --coverage-clover build/logs/phpunit/clover.xml --colors=always --testdox + run: vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml --colors=always --testdox - name: Run PHPUnit tests - if: env.COVERAGE == '0' + if: matrix.coverage == '' env: DOCUSIGN_INTEGRATION_KEY: ${{ secrets.DOCUSIGN_INTEGRATION_KEY }} DOCUSIGN_USER_GUID: ${{ secrets.DOCUSIGN_USER_GUID }} @@ -134,17 +136,16 @@ jobs: DOCUSIGN_DEFAULT_SIGNER_EMAIL: ${{ secrets.DOCUSIGN_DEFAULT_SIGNER_EMAIL }} DOCUSIGN_EMAIL: ${{ secrets.DOCUSIGN_EMAIL }} DOCUSIGN_PASSWORD: ${{ secrets.DOCUSIGN_PASSWORD }} - run: vendor/bin/phpunit --colors=always --testdox + run: vendor/bin/simple-phpunit --colors=always --testdox - name: Upload test artifacts - if: always() uses: actions/upload-artifact@v1 with: name: build-php${{ matrix.php }} path: build - name: Upload coverage results to Codecov - if: env.COVERAGE == '1' + if: matrix.coverage uses: codecov/codecov-action@v1.0.3 with: name: phpunit-php${{ matrix.php }} @@ -152,9 +153,9 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} - name: Upload coverage results to Coveralls - if: env.COVERAGE == '1' + if: matrix.coverage env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - composer global require --prefer-dist --no-progress --no-suggest --ansi cedx/coveralls + composer global require --prefer-dist --no-progress --ansi cedx/coveralls $HOME/.composer/vendor/bin/coveralls build/logs/phpunit/clover.xml diff --git a/.php_cs.dist b/.php_cs.dist index 1e1f858..0e37b22 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -13,7 +13,7 @@ HEADER; $finder = PhpCsFixer\Finder::create() ->in(__DIR__) - ->exclude('features/var'); + ->exclude(['features', 'flex']); return PhpCsFixer\Config::create() ->setRiskyAllowed(true) diff --git a/composer.json b/composer.json index 4b2b5f3..d70aab2 100644 --- a/composer.json +++ b/composer.json @@ -23,10 +23,10 @@ "email": "gregoire+support-docusign@les-tilleuls.coop" }, "require": { - "php": "^7.2", + "php": ">=7.2", "ext-SimpleXML": "*", "docusign/esign-client": "^3.0", - "lcobucci/jwt": "^3.3.1", + "lcobucci/jwt": "^3.3.1 || ^4.0-dev", "league/flysystem": "^1.0.8", "psr/log": "^1.1", "symfony/config": "^4.4 || ^5.0", @@ -43,24 +43,23 @@ "webmozart/assert": "^1.5" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16.2", + "doctrine/annotations": "^1.11", "league/flysystem-bundle": "^1.2", - "nyholm/symfony-bundle-test": "^1.6.1", - "phpspec/prophecy": "^1.9", + "nyholm/symfony-bundle-test": "dev-master", "phpstan/phpstan": "^0.12.18", - "phpunit/phpunit": "^7.5.2 || ^8.0", "psr/event-dispatcher": "^1.0", + "symfony/console": "^4.4 || ^5.0", "symfony/css-selector": "^4.4 || ^5.0", "symfony/debug": "^4.4 || ^5.0", "symfony/dotenv": "^4.4 || ^5.0", "symfony/monolog-bundle": "^3.5", "symfony/panther": "^0.6.1", + "symfony/phpunit-bridge": "^4.4 || ^5.0", "symfony/polyfill-php72": "^1.9", "symfony/process": "^4.4 || ^5.0", "symfony/profiler-pack": "^1.0", "symfony/security-bundle": "^4.4 || ^5.0", - "symfony/twig-bundle": "^4.4 || ^5.0", - "symfony/web-server-bundle": "^4.4 || ^5.0" + "symfony/twig-bundle": "^4.4 || ^5.0" }, "suggest": { "league/flysystem-bundle": "For Symfony >4.2 - Allow the use of the official adapter system instead of the compat layer.", @@ -74,9 +73,18 @@ "autoload-dev": { "psr-4": { "DocusignBundle\\Tests\\": "tests/", - "DocusignBundle\\E2e\\": "features/" + "DocusignBundle\\E2e\\": "features/src/", + "PHPUnit\\": "vendor/bin/.phpunit/phpunit/src" } }, + "scripts": { + "post-install-cmd": [ + "vendor/bin/simple-phpunit --version" + ], + "post-update-cmd": [ + "vendor/bin/simple-phpunit --version" + ] + }, "config": { "sort-packages": true }, diff --git a/features/TestBundle/DependencyInjection/TestExtension.php b/features/TestBundle/DependencyInjection/TestExtension.php deleted file mode 100644 index 71afe25..0000000 --- a/features/TestBundle/DependencyInjection/TestExtension.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -namespace DocusignBundle\E2e\TestBundle\DependencyInjection; - -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; - -/** - * @author Vincent Chalamon - */ -final class TestExtension extends Extension -{ - /** - * {@inheritdoc} - */ - public function load(array $configs, ContainerBuilder $container): void - { - $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('services.yaml'); - $loader->load('override.yaml'); - } -} diff --git a/features/bootstrap.php b/features/bootstrap.php index 8a68757..805fc1f 100644 --- a/features/bootstrap.php +++ b/features/bootstrap.php @@ -16,7 +16,6 @@ date_default_timezone_set('UTC'); require __DIR__.'/../vendor/autoload.php'; -require 'Kernel.php'; // Load cached env vars if the .env.local.php file exists // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) @@ -27,7 +26,7 @@ } else { // load all the .env files if (method_exists(Dotenv::class, 'loadEnv')) { - (new Dotenv(false))->loadEnv(__DIR__.'/.env'); + (method_exists(Dotenv::class, 'usePutenv') ? (new Dotenv())->usePutenv(false) : new Dotenv())->loadEnv(__DIR__.'/.env'); } else { (new Dotenv())->load(__DIR__.'/.env'); } diff --git a/features/TestBundle/Resources/config/override.yaml b/features/config/override.yaml similarity index 100% rename from features/TestBundle/Resources/config/override.yaml rename to features/config/override.yaml diff --git a/features/config/routes/annotations.yaml b/features/config/routes/annotations.yaml new file mode 100644 index 0000000..db8cea1 --- /dev/null +++ b/features/config/routes/annotations.yaml @@ -0,0 +1,3 @@ +controllers: + resource: ../../src/Controller/ + type: annotation diff --git a/features/config/routes/debug.yaml b/features/config/routes/debug.yaml new file mode 100644 index 0000000..d347663 --- /dev/null +++ b/features/config/routes/debug.yaml @@ -0,0 +1,11 @@ +_errors: + resource: '@FrameworkBundle/Resources/config/routing/errors.xml' + prefix: /_error + +web_profiler_wdt: + resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' + prefix: /_wdt + +web_profiler_profiler: + resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' + prefix: /_profiler diff --git a/features/config/routes/docusign.yaml b/features/config/routes/docusign.yaml new file mode 100644 index 0000000..22c49b9 --- /dev/null +++ b/features/config/routes/docusign.yaml @@ -0,0 +1,3 @@ +docusign: + resource: . + type: docusign diff --git a/features/TestBundle/Resources/config/services.yaml b/features/config/services.yaml similarity index 68% rename from features/TestBundle/Resources/config/services.yaml rename to features/config/services.yaml index c494bdd..3441cd4 100644 --- a/features/TestBundle/Resources/config/services.yaml +++ b/features/config/services.yaml @@ -13,10 +13,9 @@ services: Symfony\Component\HttpFoundation\Session\Session: '@session' - DocusignBundle\E2e\TestBundle\: - resource: '../../*' - exclude: '../../{DependencyInjection,TestBundle.php}' + DocusignBundle\E2e\: + resource: '../src/*' - DocusignBundle\E2e\TestBundle\Controller\: - resource: '../../Controller/*' + DocusignBundle\E2e\Controller\: + resource: '../src/Controller/*' tags: ['controller.service_arguments'] diff --git a/features/console b/features/console index 39959d3..897fe94 100755 --- a/features/console +++ b/features/console @@ -1,6 +1,7 @@ #!/usr/bin/env php */ -final class SecurityController +final class LoginController { /** * @Route("/login", name="login", methods={"GET", "POST"}) diff --git a/features/TestBundle/TestBundle.php b/features/src/Controller/LogoutController.php similarity index 58% rename from features/TestBundle/TestBundle.php rename to features/src/Controller/LogoutController.php index a96ea61..ad0dbef 100644 --- a/features/TestBundle/TestBundle.php +++ b/features/src/Controller/LogoutController.php @@ -11,13 +11,19 @@ declare(strict_types=1); -namespace DocusignBundle\E2e\TestBundle; +namespace DocusignBundle\E2e\Controller; -use Symfony\Component\HttpKernel\Bundle\Bundle; +use Symfony\Component\Routing\Annotation\Route; /** * @author Vincent Chalamon */ -final class TestBundle extends Bundle +final class LogoutController { + /** + * @Route("/logout", name="logout", methods={"GET"}) + */ + public function __invoke(): void + { + } } diff --git a/features/TestBundle/EventSubscriber/DocusignEventSubscriber.php b/features/src/EventSubscriber/DocusignEventSubscriber.php similarity index 96% rename from features/TestBundle/EventSubscriber/DocusignEventSubscriber.php rename to features/src/EventSubscriber/DocusignEventSubscriber.php index 1b826da..0af8701 100644 --- a/features/TestBundle/EventSubscriber/DocusignEventSubscriber.php +++ b/features/src/EventSubscriber/DocusignEventSubscriber.php @@ -11,7 +11,7 @@ declare(strict_types=1); -namespace DocusignBundle\E2e\TestBundle\EventSubscriber; +namespace DocusignBundle\E2e\EventSubscriber; use DocusignBundle\Events\AuthorizationCodeEvent; use DocusignBundle\Events\CompletedEvent; diff --git a/features/Kernel.php b/features/src/Kernel.php similarity index 87% rename from features/Kernel.php rename to features/src/Kernel.php index 6f54a94..556d47b 100644 --- a/features/Kernel.php +++ b/features/src/Kernel.php @@ -11,16 +11,24 @@ declare(strict_types=1); -use DocusignBundle\E2e\TestBundle\AuthorizationHandler\SessionAuthorizationHandler; +namespace DocusignBundle\E2e; + +use DocusignBundle\DocusignBundle; +use DocusignBundle\E2e\AuthorizationHandler\SessionAuthorizationHandler; use League\Flysystem\Adapter\Local; use League\Flysystem\Filesystem; use League\FlysystemBundle\FlysystemBundle; +use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; +use Symfony\Bundle\MonologBundle\MonologBundle; +use Symfony\Bundle\SecurityBundle\SecurityBundle; +use Symfony\Bundle\TwigBundle\TwigBundle; +use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\Kernel as BaseKernel; -use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Security\Core\User\User; @@ -34,11 +42,10 @@ final class Kernel extends BaseKernel public function registerBundles() { $bundles = [ - new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - new Symfony\Bundle\SecurityBundle\SecurityBundle(), - new Symfony\Bundle\TwigBundle\TwigBundle(), - new DocusignBundle\DocusignBundle(), - new DocusignBundle\E2e\TestBundle\TestBundle(), + new FrameworkBundle(), + new SecurityBundle(), + new TwigBundle(), + new DocusignBundle(), ]; if (class_exists(FlysystemBundle::class)) { @@ -46,9 +53,8 @@ public function registerBundles() } if ($this->isDebug()) { - $bundles[] = new Symfony\Bundle\MonologBundle\MonologBundle(); - $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); - $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); + $bundles[] = new MonologBundle(); + $bundles[] = new WebProfilerBundle(); } return $bundles; @@ -56,7 +62,7 @@ public function registerBundles() public function getProjectDir() { - return __DIR__; + return __DIR__.'/..'; } public function getCacheDir() @@ -69,30 +75,37 @@ public function getLogDir() return $this->getProjectDir().'/var/log'; } - protected function configureRoutes(RouteCollectionBuilder $routes): void + /** + * @param RouteCollectionBuilder|RoutingConfigurator $routes + */ + protected function configureRoutes($routes): void { + $routes->import(__DIR__.'/../config/routes/annotations.yaml'); + $routes->import(__DIR__.'/../config/routes/docusign.yaml'); + if ($this->isDebug()) { - $routes->import('@WebProfilerBundle/Resources/config/routing/wdt.xml', '/_wdt'); - $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml', '/_profiler'); + $routes->import(__DIR__.'/../config/routes/debug.yaml'); } - - $routes->import('.', '/', 'docusign'); - $routes->import('@TestBundle/Controller', '/', 'annotation'); - $routes->addRoute(new Route('/logout'), 'logout'); } protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void { + $loader->load(__DIR__.'/../config/services.yaml'); + $loader->load(__DIR__.'/../config/override.yaml'); + $c->loadFromExtension('framework', [ 'secret' => 'DocusignBundle', 'test' => true, 'session' => [ 'storage_id' => 'session.storage.mock_file', ], + 'router' => [ + 'utf8' => true, + ], ]); $c->loadFromExtension('twig', [ - 'paths' => ['%kernel.project_dir%/TestBundle/Resources/views'], + 'paths' => ['%kernel.project_dir%/templates'], ]); $c->loadFromExtension('security', [ @@ -146,7 +159,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'private_key' => '%kernel.project_dir%/var/jwt/docusign.pem', 'integration_key' => $_SERVER['DOCUSIGN_INTEGRATION_KEY'], 'user_guid' => $_SERVER['DOCUSIGN_USER_GUID'], - 'grant_type' => 'authorization_code', ], 'sign_path' => '/embedded/sign', 'callback' => 'embedded_callback', @@ -191,7 +203,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'private_key' => '%kernel.project_dir%/var/jwt/docusign.pem', 'integration_key' => $_SERVER['DOCUSIGN_INTEGRATION_KEY'], 'user_guid' => $_SERVER['DOCUSIGN_USER_GUID'], - 'grant_type' => 'authorization_code', ], 'sign_path' => '/remote/sign', 'callback' => 'remote_callback', @@ -269,7 +280,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ]); $c->loadFromExtension('web_profiler', [ - 'toolbar' => '%kernel.debug%', + 'toolbar' => true, ]); $c->loadFromExtension('monolog', [ diff --git a/features/TestBundle/Resources/views/base.html.twig b/features/templates/base.html.twig similarity index 100% rename from features/TestBundle/Resources/views/base.html.twig rename to features/templates/base.html.twig diff --git a/features/TestBundle/Resources/views/clickwrap.html.twig b/features/templates/clickwrap.html.twig similarity index 100% rename from features/TestBundle/Resources/views/clickwrap.html.twig rename to features/templates/clickwrap.html.twig diff --git a/features/TestBundle/Resources/views/homepage.html.twig b/features/templates/homepage.html.twig similarity index 88% rename from features/TestBundle/Resources/views/homepage.html.twig rename to features/templates/homepage.html.twig index 95ed269..f5f429b 100644 --- a/features/TestBundle/Resources/views/homepage.html.twig +++ b/features/templates/homepage.html.twig @@ -1,6 +1,6 @@ {% extends 'base.html.twig' %} -{% block title %}Welcome to the DocuSign TestBundle{% endblock %} +{% block title %}Welcome to the DocuSign{% endblock %} {% block content %}