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
1c80b9d2
Commit
1c80b9d2
authored
Apr 02, 2014
by
Alex-Code
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test case for new truncate methods.
Test case for new truncate methods.
parent
50efd323
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
StringHelperTest.php
tests/unit/framework/helpers/StringHelperTest.php
+15
-0
No files found.
tests/unit/framework/helpers/StringHelperTest.php
View file @
1c80b9d2
...
...
@@ -65,4 +65,19 @@ class StringHelperTest extends TestCase
$this
->
assertEquals
(
'foo'
,
StringHelper
::
basename
(
'/bar/foo/'
));
$this
->
assertEquals
(
'foo'
,
StringHelper
::
basename
(
'\\bar\\foo\\'
));
}
public
function
testTruncate
()
{
$this
->
assertEquals
(
'string test'
,
StringHelper
::
truncate
(
'string test'
,
20
));
$this
->
assertEquals
(
'string...'
,
StringHelper
::
truncate
(
'string test'
,
6
));
$this
->
assertEquals
(
'string!!!'
,
StringHelper
::
truncate
(
'string test'
,
6
,
'!!!'
));
}
public
function
testTruncateWords
()
{
$this
->
assertEquals
(
'this is a string test'
,
StringHelper
::
truncateWords
(
'this is a string test'
,
5
));
$this
->
assertEquals
(
'this is a string...'
,
StringHelper
::
truncateWords
(
'this is a string test'
,
4
));
$this
->
assertEquals
(
'this is a string!!!'
,
StringHelper
::
truncateWords
(
'this is a string test'
,
4
,
'!!!'
));
$this
->
assertEquals
(
'this is a big space...'
,
StringHelper
::
truncateWords
(
'this is a big space string'
,
5
));
}
}
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