Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
37b5f614
Commit
37b5f614
authored
Jan 25, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more view tests.
parent
b812f2f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
view.test.php
tests/cases/laravel/view.test.php
+55
-0
nested.php
tests/laravel/application/views/tests/nested.php
+1
-0
No files found.
tests/cases/laravel/view.test.php
View file @
37b5f614
...
...
@@ -2,6 +2,15 @@
class
ViewTest
extends
PHPUnit_Framework_TestCase
{
/**
* Tear down the testing environment.
*/
public
function
tearDown
()
{
View
::
$shared
=
array
();
Event
::
$events
=
array
();
}
/**
* Test the View::make method.
*
...
...
@@ -162,6 +171,7 @@ class ViewTest extends PHPUnit_Framework_TestCase {
$view
=
View
::
make
(
'home.index'
)
->
nest
(
'partial'
,
'tests.basic'
);
$this
->
assertEquals
(
'tests.basic'
,
$view
->
data
[
'partial'
]
->
view
);
$this
->
assertInstanceOf
(
'Laravel\\View'
,
$view
->
data
[
'partial'
]);
}
...
...
@@ -179,4 +189,49 @@ class ViewTest extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
'Taylor is 25'
,
$view
);
}
/**
* Test that the View class renders nested views.
*
* @group laravel
*/
public
function
testNestedViewsAreRendered
()
{
$view
=
View
::
make
(
'tests.basic'
)
->
with
(
'age'
,
25
)
->
nest
(
'name'
,
'tests.nested'
);
$this
->
assertEquals
(
'Taylor is 25'
,
$view
->
render
());
}
/**
* Test that the View class renders nested responses.
*
* @group laravel
*/
public
function
testNestedResponsesAreRendered
()
{
$view
=
View
::
make
(
'tests.basic'
)
->
with
(
'age'
,
25
)
->
with
(
'name'
,
Response
::
view
(
'tests.nested'
));
$this
->
assertEquals
(
'Taylor is 25'
,
$view
->
render
());
}
/**
* Test the View class raises a composer event.
*
* @group laravel
*/
public
function
testComposerEventIsCalledWhenViewIsRendering
()
{
View
::
composer
(
'tests.basic'
,
function
(
$view
)
{
$view
->
data
=
array
(
'name'
=>
'Taylor'
,
'age'
=>
25
);
});
$view
=
View
::
make
(
'tests.basic'
)
->
render
();
$this
->
assertEquals
(
'Taylor is 25'
,
$view
);
}
}
\ No newline at end of file
tests/laravel/application/views/tests/nested.php
0 → 100644
View file @
37b5f614
Taylor
\ No newline at end of file
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