Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
e979cf14
Commit
e979cf14
authored
Oct 11, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #115 from ericbarnes/fix/str_tests
Fix/str tests
parents
d9512221
aa607c99
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
laravel/str.php
+1
-1
tests/Cases/StrTest.php
+14
-0
No files found.
laravel/str.php
View file @
e979cf14
...
@@ -118,7 +118,7 @@ class Str {
...
@@ -118,7 +118,7 @@ class Str {
if
(
function_exists
(
'mb_substr'
))
if
(
function_exists
(
'mb_substr'
))
{
{
return
mb_substr
(
$value
,
0
,
$length
)
.
$end
;
return
mb_substr
(
$value
,
0
,
$length
,
Config
::
get
(
'application.encoding'
)
)
.
$end
;
}
}
return
substr
(
$value
,
0
,
$length
)
.
$end
;
return
substr
(
$value
,
0
,
$length
)
.
$end
;
...
...
tests/Cases/StrTest.php
View file @
e979cf14
...
@@ -35,4 +35,17 @@ class StrTest extends PHPUnit_Framework_TestCase {
...
@@ -35,4 +35,17 @@ class StrTest extends PHPUnit_Framework_TestCase {
{
{
$this
->
assertEquals
(
5
,
strlen
(
Laravel\Str
::
random
(
5
)));
$this
->
assertEquals
(
5
,
strlen
(
Laravel\Str
::
random
(
5
)));
}
}
public
function
test_limit
()
{
$this
->
assertEquals
(
'Thi...'
,
Laravel\Str
::
limit
(
'This is a string of text'
,
3
,
'...'
));
$this
->
assertEquals
(
'This is '
,
Laravel\Str
::
limit
(
'This is a string of text'
,
7
,
' '
));
$this
->
assertEquals
(
'τάχ'
,
Laravel\Str
::
limit
(
'τάχιστη'
,
3
,
''
));
}
public
function
test_limit_words
()
{
$this
->
assertEquals
(
'This is a...'
,
Laravel\Str
::
limit_words
(
'This is a string of text'
,
3
,
'...'
));
$this
->
assertEquals
(
'This is a string '
,
Laravel\Str
::
limit_words
(
'This is a string of text'
,
4
,
' '
));
}
}
}
\ 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