diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8881638..4a95cc9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,8 +1,10 @@ name: build on: + push: + branches: + - main pull_request: ~ - push: ~ jobs: phpstan: @@ -37,16 +39,16 @@ jobs: php: '8.2' symfony: '6.4.*' composer_option: '--prefer-lowest' - - description: 'Symfony 7.1' + - description: 'Symfony 7.3' php: '8.3' - symfony: '7.1.*' - - description: 'Symfony 7.2' + symfony: '7.3.*' + - description: 'Symfony 7.4' php: '8.4' - symfony: '7.2.*@dev' + symfony: '7.4.*@dev' name: PHP ${{ matrix.php }} tests (${{ matrix.description }}) steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cache uses: actions/cache@v3 with: @@ -68,8 +70,10 @@ jobs: - name: update vendors run: composer update --no-interaction --no-progress --ansi ${{ matrix.composer_option }} - name: run tests - run: bin/phpunit --coverage-clover=clover.xml + run: bin/phpunit --colors=always --coverage-clover=clover.xml - name: save test coverage - uses: codecov/codecov-action@v1 + if: ${{ matrix.php == '8.4' }} + uses: qltysh/qlty-action/coverage@v1 with: - files: ./clover.xml + token: ${{secrets.QLTY_COVERAGE_TOKEN}} + files: clover.xml diff --git a/README.md b/README.md index edff6d4..c97b82f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # BeelabTestBundle [![Build Status](https://github.com/Bee-Lab/BeelabTestBundle/workflows/build/badge.svg)](https://github.com/Bee-Lab/BeelabTestBundle/actions) -[![codecov](https://codecov.io/github/Bee-Lab/BeelabTestBundle/branch/master/graph/badge.svg?token=xU1pOUeU3M)](https://codecov.io/github/Bee-Lab/BeelabTestBundle) +[![Code Coverage](https://qlty.sh/gh/Bee-Lab/projects/BeelabTestBundle/coverage.svg)](https://qlty.sh/gh/Bee-Lab/projects/BeelabTestBundle) -This bundle contains just an opinionated extension of Symfony `WebTestCase`. +This bundle contains an opinionated extension of Symfony `WebTestCase`. ## Documentation diff --git a/docs/index.md b/docs/index.md index 4fe1599..0ef9bdb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -69,14 +69,14 @@ services: * Browser output debug - You can output the content of response in your browser, just calling `self::saveOutput()`. + You can output the content of the response in your browser, just calling `self::saveOutput()`. You can define a parameter named `domain`, otherwise standard localhost will be used. The output is saved under the document root and displayed with a browser (by default, `/usr/bin/firefox`), then the page is deleted. You can pass `false` as argument to prevent page deletion (in this case, you can get it from your document - root directory. - Don't forget to remove it by hand, then). + root directory. Don't forget to remove it by hand, then). If you want to change browser path, define it in your configuration: + ```yaml # config/packages/test/beelab_test.yaml beelab_test: @@ -91,10 +91,8 @@ services: * Assert presence of many selectors - `self::assertSelectorCounts()` method works like native `self::assertSelectorExists()`. - For example, you can check for presence of `div.alert-success` using - `self::assertSelectorExists('div.alert-success')` or using `self::assertSelectorCounts(1, 'div.alert-success')` - (the latter being more specific, and more flexible). + An old method `self::assertSelectorCounts()` is still available, but deprecated. + You should use the native method ``self::assertSelectorCount()` instead. ### Authentication-related @@ -106,6 +104,7 @@ services: `self::login('myuser', 'main', 'fos_user.user_provider.username');`. Another notable service you can use is Symfony's built-in `security.user.provider.concrete.in_memory`. For basic usage, just pass the username as first argument. + To avoid passing the service every time, you can configure it. Example of configuration: ```yaml @@ -134,7 +133,7 @@ services: In forms with more than a field of the same type, use `self::getImageFile('1')`, `self::getImageFile('2')`, etc. You can also use `self::getFile('0', $data, 'png', 'image/png')` and pass directly your file data. - 💡 ** Bonus** The above methods are shortcuts for the `Beelab\TestBundle\File\FileInjector` class, so you + 💡 **Bonus** The above methods are shortcuts for the `Beelab\TestBundle\File\FileInjector` class, so you can use them in your fixtures, too. Import the class and use `FileInjector::getFile(fixture: true)` etc. Don't forget to pass the `$fixture` argument. diff --git a/src/Test/WebTestCase.php b/src/Test/WebTestCase.php index e7a58e4..9681bd4 100644 --- a/src/Test/WebTestCase.php +++ b/src/Test/WebTestCase.php @@ -76,7 +76,7 @@ protected static function saveOutput(bool $delete = true): void /** * Login - * See https://web.archive.org/web/20131002151908/http://blog.bee-lab.net/login-automatico-con-fosuserbundle/ + * See https://github.com/Bee-Lab/BeelabTestBundle/blob/master/docs/index.md#authentication-related * Be sure that $firewall matches the entry in your security.yaml configuration. * * @throws \InvalidArgumentException