vendor/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php
changeset 0 7f95f8617b0b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php	Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * This file is part of the Symfony framework.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
+
+use Symfony\Component\HttpKernel\Util\Filesystem;
+use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
+
+class WebTestCase extends BaseWebTestCase
+{
+    static public function assertRedirect($response, $location)
+    {
+        self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.$response->getStatusCode());
+        self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
+    }
+
+    protected function setUp()
+    {
+        if (!class_exists('Twig_Environment')) {
+            $this->markTestSkipped('Twig is not available.');
+        }
+
+        parent::setUp();
+    }
+
+    protected function deleteTmpDir($testCase)
+    {
+        if (!file_exists($dir = sys_get_temp_dir().'/'.$testCase)) {
+            return;
+        }
+
+        $fs = new Filesystem();
+        $fs->remove($dir);
+    }
+
+    static protected function getKernelClass()
+    {
+        require_once __DIR__.'/app/AppKernel.php';
+
+        return 'Symfony\Bundle\SecurityBundle\Tests\Functional\AppKernel';
+    }
+
+    static protected function createKernel(array $options = array())
+    {
+        $class = self::getKernelClass();
+
+        if (!isset($options['test_case'])) {
+            throw new \InvalidArgumentException('The option "test_case" must be set.');
+        }
+
+        return new $class(
+            $options['test_case'],
+            isset($options['root_config']) ? $options['root_config'] : 'config.yml',
+            isset($options['environment']) ? $options['environment'] : 'test',
+            isset($options['debug']) ? $options['debug'] : true
+        );
+    }
+}