Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/larttyler/symfony-phpunit-helpers


https://github.com/larttyler/symfony-phpunit-helpers

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

## Configuration
Add the following to `app/AppKernel.php`.

```php
getEnvironment(), array('dev', 'test'), true)) {
// ...
if ($this->getEnvironment() === 'test') {
$bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
}
}

return $bundles;
}

// ...
}
```

Next, enable the Liip bundle. Additionally, you should also configure Doctrine to use a temporary
SQLite database, in lieu of your normal database connection.

```yaml
liip_functional_test:
cache_sqlite_db: true

# Optional, but recommended; tells Doctrine to use a temporary SQLite database for testing
doctrine:
dbal:
driver: pdo_sqlite
path: '%kernel.cache_dir%/test.db'
```

Please read the [LiipFunctionalTestBundle](https://github.com/liip/LiipFunctionalTestBundle/blob/master/README.md)
documentation for more information on configuring the Liip bundle.

## Usage
Simply have your test cases extend from `DaybreakStudios\Utility\SymfonyPHPUnitHelpers\WebTestCase`.

```php
client->request('GET', '/home');

$response = $this->client->getResponse();

$this->isSuccessful($response);
}
}
```