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
6b65ef58
Commit
6b65ef58
authored
Oct 17, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added intl check to tests, better error reporting, credited Aura.Intl for the…
Added intl check to tests, better error reporting, credited Aura.Intl for the most complex test pattern
parent
71e2dcc6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
MessageFormatterTest.php
tests/unit/framework/i18n/MessageFormatterTest.php
+14
-5
No files found.
tests/unit/framework/i18n/MessageFormatterTest.php
View file @
6b65ef58
...
...
@@ -22,6 +22,13 @@ class MessageFormatterTest extends TestCase
const
SUBJECT
=
'сабж'
;
const
SUBJECT_VALUE
=
'Answer to the Ultimate Question of Life, the Universe, and Everything'
;
protected
function
setUp
()
{
if
(
!
extension_loaded
(
"intl"
))
{
$this
->
markTestSkipped
(
"intl not installed. Skipping."
);
}
}
public
function
patterns
()
{
return
array
(
...
...
@@ -34,6 +41,7 @@ class MessageFormatterTest extends TestCase
)
),
// This one was provided by Aura.Intl. Thanks!
array
(
<<<_MSG_
{gender_of_host, select,
female {{num_guests, plural, offset:1
...
...
@@ -117,7 +125,7 @@ _MSG_
public
function
testNamedArgumentsStatic
(
$pattern
,
$expected
,
$args
)
{
$result
=
MessageFormatter
::
formatMessage
(
'en_US'
,
$pattern
,
$args
);
$this
->
assertEquals
(
$expected
,
$result
);
$this
->
assertEquals
(
$expected
,
$result
,
intl_get_error_message
()
);
}
/**
...
...
@@ -127,7 +135,7 @@ _MSG_
{
$formatter
=
new
MessageFormatter
(
'en_US'
,
$pattern
);
$result
=
$formatter
->
format
(
$args
);
$this
->
assertEquals
(
$expected
,
$result
);
$this
->
assertEquals
(
$expected
,
$result
,
$formatter
->
getErrorMessage
()
);
}
public
function
testInsufficientArguments
()
...
...
@@ -138,7 +146,7 @@ _MSG_
self
::
N
=>
self
::
N_VALUE
,
));
$this
->
assertEquals
(
$expected
,
$result
);
$this
->
assertEquals
(
$expected
,
$result
,
intl_get_error_message
()
);
}
/**
...
...
@@ -160,10 +168,10 @@ _MSG_
{
$pattern
=
'{'
.
self
::
SUBJECT
.
'} is '
.
self
::
N
;
$result
=
MessageFormatter
::
formatMessage
(
'en_US'
,
$pattern
,
array
());
$this
->
assertEquals
(
$pattern
,
$result
);
$this
->
assertEquals
(
$pattern
,
$result
,
intl_get_error_message
()
);
$formatter
=
new
MessageFormatter
(
'en_US'
,
$pattern
);
$result
=
$formatter
->
format
(
array
());
$this
->
assertEquals
(
$pattern
,
$result
);
$this
->
assertEquals
(
$pattern
,
$result
,
$formatter
->
getErrorMessage
()
);
}
}
\ 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