Commit 2628fa4e authored by Igor Wiedler's avatar Igor Wiedler

remove Framework::create(), use new instead

parent f09b9144
......@@ -6,7 +6,7 @@ Silex is a simple web framework to develop simple websites:
use Silex\Framework;
$app = Framework::create();
$app = new Framework();
$app->get('/home/{name}', function($name) {
return "Hello $name";
......
......@@ -343,16 +343,4 @@ class Framework extends HttpKernel
}
}
}
/**
* Convenience method to create a new instance of Framework.
*
* @param array $map
*
* @return instance of Framework
*/
public static function create(array $map = null)
{
return new static($map);
}
}
......@@ -29,7 +29,7 @@ class BeforeAfterFilterTest extends \PHPUnit_Framework_TestCase
$test = $this;
$framework = Framework::create();
$framework = new Framework();
$framework->before(function() use(&$i, $test) {
$test->assertEquals(0, $i);
$i++;
......
......@@ -25,7 +25,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
{
public function testNoErrorHandler()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/foo' => function() {
throw new \RuntimeException('foo exception');
},
......@@ -42,7 +42,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public function testOneErrorHandler()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/foo' => function() {
throw new \RuntimeException('foo exception');
},
......@@ -58,7 +58,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public function testMultipleErrorHandlers()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/foo' => function() {
throw new \RuntimeException('foo exception');
},
......@@ -88,7 +88,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public function testNoResponseErrorHandler()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/foo' => function() {
throw new \RuntimeException('foo exception');
},
......@@ -113,7 +113,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public function testStringResponseErrorHandler()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/foo' => function() {
throw new \RuntimeException('foo exception');
},
......@@ -129,7 +129,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public function testErrorHandlerException()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/foo' => function() {
throw new \RuntimeException('foo exception');
},
......
......@@ -20,15 +20,9 @@ use Silex\Framework;
*/
class FrameworkTest extends \PHPUnit_Framework_TestCase
{
public function testCreate()
{
$framework = Framework::create();
$this->assertInstanceOf('Silex\Framework', $framework, "Framework::create() must return instance of Framework");
}
public function testFluidInterface()
{
$framework = Framework::create();
$framework = new Framework();
$returnValue = $framework->match('/foo', function() {});
$this->assertSame($framework, $returnValue, '->match() should return $this');
......
......@@ -26,7 +26,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
{
public function testMapRouting()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/foo' => function() {
return 'foo';
},
......@@ -45,7 +45,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public function testMapRoutingMethods()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'GET /foo' => function() {
return 'foo';
},
......@@ -89,7 +89,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public function testMapRoutingParameters()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/hello' => function() {
return "Hello anon";
},
......@@ -118,7 +118,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public function testStatusCode()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'PUT /created' => function() {
return new Response('', 201);
},
......@@ -145,7 +145,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public function testRedirect()
{
$framework = Framework::create(array(
$framework = new Framework(array(
'/redirect' => function() {
$response = new Response();
$response->setRedirect('/target');
......@@ -163,7 +163,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
*/
public function testMissingRoute()
{
$framework = Framework::create();
$framework = new Framework();
$request = Request::create('http://test.com/baz');
$framework->handle($request);
......@@ -171,7 +171,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public function testMethodRouting()
{
$framework = Framework::create();
$framework = new Framework();
$framework->match('/foo', function() {
return 'foo';
});
......
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