Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: build

on:
push:
branches:
- main
pull_request: ~
push: ~

jobs:
phpstan:
Expand Down Expand Up @@ -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:
Expand All @@ -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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
15 changes: 7 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/Test/WebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down