diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..a1d4938 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,42 @@ +name: tests + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [7.2, 7.3, 7.4, 8.0] + stability: [prefer-lowest, prefer-stable, dev] + + + name: ${{ matrix.php }}-${{ matrix.stability }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.composer/cache/files + key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Install dependencies + run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress + + - name: Check coding standard + run: composer lint + + - name: Execute tests + run: composer test diff --git a/composer.json b/composer.json index 2ed0e58..8f630e9 100644 --- a/composer.json +++ b/composer.json @@ -14,13 +14,13 @@ "symfony/framework-bundle": "^4.4|^5.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^2.18", "nyholm/psr7": "^1.1", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9", - "symfony/yaml": "^4.4|^5.0", "symfony/browser-kit": "^4.4|^5.0", - "doctrine/annotations": "^1.0", + "symfony/monolog-bridge": "^4.0|^5.0", "symfony/monolog-bundle": "^3.2", - "friendsofphp/php-cs-fixer": "^2.18" + "symfony/phpunit-bridge": "^4.4.11|^5.0.11", + "symfony/yaml": "^4.4|^5.0" }, "conflict": { "sension/framework-extra-bundle": "<6.0" @@ -51,6 +51,9 @@ "vendor/bin/simple-phpunit --colors=always" ] }, + "config": { + "sort-packages": true + }, "extra": { "branch-alias": { "dev-main": "1.0.x-dev" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e8c6ccc..a23cb89 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,7 +9,6 @@ - diff --git a/tests/Fixtures/ActionArgumentsBundle/Controller/ActionArgumentsController.php b/tests/Fixtures/ActionArgumentsBundle/Controller/ActionArgumentsController.php index 1a26bf2..d540a51 100644 --- a/tests/Fixtures/ActionArgumentsBundle/Controller/ActionArgumentsController.php +++ b/tests/Fixtures/ActionArgumentsBundle/Controller/ActionArgumentsController.php @@ -16,24 +16,14 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ServerRequestInterface; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/action-arguments") - */ class ActionArgumentsController { - /** - * @Route("/invoke/") - */ public function __invoke(RequestInterface $request, MessageInterface $message, ServerRequestInterface $serverRequest) { return new Response('ok'); } - /** - * @Route("/normal/") - */ public function normalAction(RequestInterface $request, MessageInterface $message, ServerRequestInterface $serverRequest) { return new Response('ok'); diff --git a/tests/Fixtures/config/config.yml b/tests/Fixtures/config/config.yml index d2920f5..815d5f2 100644 --- a/tests/Fixtures/config/config.yml +++ b/tests/Fixtures/config/config.yml @@ -1,5 +1,6 @@ framework: test: true + secret: test router: resource: "%kernel.project_dir%/config/routing.yml" diff --git a/tests/Fixtures/config/routing.yml b/tests/Fixtures/config/routing.yml index ee3fe45..8a50917 100644 --- a/tests/Fixtures/config/routing.yml +++ b/tests/Fixtures/config/routing.yml @@ -1,3 +1,7 @@ -action_arguments_bundle: - resource: "@ActionArgumentsBundle/Controller/ActionArgumentsController.php" - type: annotation +action_arguments_bundle_invoke: + path: '/action-arguments/invoke/' + controller: 'Tests\Fixtures\ActionArgumentsBundle\Controller\ActionArgumentsController' + +action_arguments_bundle_normal: + path: '/action-arguments/normal/' + controller: 'Tests\Fixtures\ActionArgumentsBundle\Controller\ActionArgumentsController::normalAction'