Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
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
PSDI Army
yii2
Commits
01600bf6
Commit
01600bf6
authored
Sep 17, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test case for menu widget
fixes #5080
parent
6230aa75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
MenuTest.php
tests/unit/framework/widgets/MenuTest.php
+70
-0
No files found.
tests/unit/framework/widgets/MenuTest.php
0 → 100644
View file @
01600bf6
<?php
namespace
yiiunit\framework\widgets
;
use
yii\widgets\Menu
;
use
yii\widgets\Spaceless
;
/**
* @group widgets
*/
class
MenuTest
extends
\yiiunit\TestCase
{
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
mockApplication
();
}
public
function
testEncodeLabel
()
{
$output
=
Menu
::
widget
([
'route'
=>
'test/test'
,
'params'
=>
[],
'encodeLabels'
=>
true
,
'items'
=>
[
[
'encode'
=>
false
,
'label'
=>
'<span class="glyphicon glyphicon-user"></span> Users'
,
'url'
=>
'#'
,
],
[
'encode'
=>
true
,
'label'
=>
'Authors & Publications'
,
'url'
=>
'#'
,
],
]
]);
$this
->
assertEquals
(
<<<HTML
<ul><li><a href="#"><span class="glyphicon glyphicon-user"></span> Users</a></li>
<li><a href="#">Authors & Publications</a></li></ul>
HTML
,
$output
);
$output
=
Menu
::
widget
([
'route'
=>
'test/test'
,
'params'
=>
[],
'encodeLabels'
=>
false
,
'items'
=>
[
[
'encode'
=>
false
,
'label'
=>
'<span class="glyphicon glyphicon-user"></span> Users'
,
'url'
=>
'#'
,
],
[
'encode'
=>
true
,
'label'
=>
'Authors & Publications'
,
'url'
=>
'#'
,
],
]
]);
$this
->
assertEquals
(
<<<HTML
<ul><li><a href="#"><span class="glyphicon glyphicon-user"></span> Users</a></li>
<li><a href="#">Authors & Publications</a></li></ul>
HTML
,
$output
);
}
}
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