Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
str.php
laravel/str.php
+1
-1
StrTest.php
tests/Cases/StrTest.php
+13
-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