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
6d8aa2d4
Commit
6d8aa2d4
authored
Oct 05, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests
parent
d06f849a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
ActiveFormTest.php
tests/unit/framework/widgets/ActiveFormTest.php
+21
-7
No files found.
tests/unit/framework/widgets/ActiveFormTest.php
View file @
6d8aa2d4
...
@@ -18,6 +18,14 @@ class ActiveFormTest extends \yiiunit\TestCase
...
@@ -18,6 +18,14 @@ class ActiveFormTest extends \yiiunit\TestCase
$this
->
mockApplication
();
$this
->
mockApplication
();
}
}
public
function
assertEqualsWithoutLE
(
$expected
,
$actual
)
{
$expected
=
str_replace
(
"
\r\n
"
,
"
\n
"
,
$expected
);
$actual
=
str_replace
(
"
\r\n
"
,
"
\n
"
,
$actual
);
$this
->
assertEquals
(
$expected
,
$actual
);
}
public
function
testBooleanAttributes
()
public
function
testBooleanAttributes
()
{
{
$o
=
[
'template'
=>
'{input}'
];
$o
=
[
'template'
=>
'{input}'
];
...
@@ -27,14 +35,14 @@ class ActiveFormTest extends \yiiunit\TestCase
...
@@ -27,14 +35,14 @@ class ActiveFormTest extends \yiiunit\TestCase
$form
=
new
ActiveForm
([
'action'
=>
'/something'
]);
$form
=
new
ActiveForm
([
'action'
=>
'/something'
]);
ob_end_clean
();
ob_end_clean
();
$this
->
assertEquals
(
<<<EOF
$this
->
assertEquals
WithoutLE
(
<<<EOF
<div class="form-group field-dynamicmodel-name">
<div class="form-group field-dynamicmodel-name">
<input type="email" id="dynamicmodel-name" class="form-control" name="DynamicModel[name]" required>
<input type="email" id="dynamicmodel-name" class="form-control" name="DynamicModel[name]" required>
</div>
</div>
EOF
EOF
,
(
string
)
$form
->
field
(
$model
,
'name'
,
$o
)
->
input
(
'email'
,
[
'required'
=>
true
]));
,
(
string
)
$form
->
field
(
$model
,
'name'
,
$o
)
->
input
(
'email'
,
[
'required'
=>
true
]));
$this
->
assertEquals
(
<<<EOF
$this
->
assertEquals
WithoutLE
(
<<<EOF
<div class="form-group field-dynamicmodel-name">
<div class="form-group field-dynamicmodel-name">
<input type="email" id="dynamicmodel-name" class="form-control" name="DynamicModel[name]">
<input type="email" id="dynamicmodel-name" class="form-control" name="DynamicModel[name]">
</div>
</div>
...
@@ -42,7 +50,7 @@ EOF
...
@@ -42,7 +50,7 @@ EOF
,
(
string
)
$form
->
field
(
$model
,
'name'
,
$o
)
->
input
(
'email'
,
[
'required'
=>
false
]));
,
(
string
)
$form
->
field
(
$model
,
'name'
,
$o
)
->
input
(
'email'
,
[
'required'
=>
false
]));
$this
->
assertEquals
(
<<<EOF
$this
->
assertEquals
WithoutLE
(
<<<EOF
<div class="form-group field-dynamicmodel-name">
<div class="form-group field-dynamicmodel-name">
<input type="email" id="dynamicmodel-name" class="form-control" name="DynamicModel[name]" required="test">
<input type="email" id="dynamicmodel-name" class="form-control" name="DynamicModel[name]" required="test">
</div>
</div>
...
@@ -53,6 +61,8 @@ EOF
...
@@ -53,6 +61,8 @@ EOF
public
function
testIssue5356
()
public
function
testIssue5356
()
{
{
$o
=
[
'template'
=>
'{input}'
];
$model
=
new
DynamicModel
([
'categories'
]);
$model
=
new
DynamicModel
([
'categories'
]);
$model
->
categories
=
1
;
$model
->
categories
=
1
;
ob_start
();
ob_start
();
...
@@ -60,11 +70,15 @@ EOF
...
@@ -60,11 +70,15 @@ EOF
ob_end_clean
();
ob_end_clean
();
// https://github.com/yiisoft/yii2/issues/5356
// https://github.com/yiisoft/yii2/issues/5356
$this
->
assertEquals
(
<<<EOF
$this
->
assertEqualsWithoutLE
(
<<<EOF
<div class="form-group field-dynamicmodel-name">
<div class="form-group field-dynamicmodel-categories">
<input type="email" id="dynamicmodel-name" class="form-control" name="DynamicModel[name]" required>
<input type="hidden" name="DynamicModel[categories]" value=""><select id="dynamicmodel-categories" class="form-control" name="DynamicModel[categories][]" multiple size="4">
<option value="0">apple</option>
<option value="1" selected>banana</option>
<option value="2">avocado</option>
</select>
</div>
</div>
EOF
EOF
,
(
string
)
$form
->
field
(
$model
,
'categories'
)
->
listBox
([
'apple'
,
'banana'
,
'avocado'
],
[
'multiple'
=>
true
]));
,
(
string
)
$form
->
field
(
$model
,
'categories'
,
$o
)
->
listBox
([
'apple'
,
'banana'
,
'avocado'
],
[
'multiple'
=>
true
]));
}
}
}
}
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