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
82a6281c
Commit
82a6281c
authored
May 21, 2013
by
Antonio Ramirez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests
parent
8101b5ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
1 deletion
+70
-1
InflectorTest.php
tests/unit/framework/helpers/InflectorTest.php
+51
-0
Inflector.php
yii/helpers/Inflector.php
+18
-0
Inflector.php
yii/helpers/base/Inflector.php
+1
-1
No files found.
tests/unit/framework/helpers/InflectorTest.php
0 → 100644
View file @
82a6281c
<?php
namespace
yiiunit\framework\helpers
;
use
Yii
;
use
yii\helpers\Inflector
;
use
yiiunit\TestCase
;
class
InflectorTest
extends
TestCase
{
public
function
testPluralize
()
{
$this
->
assertEquals
(
"people"
,
Inflector
::
pluralize
(
'person'
));
$this
->
assertEquals
(
"fish"
,
Inflector
::
pluralize
(
'fish'
));
$this
->
assertEquals
(
"men"
,
Inflector
::
pluralize
(
'man'
));
$this
->
assertEquals
(
"tables"
,
Inflector
::
pluralize
(
'table'
));
}
public
function
testSingularize
()
{
$this
->
assertEquals
(
"person"
,
Inflector
::
singularize
(
'people'
));
$this
->
assertEquals
(
"fish"
,
Inflector
::
singularize
(
'fish'
));
$this
->
assertEquals
(
"man"
,
Inflector
::
singularize
(
'men'
));
$this
->
assertEquals
(
"table"
,
Inflector
::
singularize
(
'tables'
));
}
public
function
testTitleize
()
{
$this
->
assertEquals
(
"Me my self and i"
,
Inflector
::
titleize
(
'MeMySelfAndI'
));
$this
->
assertEquals
(
"Me My Self And I"
,
Inflector
::
titleize
(
'MeMySelfAndI'
,
true
));
}
public
function
testCamelize
()
{
$this
->
assertEquals
(
"MeMySelfAndI"
,
Inflector
::
camelize
(
'me my_self-andI'
));
}
public
function
testUnderscore
()
{
$this
->
assertEquals
(
"me_my_self_and_i"
,
Inflector
::
underscore
(
'Me my self and I'
));
}
public
function
testHumanize
()
{
$this
->
assertEquals
(
"Me my self and i"
,
Inflector
::
humanize
(
'me_my_self_and_i'
));
$this
->
assertEquals
(
"Me My Self And i"
,
Inflector
::
humanize
(
'me_my_self_and_i'
),
true
);
}
}
yii/helpers/Inflector.php
0 → 100644
View file @
82a6281c
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
;
/**
* Inflector pluralizes and singularizes English nouns. It also contains some other useful methods.
*
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @since 2.0
*/
class
Inflector
extends
base\Inflector
{
}
yii/helpers/base/Inflector.php
View file @
82a6281c
...
@@ -10,7 +10,7 @@ namespace yii\helpers\base;
...
@@ -10,7 +10,7 @@ namespace yii\helpers\base;
use
Yii
;
use
Yii
;
/**
/**
* Inflector pluralizes and singularizes English nouns. It also contains other useful methods.
* Inflector pluralizes and singularizes English nouns. It also contains
some
other useful methods.
*
*
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @since 2.0
* @since 2.0
...
...
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