Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
2628fa4e
Commit
2628fa4e
authored
Jan 16, 2011
by
Igor Wiedler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove Framework::create(), use new instead
parent
f09b9144
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
34 deletions
+16
-34
README.md
README.md
+1
-1
src/Silex/Framework.php
src/Silex/Framework.php
+0
-12
tests/Silex/Tests/BeforeAfterFilterTest.php
tests/Silex/Tests/BeforeAfterFilterTest.php
+1
-1
tests/Silex/Tests/ErrorHandlerTest.php
tests/Silex/Tests/ErrorHandlerTest.php
+6
-6
tests/Silex/Tests/FrameworkTest.php
tests/Silex/Tests/FrameworkTest.php
+1
-7
tests/Silex/Tests/RouterTest.php
tests/Silex/Tests/RouterTest.php
+7
-7
No files found.
README.md
View file @
2628fa4e
...
@@ -6,7 +6,7 @@ Silex is a simple web framework to develop simple websites:
...
@@ -6,7 +6,7 @@ Silex is a simple web framework to develop simple websites:
use Silex\Framework;
use Silex\Framework;
$app =
Framework::create
();
$app =
new Framework
();
$app->get('/home/{name}', function($name) {
$app->get('/home/{name}', function($name) {
return "Hello $name";
return "Hello $name";
...
...
src/Silex/Framework.php
View file @
2628fa4e
...
@@ -343,16 +343,4 @@ class Framework extends HttpKernel
...
@@ -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
);
}
}
}
tests/Silex/Tests/BeforeAfterFilterTest.php
View file @
2628fa4e
...
@@ -29,7 +29,7 @@ class BeforeAfterFilterTest extends \PHPUnit_Framework_TestCase
...
@@ -29,7 +29,7 @@ class BeforeAfterFilterTest extends \PHPUnit_Framework_TestCase
$test
=
$this
;
$test
=
$this
;
$framework
=
Framework
::
create
();
$framework
=
new
Framework
();
$framework
->
before
(
function
()
use
(
&
$i
,
$test
)
{
$framework
->
before
(
function
()
use
(
&
$i
,
$test
)
{
$test
->
assertEquals
(
0
,
$i
);
$test
->
assertEquals
(
0
,
$i
);
$i
++
;
$i
++
;
...
...
tests/Silex/Tests/ErrorHandlerTest.php
View file @
2628fa4e
...
@@ -25,7 +25,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
...
@@ -25,7 +25,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
{
{
public
function
testNoErrorHandler
()
public
function
testNoErrorHandler
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/foo'
=>
function
()
{
'/foo'
=>
function
()
{
throw
new
\RuntimeException
(
'foo exception'
);
throw
new
\RuntimeException
(
'foo exception'
);
},
},
...
@@ -42,7 +42,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
...
@@ -42,7 +42,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public
function
testOneErrorHandler
()
public
function
testOneErrorHandler
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/foo'
=>
function
()
{
'/foo'
=>
function
()
{
throw
new
\RuntimeException
(
'foo exception'
);
throw
new
\RuntimeException
(
'foo exception'
);
},
},
...
@@ -58,7 +58,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
...
@@ -58,7 +58,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public
function
testMultipleErrorHandlers
()
public
function
testMultipleErrorHandlers
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/foo'
=>
function
()
{
'/foo'
=>
function
()
{
throw
new
\RuntimeException
(
'foo exception'
);
throw
new
\RuntimeException
(
'foo exception'
);
},
},
...
@@ -88,7 +88,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
...
@@ -88,7 +88,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public
function
testNoResponseErrorHandler
()
public
function
testNoResponseErrorHandler
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/foo'
=>
function
()
{
'/foo'
=>
function
()
{
throw
new
\RuntimeException
(
'foo exception'
);
throw
new
\RuntimeException
(
'foo exception'
);
},
},
...
@@ -113,7 +113,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
...
@@ -113,7 +113,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public
function
testStringResponseErrorHandler
()
public
function
testStringResponseErrorHandler
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/foo'
=>
function
()
{
'/foo'
=>
function
()
{
throw
new
\RuntimeException
(
'foo exception'
);
throw
new
\RuntimeException
(
'foo exception'
);
},
},
...
@@ -129,7 +129,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
...
@@ -129,7 +129,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
public
function
testErrorHandlerException
()
public
function
testErrorHandlerException
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/foo'
=>
function
()
{
'/foo'
=>
function
()
{
throw
new
\RuntimeException
(
'foo exception'
);
throw
new
\RuntimeException
(
'foo exception'
);
},
},
...
...
tests/Silex/Tests/FrameworkTest.php
View file @
2628fa4e
...
@@ -20,15 +20,9 @@ use Silex\Framework;
...
@@ -20,15 +20,9 @@ use Silex\Framework;
*/
*/
class
FrameworkTest
extends
\PHPUnit_Framework_TestCase
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
()
public
function
testFluidInterface
()
{
{
$framework
=
Framework
::
create
();
$framework
=
new
Framework
();
$returnValue
=
$framework
->
match
(
'/foo'
,
function
()
{});
$returnValue
=
$framework
->
match
(
'/foo'
,
function
()
{});
$this
->
assertSame
(
$framework
,
$returnValue
,
'->match() should return $this'
);
$this
->
assertSame
(
$framework
,
$returnValue
,
'->match() should return $this'
);
...
...
tests/Silex/Tests/RouterTest.php
View file @
2628fa4e
...
@@ -26,7 +26,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
...
@@ -26,7 +26,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
{
{
public
function
testMapRouting
()
public
function
testMapRouting
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/foo'
=>
function
()
{
'/foo'
=>
function
()
{
return
'foo'
;
return
'foo'
;
},
},
...
@@ -45,7 +45,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
...
@@ -45,7 +45,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public
function
testMapRoutingMethods
()
public
function
testMapRoutingMethods
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'GET /foo'
=>
function
()
{
'GET /foo'
=>
function
()
{
return
'foo'
;
return
'foo'
;
},
},
...
@@ -89,7 +89,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
...
@@ -89,7 +89,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public
function
testMapRoutingParameters
()
public
function
testMapRoutingParameters
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/hello'
=>
function
()
{
'/hello'
=>
function
()
{
return
"Hello anon"
;
return
"Hello anon"
;
},
},
...
@@ -118,7 +118,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
...
@@ -118,7 +118,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public
function
testStatusCode
()
public
function
testStatusCode
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'PUT /created'
=>
function
()
{
'PUT /created'
=>
function
()
{
return
new
Response
(
''
,
201
);
return
new
Response
(
''
,
201
);
},
},
...
@@ -145,7 +145,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
...
@@ -145,7 +145,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public
function
testRedirect
()
public
function
testRedirect
()
{
{
$framework
=
Framework
::
create
(
array
(
$framework
=
new
Framework
(
array
(
'/redirect'
=>
function
()
{
'/redirect'
=>
function
()
{
$response
=
new
Response
();
$response
=
new
Response
();
$response
->
setRedirect
(
'/target'
);
$response
->
setRedirect
(
'/target'
);
...
@@ -163,7 +163,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
...
@@ -163,7 +163,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
*/
*/
public
function
testMissingRoute
()
public
function
testMissingRoute
()
{
{
$framework
=
Framework
::
create
();
$framework
=
new
Framework
();
$request
=
Request
::
create
(
'http://test.com/baz'
);
$request
=
Request
::
create
(
'http://test.com/baz'
);
$framework
->
handle
(
$request
);
$framework
->
handle
(
$request
);
...
@@ -171,7 +171,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
...
@@ -171,7 +171,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
public
function
testMethodRouting
()
public
function
testMethodRouting
()
{
{
$framework
=
Framework
::
create
();
$framework
=
new
Framework
();
$framework
->
match
(
'/foo'
,
function
()
{
$framework
->
match
(
'/foo'
,
function
()
{
return
'foo'
;
return
'foo'
;
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment