Commit 758603dc authored by Igor Wiedler's avatar Igor Wiedler

move some parts around

parent 595c8531
<?php <?php
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/* /*
* This file is part of the Silex framework. * This file is part of the Silex framework.
* *
...@@ -16,6 +9,13 @@ use Symfony\Component\HttpFoundation\Response; ...@@ -16,6 +9,13 @@ use Symfony\Component\HttpFoundation\Response;
* with this source code in the file LICENSE. * with this source code in the file LICENSE.
*/ */
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/** /**
* Error handler test cases. * Error handler test cases.
* *
......
<?php <?php
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/* /*
* This file is part of the Silex framework. * This file is part of the Silex framework.
* *
...@@ -16,6 +9,13 @@ use Symfony\Component\HttpFoundation\Response; ...@@ -16,6 +9,13 @@ use Symfony\Component\HttpFoundation\Response;
* with this source code in the file LICENSE. * with this source code in the file LICENSE.
*/ */
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/** /**
* Error handler test cases. * Error handler test cases.
* *
......
<?php <?php
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
/* /*
* This file is part of the Silex framework. * This file is part of the Silex framework.
* *
...@@ -14,6 +9,11 @@ use Symfony\Component\HttpFoundation\Request; ...@@ -14,6 +9,11 @@ use Symfony\Component\HttpFoundation\Request;
* with this source code in the file LICENSE. * with this source code in the file LICENSE.
*/ */
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Framework test cases. * Framework test cases.
* *
......
<?php <?php
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/* /*
* This file is part of the Silex framework. * This file is part of the Silex framework.
* *
...@@ -18,6 +9,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; ...@@ -18,6 +9,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* with this source code in the file LICENSE. * with this source code in the file LICENSE.
*/ */
namespace Silex\Tests;
use Silex\Framework;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* Router test cases. * Router test cases.
* *
...@@ -136,13 +136,6 @@ class RouterTest extends \PHPUnit_Framework_TestCase ...@@ -136,13 +136,6 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$this->checkRouteResponse($framework, '/resource', 'delete resource', 'delete'); $this->checkRouteResponse($framework, '/resource', 'delete resource', 'delete');
} }
protected function checkRouteResponse($framework, $path, $expectedContent, $method = 'get', $message = null)
{
$request = Request::create($path, $method);
$response = $framework->handle($request);
$this->assertEquals($expectedContent, $response->getContent(), $message);
}
public function testRequestShouldBeStoredRegardlessOfRouting() { public function testRequestShouldBeStoredRegardlessOfRouting() {
$framework = new Framework(); $framework = new Framework();
$framework->get('/foo', function() use ($framework) { $framework->get('/foo', function() use ($framework) {
...@@ -157,4 +150,11 @@ class RouterTest extends \PHPUnit_Framework_TestCase ...@@ -157,4 +150,11 @@ class RouterTest extends \PHPUnit_Framework_TestCase
$this->assertContains($path, $response->getContent()); $this->assertContains($path, $response->getContent());
} }
} }
protected function checkRouteResponse($framework, $path, $expectedContent, $method = 'get', $message = null)
{
$request = Request::create($path, $method);
$response = $framework->handle($request);
$this->assertEquals($expectedContent, $response->getContent(), $message);
}
} }
<?php <?php
namespace Silex\Tests;
use Silex\Framework;
use Silex\WebTestCase;
/* /*
* This file is part of the Silex framework. * This file is part of the Silex framework.
* *
...@@ -14,6 +9,11 @@ use Silex\WebTestCase; ...@@ -14,6 +9,11 @@ use Silex\WebTestCase;
* with this source code in the file LICENSE. * with this source code in the file LICENSE.
*/ */
namespace Silex\Tests;
use Silex\Framework;
use Silex\WebTestCase;
/** /**
* Functional test cases. * Functional test cases.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment