1: <?php
2: /**
3: * This file is part of the Autarky package.
4: *
5: * (c) Andreas Lutro <anlutro@gmail.com>
6: *
7: * For the full copyright and license information, please view the LICENSE
8: * file that was distributed with this source code.
9: */
10:
11: namespace Autarky\Testing;
12:
13: use Symfony\Component\HttpKernel\Client;
14:
15: abstract class WebTestCase extends TestCase
16: {
17: /**
18: * The browserkit client instance.
19: *
20: * @var Client
21: */
22: protected $client;
23:
24: /**
25: * {@inheritdoc}
26: */
27: public function setUp()
28: {
29: parent::setUp();
30: $this->client = $this->createClient();
31: }
32:
33: /**
34: * {@inheritdoc}
35: */
36: public function tearDown()
37: {
38: $this->client = null;
39: parent::tearDown();
40: }
41:
42: /**
43: * Create a httpkernel\browserkit client.
44: *
45: * Override this method if you want to provide custom parameters to the
46: * client like fake $_SERVER data, browser history or cookies.
47: *
48: * @return Client
49: */
50: protected function createClient()
51: {
52: return new Client($this->app);
53: }
54: }
55: