PHPackages                             tiny/symfony-testing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. tiny/symfony-testing

ActiveLibrary[Testing &amp; Quality](/categories/testing)

tiny/symfony-testing
====================

Tools to facilitate testing Symfony web applications.

0.1.0(7y ago)051[2 issues](https://github.com/mike-shmatov/tiny-symfony-testing/issues)MITPHPPHP &gt;=5.6

Since Nov 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mike-shmatov/tiny-symfony-testing)[ Packagist](https://packagist.org/packages/tiny/symfony-testing)[ RSS](/packages/tiny-symfony-testing/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

tiny/symfony-testing
====================

[](#tinysymfony-testing)

Assistive package for doing functional testing on web applications built with Symfony framework.

Contains two major components:

- TinyTestingBundle. Aims to deal with displaying exceptions while running functional tests.
- WebTestCase. Built on top of Symfony's WebTestCase to provide more testing-friendly interface.

Currently only Symfony 3.4 is supported.

TinyTestingBundle
-----------------

[](#tinytestingbundle)

Bundle enables displaying actual exceptions thrown when running functional tests on Symfony application. It allows all `Symfony\Component\HttpKernel\Exception\HttpException`-s to be processed in a normal way (e.g. for twig can render a 404 page), and will rethrow any other exception so it can be caught by PHPUnit and reported.

If you make html web app, then while browsing it in `dev` mode and when something bad happens, you see a nice page with all the information about the exception (its class, code, message, stack trace, etc.). When runnning tests it is more valueable to have this exception actually thrown, so it can be reported to the console (or whatever output you or your IDE use).

Of course, there is an option to do

```
$client->catchExceptions(false);
```

in the test case. This will force `HttpKernel` throw exception instead of dispatching `kernel.exception` event.

The problem is that using this option requires some manual work (not much but on a regular basis). We have to either turn catching off each time we want to see an exception (and rerun the tests) or take care of creating (or configuring) different clients to support both cases.

Most likely, bundle should be registered only for `test` environment:

```
// AppKernel.php
if ($this->getEnvironment() === 'test') {
    $bundles[] = new Tiny\SymfonyTesting\TinyTestingBundle\TinyTestingBundle();
}
```

WebTestCase
-----------

[](#webtestcase)

Provides some assistive interface for functional testing. Extends Symfony's native `Symfony\Bundle\FrameworkBundle\Test\WebTestCase`.

Its `setUp()` creates instance of a client (can be access directly via `$this->client`, it is a protected). So if you have your own `setUp()` make sure to call `parent::setUp()`.

##### Some configurative (i.e. to be used before request) methods, they have impact on all subsequent requests.

[](#some-configurative-ie-to-be-used-before-request-methods-they-have-impact-on-all-subsequent-requests)

`protected function setHost($host)`

sets the host, useful when request routing involves host requirements (like `api.example.com/users`)

`protected function setHeader($name, $value)`

so stuff like `$this->setHeader('Authoriation', 'Bearer wh.at.ever');` can be done

`protected function setCookie($name, $value, $expires = null, $path = null, $domain = '', $secure = false, $httponly = false)`

##### Provided request methods:

[](#provided-request-methods)

`protected request($uri, $method = 'GET', $parameters = [], $files = [], $server = [], $content = '', $changeHistory = true)`

pretty much the same as in `Symfony\Bundle\FrameworkBundle\Client::request` except for `$method` and `$uri` parameters are swapped.

Some shortcut request methods:

`protected function get($uri, $parameters = [])`

`protected function post($uri, $content = '', $parameters = [])`

`protected function put($uri, $content = '')`

`protected function patch($uri, $content = '')`

`protected function delete($uri, $content = '')`

Before request it's possible to set some parameters using

`protected function setParameters(array $parameters)`

Request parameters set with this method are sent only with next single subsequent request.

##### Response and assertions

[](#response-and-assertions)

After request is made, it's possible to reach the response via `$this->response` (instance of `Symfony\Component\HttpFoundation\Response`).

Currently only single assertion implemented for response status code, accessible as `$this->assertStatusCode($expectedCode)`.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2736d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4e80ff02096c1a482244fb4012d368ea8346c43657835f54a6d1736f5cea053?d=identicon)[tiny](/maintainers/tiny)

---

Top Contributors

[![mike-shmatov](https://avatars.githubusercontent.com/u/17006202?v=4)](https://github.com/mike-shmatov "mike-shmatov (2 commits)")

---

Tags

testingsymfony

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tiny-symfony-testing/health.svg)

```
[![Health](https://phpackages.com/badges/tiny-symfony-testing/health.svg)](https://phpackages.com/packages/tiny-symfony-testing)
```

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[dama/doctrine-test-bundle

Symfony bundle to isolate doctrine database tests and improve test performance

1.2k37.2M144](/packages/dama-doctrine-test-bundle)[matthiasnoback/symfony-config-test

Library for testing user classes related to the Symfony Config Component

1679.8M395](/packages/matthiasnoback-symfony-config-test)[liip/test-fixtures-bundle

This bundles enables efficient loading of Doctrine fixtures in functional test-cases for Symfony applications

1798.3M42](/packages/liip-test-fixtures-bundle)[mattiasgeniar/phpunit-query-count-assertions

A custom assertion for phpunit that allows you to count the amount of SQL queries used in a test. Can be used to enforce certain performance characteristics (ie: limit queries to X for a certain action).

160730.9k2](/packages/mattiasgeniar-phpunit-query-count-assertions)[happyr/service-mocking

Make it easy to mock services in a built container

48253.8k2](/packages/happyr-service-mocking)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
