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
c642d13b
Commit
c642d13b
authored
Mar 29, 2011
by
Igor Wiedler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TwigExtension] initial test case
parent
a085d9e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
0 deletions
+54
-0
.gitmodules
.gitmodules
+3
-0
tests/Silex/Tests/Extension/TwigExtensionTest.php
tests/Silex/Tests/Extension/TwigExtensionTest.php
+50
-0
vendor/twig
vendor/twig
+1
-0
No files found.
.gitmodules
View file @
c642d13b
...
...
@@ -28,3 +28,6 @@
[submodule "vendor/pimple"]
path = vendor/pimple
url = https://github.com/fabpot/Pimple
[submodule "vendor/twig"]
path = vendor/twig
url = https://github.com/fabpot/Twig
tests/Silex/Tests/Extension/TwigExtensionTest.php
0 → 100644
View file @
c642d13b
<?php
/*
* This file is part of the Silex 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
Silex\Tests
;
use
Silex\Application
;
use
Silex\Extension\TwigExtension
;
use
Symfony\Component\HttpFoundation\Request
;
/**
* TwigExtension test cases.
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
class
TwigExtensionTest
extends
\PHPUnit_Framework_TestCase
{
public
function
setUp
()
{
if
(
!
is_dir
(
__DIR__
.
'/../../../../vendor/twig'
))
{
$this
->
markTestSkipped
(
'Twig submodule was not installed.'
);
}
}
public
function
testRegisterAndRender
()
{
$app
=
new
Application
();
$app
->
register
(
new
TwigExtension
(),
array
(
'twig.templates'
=>
array
(
'hello'
=>
'Hello {{ name }}!'
),
'twig.class_path'
=>
__DIR__
.
'/../../../../vendor/twig/lib'
,
));
$app
->
get
(
'/hello/{name}'
,
function
(
$name
)
use
(
$app
)
{
return
$app
[
'twig'
]
->
render
(
'hello'
,
array
(
'name'
=>
$name
));
});
$request
=
Request
::
create
(
'/hello/john'
);
$response
=
$app
->
handle
(
$request
);
$this
->
assertEquals
(
'Hello john!'
,
$response
->
getContent
());
}
}
twig
@
2f106a80
Subproject commit 2f106a80cc13b4260074e573fa017a770fe20350
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