1 | <?php |
||
20 | class WebTestCase extends BaseWebTestCase |
||
21 | { |
||
22 | public static function assertRedirect($response, $location) |
||
23 | { |
||
24 | self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.$response->getStatusCode()); |
||
25 | self::assertEquals('http://localhost'.$location, $response->headers->get('Location')); |
||
26 | } |
||
27 | |||
28 | protected static function deleteTmpDir($testCase) |
||
29 | { |
||
30 | if (!file_exists($dir = sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$testCase)) { |
||
31 | return; |
||
32 | } |
||
33 | |||
34 | $fs = new Filesystem(); |
||
35 | $fs->remove($dir); |
||
36 | } |
||
37 | |||
38 | protected static function getKernelClass() |
||
39 | { |
||
40 | require_once __DIR__.'/app/AppKernel.php'; |
||
41 | |||
42 | return 'SWP\Bundle\BridgeBundle\Tests\Functional\app\AppKernel'; |
||
43 | } |
||
44 | |||
45 | protected static function createKernel(array $options = array()) |
||
46 | { |
||
47 | $class = self::getKernelClass(); |
||
48 | |||
49 | if (!isset($options['test_case'])) { |
||
50 | throw new \InvalidArgumentException('The option "test_case" must be set.'); |
||
51 | } |
||
52 | |||
53 | return new $class( |
||
54 | $options['test_case'], |
||
55 | isset($options['root_config']) ? $options['root_config'] : 'config.yml', |
||
56 | isset($options['environment']) ? $options['environment'] : 'frameworkbundletest'.strtolower($options['test_case']), |
||
57 | isset($options['debug']) ? $options['debug'] : true |
||
58 | ); |
||
59 | } |
||
60 | } |
||
61 |