dev-master
9999999-devA port of the Symfony2 testing mechanism to symfony 1.X.
MIT
The Requires
- php >=5.3.2
- symfony/dom-crawler >=2.0
- symfony/css-selector >=2.0
test phpunit symfony
Wallogit.com
2017 © Pedro Peláez
A port of the Symfony2 testing mechanism to symfony 1.X.
A small library that brings the Symfony2 functional testing mechanism into symfony 1.X., (*1)
Clone the repository under the lib/vendor/odino directory: you can change
the location of the library, although this is the recommended one., (*2)
``` bash git clone git@github.com:odino/SfCcTesting.git lib/vendor/odino/SfCcTesting, (*3)
Move into the library's root, download composer and install the dependencies: ``` bash cd lib/vendor/odino/SfCcTesting wget http://getcomposer.org/composer.phar php composer.phar install
Make a symbolic link from the root of your application to the default
phpunit.xml.dist configuration file:, (*4)
``` bash ln -s lib/vendor/odino/SfCcTesting/phpunit.xml.dist phpunit.xml, (*5)
(this is just a hint, you can use your specific configuration file) Write your first test: ``` bash touch test/phpunit/HomepageTest.php
``` php <?php, (*6)
use Symfony\Component\DomCrawler\Crawler; use odino\SfCcTesting\WebTestCase;, (*7)
class HomepageTest extends WebTestCase
{
public function testHelloWorld()
{
$client = $this->createClient();
$crawler = $client->get('/');, (*8)
$this->assertEquals("Hello world", $crawler->filter('h1')->text());
}, (*9)
protected function getApplication() { return 'frontend'; }, (*10)
protected function bootstrapSymfony($app) { include(dirname(FILE).'/../../test/bootstrap/functional.php'); } } ```, (*11)
and run it with a simple phpunit test/phpunit from the root of your
symfony 1.X project., (*12)
#, (*13)
A port of the Symfony2 testing mechanism to symfony 1.X.
MIT
test phpunit symfony