Skip to content

Commit 9873041

Browse files
committed
added functional test shortcuts.
1 parent 87fa961 commit 9873041

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

app/tests/ExampleTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ class ExampleTest extends TestCase {
99
*/
1010
public function testBasicExample()
1111
{
12-
$client = $this->createClient();
13-
14-
$crawler = $client->request('GET', '/');
12+
$crawler = $this->request('GET', '/');
1513

1614
$this->assertCount(1, $crawler->filter('h1:contains("Hello World!")'));
1715
}

app/tests/TestCase.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
class TestCase extends Silex\WebTestCase {
44

5+
/**
6+
* Setup the test environment.
7+
*
8+
* @return void
9+
*/
10+
public function setUp()
11+
{
12+
$this->client = $this->createClient();
13+
14+
parent::setUp();
15+
}
16+
17+
/**
18+
* Execute a request against the test client application.
19+
*
20+
* @return Symfony\Component\DomCrawler\Crawler
21+
*/
22+
public function request()
23+
{
24+
$callable = array($this->client, 'request');
25+
26+
return call_user_func_array($callable, func_get_args());
27+
}
28+
529
/**
630
* Creates the application.
731
*

0 commit comments

Comments
 (0)