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
0596fa82
Commit
0596fa82
authored
11 years ago
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code style fixes
parent
edb77393
Hide whitespace changes
Inline
Side-by-side
Showing
67 changed files
with
306 additions
and
332 deletions
+306
-332
params.php
apps/advanced/backend/config/params.php
+1
-3
main.php
apps/advanced/backend/views/layouts/main.php
+1
-3
params.php
apps/advanced/console/config/params.php
+1
-3
params-local.php
...advanced/environments/dev/backend/config/params-local.php
+1
-2
params-local.php
.../advanced/environments/dev/common/config/params-local.php
+1
-2
params-local.php
...advanced/environments/dev/console/config/params-local.php
+1
-2
params-local.php
...dvanced/environments/dev/frontend/config/params-local.php
+1
-2
params-local.php
...dvanced/environments/prod/backend/config/params-local.php
+1
-2
params-local.php
...advanced/environments/prod/common/config/params-local.php
+1
-2
params-local.php
...dvanced/environments/prod/console/config/params-local.php
+1
-2
params-local.php
...vanced/environments/prod/frontend/config/params-local.php
+1
-2
params.php
apps/advanced/frontend/config/params.php
+1
-3
main.php
apps/advanced/frontend/views/layouts/main.php
+1
-2
ClassmapController.php
build/controllers/ClassmapController.php
+1
-1
ViewRenderer.php
extensions/twig/yii/twig/ViewRenderer.php
+1
-1
Captcha.php
framework/yii/captcha/Captcha.php
+0
-1
TestCase.php
tests/unit/TestCase.php
+1
-1
Customer.php
tests/unit/data/ar/Customer.php
+1
-1
Order.php
tests/unit/data/ar/Order.php
+1
-1
InvalidRulesModel.php
tests/unit/data/base/InvalidRulesModel.php
+1
-1
Singer.php
tests/unit/data/base/Singer.php
+1
-0
Speaker.php
tests/unit/data/base/Speaker.php
+1
-0
config.php
tests/unit/data/config.php
+2
-3
BehaviorTest.php
tests/unit/framework/base/BehaviorTest.php
+0
-1
ComponentTest.php
tests/unit/framework/base/ComponentTest.php
+3
-3
ModelTest.php
tests/unit/framework/base/ModelTest.php
+1
-0
ObjectTest.php
tests/unit/framework/base/ObjectTest.php
+1
-1
AutoTimestampTest.php
tests/unit/framework/behaviors/AutoTimestampTest.php
+3
-3
ApcCacheTest.php
tests/unit/framework/caching/ApcCacheTest.php
+2
-1
CacheTestCase.php
tests/unit/framework/caching/CacheTestCase.php
+2
-1
DbCacheTest.php
tests/unit/framework/caching/DbCacheTest.php
+2
-2
FileCacheTest.php
tests/unit/framework/caching/FileCacheTest.php
+1
-0
MemCacheTest.php
tests/unit/framework/caching/MemCacheTest.php
+1
-0
MemCachedTest.php
tests/unit/framework/caching/MemCachedTest.php
+1
-0
WinCacheTest.php
tests/unit/framework/caching/WinCacheTest.php
+1
-0
XCacheTest.php
tests/unit/framework/caching/XCacheTest.php
+1
-0
ZendDataCacheTest.php
tests/unit/framework/caching/ZendDataCacheTest.php
+1
-0
AssetControllerTest.php
...nit/framework/console/controllers/AssetControllerTest.php
+1
-1
SortTest.php
tests/unit/framework/data/SortTest.php
+1
-1
ActiveRecordTest.php
tests/unit/framework/db/ActiveRecordTest.php
+2
-2
CommandTest.php
tests/unit/framework/db/CommandTest.php
+23
-38
ConnectionTest.php
tests/unit/framework/db/ConnectionTest.php
+6
-6
QueryBuilderTest.php
tests/unit/framework/db/QueryBuilderTest.php
+1
-2
QueryTest.php
tests/unit/framework/db/QueryTest.php
+9
-11
MssqlActiveRecordTest.php
tests/unit/framework/db/mssql/MssqlActiveRecordTest.php
+5
-5
MssqlCommandTest.php
tests/unit/framework/db/mssql/MssqlCommandTest.php
+8
-8
MssqlConnectionTest.php
tests/unit/framework/db/mssql/MssqlConnectionTest.php
+8
-8
MssqlQueryTest.php
tests/unit/framework/db/mssql/MssqlQueryTest.php
+5
-5
PostgreSQLActiveRecordTest.php
tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php
+5
-5
PostgreSQLConnectionTest.php
tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
+12
-12
PostgreSQLQueryBuilderTest.php
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
+1
-3
SqliteActiveRecordTest.php
tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
+5
-5
SqliteCommandTest.php
tests/unit/framework/db/sqlite/SqliteCommandTest.php
+12
-12
SqliteConnectionTest.php
tests/unit/framework/db/sqlite/SqliteConnectionTest.php
+35
-35
SqliteQueryBuilderTest.php
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
+1
-3
SqliteQueryTest.php
tests/unit/framework/db/sqlite/SqliteQueryTest.php
+5
-5
ConsoleTest.php
tests/unit/framework/helpers/ConsoleTest.php
+0
-1
FileHelperTest.php
tests/unit/framework/helpers/FileHelperTest.php
+4
-3
HtmlTest.php
tests/unit/framework/helpers/HtmlTest.php
+3
-3
InflectorTest.php
tests/unit/framework/helpers/InflectorTest.php
+102
-102
JsonTest.php
tests/unit/framework/helpers/JsonTest.php
+2
-1
StringHelperTest.php
tests/unit/framework/helpers/StringHelperTest.php
+1
-0
VarDumperTest.php
tests/unit/framework/helpers/VarDumperTest.php
+1
-0
YiiRequirementCheckerTest.php
...unit/framework/requirements/YiiRequirementCheckerTest.php
+2
-1
EmailValidatorTest.php
tests/unit/framework/validators/EmailValidatorTest.php
+1
-0
SpacelessTest.php
tests/unit/framework/widgets/SpacelessTest.php
+1
-1
SiteController.php
tests/web/app/protected/controllers/SiteController.php
+1
-1
No files found.
apps/advanced/backend/config/params.php
View file @
0596fa82
<?php
return
array
(
'adminEmail'
=>
'admin@example.com'
,
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/backend/views/layouts/main.php
View file @
0596fa82
...
...
@@ -34,8 +34,7 @@ AppAsset::register($this);
);
if
(
Yii
::
$app
->
user
->
isGuest
)
{
$menuItems
[]
=
array
(
'label'
=>
'Login'
,
'url'
=>
array
(
'/site/login'
));
}
else
{
}
else
{
$menuItems
[]
=
array
(
'label'
=>
'Logout ('
.
Yii
::
$app
->
user
->
identity
->
username
.
')'
,
'url'
=>
array
(
'/site/logout'
));
}
echo
Nav
::
widget
(
array
(
...
...
@@ -60,7 +59,6 @@ AppAsset::register($this);
</footer>
<?php
$this
->
endBody
();
?>
</div>
</body>
</html>
<?php
$this
->
endPage
();
?>
This diff is collapsed.
Click to expand it.
apps/advanced/console/config/params.php
View file @
0596fa82
<?php
return
array
(
'adminEmail'
=>
'admin@example.com'
,
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/dev/backend/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/dev/common/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/dev/console/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/dev/frontend/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/prod/backend/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/prod/common/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/prod/console/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/environments/prod/frontend/config/params-local.php
View file @
0596fa82
<?php
return
array
(
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/config/params.php
View file @
0596fa82
<?php
return
array
(
'adminEmail'
=>
'admin@example.com'
,
);
\ No newline at end of file
);
This diff is collapsed.
Click to expand it.
apps/advanced/frontend/views/layouts/main.php
View file @
0596fa82
...
...
@@ -38,8 +38,7 @@ AppAsset::register($this);
if
(
Yii
::
$app
->
user
->
isGuest
)
{
$menuItems
[]
=
array
(
'label'
=>
'Signup'
,
'url'
=>
array
(
'/site/signup'
));
$menuItems
[]
=
array
(
'label'
=>
'Login'
,
'url'
=>
array
(
'/site/login'
));
}
else
{
}
else
{
$menuItems
[]
=
array
(
'label'
=>
'Logout ('
.
Yii
::
$app
->
user
->
identity
->
username
.
')'
,
'url'
=>
array
(
'/site/logout'
));
}
echo
Nav
::
widget
(
array
(
...
...
This diff is collapsed.
Click to expand it.
build/controllers/ClassmapController.php
View file @
0596fa82
...
...
@@ -33,7 +33,7 @@ class ClassmapController extends Controller
$mapFile
=
YII_PATH
.
'/classes.php'
;
}
$options
=
array
(
'filter'
=>
function
(
$path
)
{
'filter'
=>
function
(
$path
)
{
if
(
is_file
(
$path
))
{
$file
=
basename
(
$path
);
if
(
$file
[
0
]
<
'A'
||
$file
[
0
]
>
'Z'
)
{
...
...
This diff is collapsed.
Click to expand it.
extensions/twig/yii/twig/ViewRenderer.php
View file @
0596fa82
...
...
@@ -46,7 +46,7 @@ class ViewRenderer extends BaseViewRenderer
'cache'
=>
Yii
::
getAlias
(
$this
->
cachePath
),
),
$this
->
options
));
$this
->
twig
->
addFunction
(
'path'
,
new
\Twig_Function_Function
(
function
(
$path
,
$args
=
array
())
{
$this
->
twig
->
addFunction
(
'path'
,
new
\Twig_Function_Function
(
function
(
$path
,
$args
=
array
())
{
return
Html
::
url
(
array_merge
(
array
(
$path
),
$args
));
}));
...
...
This diff is collapsed.
Click to expand it.
framework/yii/captcha/Captcha.php
View file @
0596fa82
...
...
@@ -13,7 +13,6 @@ use yii\helpers\Html;
use
yii\helpers\Json
;
use
yii\widgets\InputWidget
;
/**
* Captcha renders a CAPTCHA image and an input field that takes user-entered verification code.
*
...
...
This diff is collapsed.
Click to expand it.
tests/unit/TestCase.php
View file @
0596fa82
...
...
@@ -45,7 +45,7 @@ abstract class TestCase extends \yii\test\TestCase
'basePath'
=>
__DIR__
,
);
new
$appClass
(
array_merge
(
$defaultConfig
,
$config
));
new
$appClass
(
array_merge
(
$defaultConfig
,
$config
));
}
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/ar/Customer.php
View file @
0596fa82
<?php
namespace
yiiunit\data\ar
;
use
yii\db\ActiveQuery
;
class
Customer
extends
ActiveRecord
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/ar/Order.php
View file @
0596fa82
...
...
@@ -22,7 +22,7 @@ class Order extends ActiveRecord
public
function
getItems
()
{
return
$this
->
hasMany
(
'Item'
,
array
(
'id'
=>
'item_id'
))
->
via
(
'orderItems'
,
function
(
$q
)
{
->
via
(
'orderItems'
,
function
(
$q
)
{
// additional query configuration
})
->
orderBy
(
'id'
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/base/InvalidRulesModel.php
View file @
0596fa82
<?php
namespace
yiiunit\data\base
;
use
yii\base\Model
;
/**
...
...
@@ -13,5 +14,4 @@ class InvalidRulesModel extends Model
array
(
'test'
),
);
}
}
This diff is collapsed.
Click to expand it.
tests/unit/data/base/Singer.php
View file @
0596fa82
<?php
namespace
yiiunit\data\base
;
use
yii\base\Model
;
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/base/Speaker.php
View file @
0596fa82
<?php
namespace
yiiunit\data\base
;
use
yii\base\Model
;
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/data/config.php
View file @
0596fa82
<?php
return
array
(
'databases'
=>
array
(
'mysql'
=>
array
(
...
...
@@ -23,6 +22,6 @@ return array(
'username'
=>
'postgres'
,
'password'
=>
'postgres'
,
'fixture'
=>
__DIR__
.
'/postgres.sql'
,
)
)
)
,
),
);
This diff is collapsed.
Click to expand it.
tests/unit/framework/base/BehaviorTest.php
View file @
0596fa82
...
...
@@ -8,7 +8,6 @@ use yiiunit\TestCase;
class
BarClass
extends
Component
{
}
class
FooClass
extends
Component
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/base/ComponentTest.php
View file @
0596fa82
...
...
@@ -194,7 +194,7 @@ class ComponentTest extends TestCase
$this
->
assertFalse
(
$this
->
component
->
event
->
handled
);
$eventRaised
=
false
;
$this
->
component
->
on
(
'click'
,
function
(
$event
)
use
(
&
$eventRaised
)
{
$this
->
component
->
on
(
'click'
,
function
(
$event
)
use
(
&
$eventRaised
)
{
$eventRaised
=
true
;
});
$this
->
component
->
raiseEvent
();
...
...
@@ -202,7 +202,7 @@ class ComponentTest extends TestCase
// raise event w/o parameters
$eventRaised
=
false
;
$this
->
component
->
on
(
'test'
,
function
(
$event
)
use
(
&
$eventRaised
)
{
$this
->
component
->
on
(
'test'
,
function
(
$event
)
use
(
&
$eventRaised
)
{
$eventRaised
=
true
;
});
$this
->
component
->
trigger
(
'test'
);
...
...
@@ -331,7 +331,7 @@ class NewComponent extends Component
public
function
getExecute
()
{
return
function
(
$param
)
{
return
function
(
$param
)
{
return
$param
*
2
;
};
}
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/base/ModelTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\base
;
use
yii\base\Model
;
use
yiiunit\TestCase
;
use
yiiunit\data\base\Speaker
;
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/base/ObjectTest.php
View file @
0596fa82
...
...
@@ -175,7 +175,7 @@ class NewObject extends Object
public
function
getExecute
()
{
return
function
(
$param
)
{
return
function
(
$param
)
{
return
$param
*
2
;
};
}
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/behaviors/AutoTimestampTest.php
View file @
0596fa82
...
...
@@ -26,7 +26,8 @@ class AutoTimestampTest extends TestCase
}
}
public
function
setUp
()
{
public
function
setUp
()
{
$this
->
mockApplication
(
array
(
'components'
=>
array
(
...
...
@@ -112,4 +113,4 @@ class ActiveRecordAutoTimestamp extends ActiveRecord
{
return
'test_auto_timestamp'
;
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/ApcCacheTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\ApcCache
;
/**
...
...
@@ -20,7 +21,7 @@ class ApcCacheTest extends CacheTestCase
$this
->
markTestSkipped
(
"APC cli is not enabled. Skipping."
);
}
if
(
!
ini_get
(
"apc.enabled"
)
||
!
ini_get
(
"apc.enable_cli"
))
{
if
(
!
ini_get
(
"apc.enabled"
)
||
!
ini_get
(
"apc.enable_cli"
))
{
$this
->
markTestSkipped
(
"APC is installed but not enabled. Skipping."
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/CacheTestCase.php
View file @
0596fa82
...
...
@@ -6,7 +6,8 @@ namespace yii\caching;
* Mock for the time() function for caching classes
* @return int
*/
function
time
()
{
function
time
()
{
return
\yiiunit\framework\caching\CacheTestCase
::
$time
?:
\time
();
}
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/DbCacheTest.php
View file @
0596fa82
...
...
@@ -35,11 +35,11 @@ class DbCacheTest extends CacheTestCase
* @param bool $reset whether to clean up the test database
* @return \yii\db\Connection
*/
function
getConnection
(
$reset
=
true
)
public
function
getConnection
(
$reset
=
true
)
{
if
(
$this
->
_connection
===
null
)
{
$databases
=
$this
->
getParam
(
'databases'
);
$params
=
$databases
[
'mysql'
];
$params
=
$databases
[
'mysql'
];
$db
=
new
\yii\db\Connection
;
$db
->
dsn
=
$params
[
'dsn'
];
$db
->
username
=
$params
[
'username'
];
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/FileCacheTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\FileCache
;
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/MemCacheTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\MemCache
;
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/MemCachedTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\MemCache
;
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/WinCacheTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\WinCache
;
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/XCacheTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\XCache
;
/**
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/caching/ZendDataCacheTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\Cache
;
use
yii\caching\ZendDataCache
;
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/console/controllers/AssetControllerTest.php
View file @
0596fa82
...
...
@@ -226,7 +226,7 @@ class AssetControllerTest extends TestCase
'yii'
,
),
),
);
;
);
$bundleFile
=
$this
->
testFilePath
.
DIRECTORY_SEPARATOR
.
'bundle.php'
;
$configFile
=
$this
->
testFilePath
.
DIRECTORY_SEPARATOR
.
'config.php'
;
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/data/SortTest.php
View file @
0596fa82
...
...
@@ -6,11 +6,11 @@
*/
namespace
yiiunit\framework\data
;
use
yii\web\UrlManager
;
use
yiiunit\TestCase
;
use
yii\data\Sort
;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/ActiveRecordTest.php
View file @
0596fa82
...
...
@@ -13,7 +13,7 @@ class ActiveRecordTest extends DatabaseTestCase
{
protected
function
setUp
()
{
parent
::
setUp
();
parent
::
setUp
();
ActiveRecord
::
$db
=
$this
->
getConnection
();
}
...
...
@@ -85,7 +85,7 @@ class ActiveRecordTest extends DatabaseTestCase
$this
->
assertTrue
(
$customers
[
'user3'
]
instanceof
Customer
);
// indexBy callable
$customers
=
Customer
::
find
()
->
indexBy
(
function
(
$customer
)
{
$customers
=
Customer
::
find
()
->
indexBy
(
function
(
$customer
)
{
return
$customer
->
id
.
'-'
.
$customer
->
name
;
})
->
orderBy
(
'id'
)
->
all
();
$this
->
assertEquals
(
3
,
count
(
$customers
));
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/CommandTest.php
View file @
0596fa82
...
...
@@ -15,7 +15,7 @@ class CommandTest extends DatabaseTestCase
$this
->
mockApplication
();
}
function
testConstruct
()
public
function
testConstruct
()
{
$db
=
$this
->
getConnection
(
false
);
...
...
@@ -29,7 +29,7 @@ class CommandTest extends DatabaseTestCase
$this
->
assertEquals
(
$sql
,
$command
->
sql
);
}
function
testGetSetSql
()
public
function
testGetSetSql
()
{
$db
=
$this
->
getConnection
(
false
);
...
...
@@ -42,7 +42,7 @@ class CommandTest extends DatabaseTestCase
$this
->
assertEquals
(
$sql2
,
$command
->
sql
);
}
function
testAutoQuoting
()
public
function
testAutoQuoting
()
{
$db
=
$this
->
getConnection
(
false
);
...
...
@@ -51,7 +51,7 @@ class CommandTest extends DatabaseTestCase
$this
->
assertEquals
(
"SELECT `id`, `t`.`name` FROM `tbl_customer` t"
,
$command
->
sql
);
}
function
testPrepareCancel
()
public
function
testPrepareCancel
()
{
$db
=
$this
->
getConnection
(
false
);
...
...
@@ -63,7 +63,7 @@ class CommandTest extends DatabaseTestCase
$this
->
assertEquals
(
null
,
$command
->
pdoStatement
);
}
function
testExecute
()
public
function
testExecute
()
{
$db
=
$this
->
getConnection
();
...
...
@@ -80,7 +80,7 @@ class CommandTest extends DatabaseTestCase
$command
->
execute
();
}
function
testQuery
()
public
function
testQuery
()
{
$db
=
$this
->
getConnection
();
...
...
@@ -141,7 +141,7 @@ class CommandTest extends DatabaseTestCase
$command
->
query
();
}
function
testBindParamValue
()
public
function
testBindParamValue
()
{
$db
=
$this
->
getConnection
();
...
...
@@ -197,7 +197,7 @@ class CommandTest extends DatabaseTestCase
$this
->
assertEquals
(
'user5@example.com'
,
$command
->
queryScalar
());
}
function
testFetchMode
()
public
function
testFetchMode
()
{
$db
=
$this
->
getConnection
();
...
...
@@ -221,78 +221,63 @@ class CommandTest extends DatabaseTestCase
$this
->
assertTrue
(
is_array
(
$result
)
&&
isset
(
$result
[
0
]));
}
function
testInsert
()
public
function
testInsert
()
{
}
function
testUpdate
()
public
function
testUpdate
()
{
}
function
testDelete
()
public
function
testDelete
()
{
}
function
testCreateTable
()
public
function
testCreateTable
()
{
}
function
testRenameTable
()
public
function
testRenameTable
()
{
}
function
testDropTable
()
public
function
testDropTable
()
{
}
function
testTruncateTable
()
public
function
testTruncateTable
()
{
}
function
testAddColumn
()
public
function
testAddColumn
()
{
}
function
testDropColumn
()
public
function
testDropColumn
()
{
}
function
testRenameColumn
()
public
function
testRenameColumn
()
{
}
function
testAlterColumn
()
public
function
testAlterColumn
()
{
}
function
testAddForeignKey
()
public
function
testAddForeignKey
()
{
}
function
testDropForeignKey
()
public
function
testDropForeignKey
()
{
}
function
testCreateIndex
()
public
function
testCreateIndex
()
{
}
function
testDropIndex
()
public
function
testDropIndex
()
{
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/ConnectionTest.php
View file @
0596fa82
...
...
@@ -12,7 +12,7 @@ class ConnectionTest extends DatabaseTestCase
$this
->
mockApplication
();
}
function
testConstruct
()
public
function
testConstruct
()
{
$connection
=
$this
->
getConnection
(
false
);
$params
=
$this
->
database
;
...
...
@@ -22,7 +22,7 @@ class ConnectionTest extends DatabaseTestCase
$this
->
assertEquals
(
$params
[
'password'
],
$connection
->
password
);
}
function
testOpenClose
()
public
function
testOpenClose
()
{
$connection
=
$this
->
getConnection
(
false
,
false
);
...
...
@@ -43,13 +43,13 @@ class ConnectionTest extends DatabaseTestCase
$connection
->
open
();
}
function
testGetDriverName
()
public
function
testGetDriverName
()
{
$connection
=
$this
->
getConnection
(
false
,
false
);
$this
->
assertEquals
(
$this
->
driverName
,
$connection
->
driverName
);
}
function
testQuoteValue
()
public
function
testQuoteValue
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
123
,
$connection
->
quoteValue
(
123
));
...
...
@@ -57,7 +57,7 @@ class ConnectionTest extends DatabaseTestCase
$this
->
assertEquals
(
"'It
\\
's interesting'"
,
$connection
->
quoteValue
(
"It's interesting"
));
}
function
testQuoteTableName
()
public
function
testQuoteTableName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'`table`'
,
$connection
->
quoteTableName
(
'table'
));
...
...
@@ -68,7 +68,7 @@ class ConnectionTest extends DatabaseTestCase
$this
->
assertEquals
(
'(table)'
,
$connection
->
quoteTableName
(
'(table)'
));
}
function
testQuoteColumnName
()
public
function
testQuoteColumnName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'`column`'
,
$connection
->
quoteColumnName
(
'column'
));
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/QueryBuilderTest.php
View file @
0596fa82
...
...
@@ -127,7 +127,6 @@ class QueryBuilderTest extends DatabaseTestCase
$qb
->
db
->
createCommand
()
->
dropPrimaryKey
(
$pkeyName
,
$tableName
)
->
execute
();
$qb
=
$this
->
getQueryBuilder
();
// resets the schema
$tableSchema
=
$qb
->
db
->
getSchema
()
->
getTableSchema
(
$tableName
);
$this
->
assertEquals
(
0
,
count
(
$tableSchema
->
primaryKey
));
$this
->
assertEquals
(
0
,
count
(
$tableSchema
->
primaryKey
));
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/QueryTest.php
View file @
0596fa82
...
...
@@ -15,7 +15,7 @@ class QueryTest extends DatabaseTestCase
$this
->
mockApplication
();
}
function
testSelect
()
public
function
testSelect
()
{
// default
$query
=
new
Query
;
...
...
@@ -31,14 +31,14 @@ class QueryTest extends DatabaseTestCase
$this
->
assertEquals
(
'something'
,
$query
->
selectOption
);
}
function
testFrom
()
public
function
testFrom
()
{
$query
=
new
Query
;
$query
->
from
(
'tbl_user'
);
$this
->
assertEquals
(
array
(
'tbl_user'
),
$query
->
from
);
}
function
testWhere
()
public
function
testWhere
()
{
$query
=
new
Query
;
$query
->
where
(
'id = :id'
,
array
(
':id'
=>
1
));
...
...
@@ -54,12 +54,11 @@ class QueryTest extends DatabaseTestCase
$this
->
assertEquals
(
array
(
':id'
=>
1
,
':name'
=>
'something'
,
':age'
=>
'30'
),
$query
->
params
);
}
function
testJoin
()
public
function
testJoin
()
{
}
function
testGroup
()
public
function
testGroup
()
{
$query
=
new
Query
;
$query
->
groupBy
(
'team'
);
...
...
@@ -72,7 +71,7 @@ class QueryTest extends DatabaseTestCase
$this
->
assertEquals
(
array
(
'team'
,
'company'
,
'age'
),
$query
->
groupBy
);
}
function
testHaving
()
public
function
testHaving
()
{
$query
=
new
Query
;
$query
->
having
(
'id = :id'
,
array
(
':id'
=>
1
));
...
...
@@ -88,7 +87,7 @@ class QueryTest extends DatabaseTestCase
$this
->
assertEquals
(
array
(
':id'
=>
1
,
':name'
=>
'something'
,
':age'
=>
'30'
),
$query
->
params
);
}
function
testOrder
()
public
function
testOrder
()
{
$query
=
new
Query
;
$query
->
orderBy
(
'team'
);
...
...
@@ -107,7 +106,7 @@ class QueryTest extends DatabaseTestCase
$this
->
assertEquals
(
array
(
'team'
=>
false
,
'company'
=>
true
,
'age'
=>
false
),
$query
->
orderBy
);
}
function
testLimitOffset
()
public
function
testLimitOffset
()
{
$query
=
new
Query
;
$query
->
limit
(
10
)
->
offset
(
5
);
...
...
@@ -115,8 +114,7 @@ class QueryTest extends DatabaseTestCase
$this
->
assertEquals
(
5
,
$query
->
offset
);
}
function
testUnion
()
public
function
testUnion
()
{
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/mssql/MssqlActiveRecordTest.php
View file @
0596fa82
...
...
@@ -6,9 +6,9 @@ use yiiunit\framework\db\ActiveRecordTest;
class
MssqlActiveRecordTest
extends
ActiveRecordTest
{
protected
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
protected
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/mssql/MssqlCommandTest.php
View file @
0596fa82
...
...
@@ -6,13 +6,13 @@ use yiiunit\framework\db\CommandTest;
class
MssqlCommandTest
extends
CommandTest
{
public
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
public
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
function
testAutoQuoting
()
public
function
testAutoQuoting
()
{
$db
=
$this
->
getConnection
(
false
);
...
...
@@ -21,12 +21,12 @@ class MssqlCommandTest extends CommandTest
$this
->
assertEquals
(
"SELECT [id], [t].[name] FROM [tbl_customer] t"
,
$command
->
sql
);
}
function
testPrepareCancel
()
public
function
testPrepareCancel
()
{
$this
->
markTestSkipped
(
'MSSQL driver does not support this feature.'
);
}
function
testBindParamValue
()
public
function
testBindParamValue
()
{
$db
=
$this
->
getConnection
();
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/mssql/MssqlConnectionTest.php
View file @
0596fa82
...
...
@@ -6,13 +6,13 @@ use yiiunit\framework\db\ConnectionTest;
class
MssqlConnectionTest
extends
ConnectionTest
{
public
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
public
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
function
testQuoteValue
()
public
function
testQuoteValue
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
123
,
$connection
->
quoteValue
(
123
));
...
...
@@ -20,7 +20,7 @@ class MssqlConnectionTest extends ConnectionTest
$this
->
assertEquals
(
"'It''s interesting'"
,
$connection
->
quoteValue
(
"It's interesting"
));
}
function
testQuoteTableName
()
public
function
testQuoteTableName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'[table]'
,
$connection
->
quoteTableName
(
'table'
));
...
...
@@ -31,7 +31,7 @@ class MssqlConnectionTest extends ConnectionTest
$this
->
assertEquals
(
'(table)'
,
$connection
->
quoteTableName
(
'(table)'
));
}
function
testQuoteColumnName
()
public
function
testQuoteColumnName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'[column]'
,
$connection
->
quoteColumnName
(
'column'
));
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/mssql/MssqlQueryTest.php
View file @
0596fa82
...
...
@@ -6,9 +6,9 @@ use yiiunit\framework\db\QueryTest;
class
MssqlQueryTest
extends
QueryTest
{
public
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
public
function
setUp
()
{
$this
->
driverName
=
'sqlsrv'
;
parent
::
setUp
();
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php
View file @
0596fa82
...
...
@@ -6,9 +6,9 @@ use yiiunit\framework\db\ActiveRecordTest;
class
PostgreSQLActiveRecordTest
extends
ActiveRecordTest
{
protected
function
setUp
()
{
$this
->
driverName
=
'pgsql'
;
parent
::
setUp
();
}
protected
function
setUp
()
{
$this
->
driverName
=
'pgsql'
;
parent
::
setUp
();
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\db\pgsql
;
use
yiiunit\framework\db\ConnectionTest
;
class
PostgreSQLConnectionTest
extends
ConnectionTest
{
public
function
setUp
()
{
class
PostgreSQLConnectionTest
extends
ConnectionTest
{
public
function
setUp
()
{
$this
->
driverName
=
'pgsql'
;
parent
::
setUp
();
}
public
function
testConnection
()
{
public
function
testConnection
()
{
$connection
=
$this
->
getConnection
(
true
);
}
function
testQuoteValue
()
{
public
function
testQuoteValue
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
123
,
$connection
->
quoteValue
(
123
));
$this
->
assertEquals
(
"'string'"
,
$connection
->
quoteValue
(
'string'
));
$this
->
assertEquals
(
"'It''s interesting'"
,
$connection
->
quoteValue
(
"It's interesting"
));
}
function
testQuoteTableName
()
public
function
testQuoteTableName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'"table"'
,
$connection
->
quoteTableName
(
'table'
));
...
...
@@ -33,8 +35,8 @@ class PostgreSQLConnectionTest extends ConnectionTest {
$this
->
assertEquals
(
'{{table}}'
,
$connection
->
quoteTableName
(
'{{table}}'
));
$this
->
assertEquals
(
'(table)'
,
$connection
->
quoteTableName
(
'(table)'
));
}
function
testQuoteColumnName
()
public
function
testQuoteColumnName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'"column"'
,
$connection
->
quoteColumnName
(
'column'
));
...
...
@@ -46,6 +48,4 @@ class PostgreSQLConnectionTest extends ConnectionTest {
$this
->
assertEquals
(
'{{column}}'
,
$connection
->
quoteColumnName
(
'{{column}}'
));
$this
->
assertEquals
(
'(column)'
,
$connection
->
quoteColumnName
(
'(column)'
));
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
View file @
0596fa82
...
...
@@ -72,5 +72,4 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
array
(
Schema
::
TYPE_MONEY
.
' NOT NULL'
,
'numeric(19,4) NOT NULL'
),
);
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
View file @
0596fa82
...
...
@@ -5,9 +5,9 @@ use yiiunit\framework\db\ActiveRecordTest;
class
SqliteActiveRecordTest
extends
ActiveRecordTest
{
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/sqlite/SqliteCommandTest.php
View file @
0596fa82
...
...
@@ -5,18 +5,18 @@ use yiiunit\framework\db\CommandTest;
class
SqliteCommandTest
extends
CommandTest
{
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
public
function
testAutoQuoting
()
{
$db
=
$this
->
getConnection
(
false
);
public
function
testAutoQuoting
()
{
$db
=
$this
->
getConnection
(
false
);
$sql
=
'SELECT [[id]], [[t.name]] FROM {{tbl_customer}} t'
;
$command
=
$db
->
createCommand
(
$sql
);
$this
->
assertEquals
(
"SELECT
\"
id
\"
, 't'.
\"
name
\"
FROM 'tbl_customer' t"
,
$command
->
sql
);
}
$sql
=
'SELECT [[id]], [[t.name]] FROM {{tbl_customer}} t'
;
$command
=
$db
->
createCommand
(
$sql
);
$this
->
assertEquals
(
"SELECT
\"
id
\"
, 't'.
\"
name
\"
FROM 'tbl_customer' t"
,
$command
->
sql
);
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/sqlite/SqliteConnectionTest.php
View file @
0596fa82
...
...
@@ -5,44 +5,44 @@ use yiiunit\framework\db\ConnectionTest;
class
SqliteConnectionTest
extends
ConnectionTest
{
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
public
function
testConstruct
()
{
$connection
=
$this
->
getConnection
(
false
);
$params
=
$this
->
database
;
public
function
testConstruct
()
{
$connection
=
$this
->
getConnection
(
false
);
$params
=
$this
->
database
;
$this
->
assertEquals
(
$params
[
'dsn'
],
$connection
->
dsn
);
}
$this
->
assertEquals
(
$params
[
'dsn'
],
$connection
->
dsn
);
}
public
function
testQuoteValue
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
123
,
$connection
->
quoteValue
(
123
));
$this
->
assertEquals
(
"'string'"
,
$connection
->
quoteValue
(
'string'
));
$this
->
assertEquals
(
"'It''s interesting'"
,
$connection
->
quoteValue
(
"It's interesting"
));
}
public
function
testQuoteValue
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
123
,
$connection
->
quoteValue
(
123
));
$this
->
assertEquals
(
"'string'"
,
$connection
->
quoteValue
(
'string'
));
$this
->
assertEquals
(
"'It''s interesting'"
,
$connection
->
quoteValue
(
"It's interesting"
));
}
public
function
testQuoteTableName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
"'table'"
,
$connection
->
quoteTableName
(
'table'
));
$this
->
assertEquals
(
"'schema'.'table'"
,
$connection
->
quoteTableName
(
'schema.table'
));
$this
->
assertEquals
(
'{{table}}'
,
$connection
->
quoteTableName
(
'{{table}}'
));
$this
->
assertEquals
(
'(table)'
,
$connection
->
quoteTableName
(
'(table)'
));
}
public
function
testQuoteTableName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
"'table'"
,
$connection
->
quoteTableName
(
'table'
));
$this
->
assertEquals
(
"'schema'.'table'"
,
$connection
->
quoteTableName
(
'schema.table'
));
$this
->
assertEquals
(
'{{table}}'
,
$connection
->
quoteTableName
(
'{{table}}'
));
$this
->
assertEquals
(
'(table)'
,
$connection
->
quoteTableName
(
'(table)'
));
}
public
function
testQuoteColumnName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'"column"'
,
$connection
->
quoteColumnName
(
'column'
));
$this
->
assertEquals
(
"'table'.
\"
column
\"
"
,
$connection
->
quoteColumnName
(
'table.column'
));
$this
->
assertEquals
(
'[[column]]'
,
$connection
->
quoteColumnName
(
'[[column]]'
));
$this
->
assertEquals
(
'{{column}}'
,
$connection
->
quoteColumnName
(
'{{column}}'
));
$this
->
assertEquals
(
'(column)'
,
$connection
->
quoteColumnName
(
'(column)'
));
}
public
function
testQuoteColumnName
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
'"column"'
,
$connection
->
quoteColumnName
(
'column'
));
$this
->
assertEquals
(
"'table'.
\"
column
\"
"
,
$connection
->
quoteColumnName
(
'table.column'
));
$this
->
assertEquals
(
'[[column]]'
,
$connection
->
quoteColumnName
(
'[[column]]'
));
$this
->
assertEquals
(
'{{column}}'
,
$connection
->
quoteColumnName
(
'{{column}}'
));
$this
->
assertEquals
(
'(column)'
,
$connection
->
quoteColumnName
(
'(column)'
));
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
View file @
0596fa82
...
...
@@ -78,5 +78,4 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
$this
->
setExpectedException
(
'yii\base\NotSupportedException'
);
parent
::
testAddDropPrimayKey
();
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/sqlite/SqliteQueryTest.php
View file @
0596fa82
...
...
@@ -5,9 +5,9 @@ use yiiunit\framework\db\QueryTest;
class
SqliteQueryTest
extends
QueryTest
{
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
protected
function
setUp
()
{
$this
->
driverName
=
'sqlite'
;
parent
::
setUp
();
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/helpers/ConsoleTest.php
View file @
0596fa82
...
...
@@ -75,5 +75,4 @@ class ConsoleTest extends TestCase
sleep(1);
}
}*/
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/helpers/FileHelperTest.php
View file @
0596fa82
...
...
@@ -100,7 +100,7 @@ class FileHelperTest extends TestCase
* @param string $fileName file name.
* @param string $message error message
*/
protected
function
assertFileMode
(
$expectedMode
,
$fileName
,
$message
=
''
)
protected
function
assertFileMode
(
$expectedMode
,
$fileName
,
$message
=
''
)
{
$expectedMode
=
sprintf
(
'%o'
,
$expectedMode
);
$this
->
assertEquals
(
$expectedMode
,
$this
->
getMode
(
$fileName
),
$message
);
...
...
@@ -236,7 +236,7 @@ class FileHelperTest extends TestCase
$dirName
=
$basePath
.
DIRECTORY_SEPARATOR
.
$dirName
;
$options
=
array
(
'filter'
=>
function
(
$path
)
use
(
$passedFileName
)
{
'filter'
=>
function
(
$path
)
use
(
$passedFileName
)
{
return
$passedFileName
==
basename
(
$path
);
}
);
...
...
@@ -268,7 +268,8 @@ class FileHelperTest extends TestCase
$this
->
assertEquals
(
array
(
$dirName
.
DIRECTORY_SEPARATOR
.
$fileName
),
$foundFiles
);
}
public
function
testMkdir
()
{
public
function
testMkdir
()
{
$basePath
=
$this
->
testFilePath
;
$dirName
=
$basePath
.
DIRECTORY_SEPARATOR
.
'test_dir_level_1'
.
DIRECTORY_SEPARATOR
.
'test_dir_level_2'
;
FileHelper
::
mkdir
(
$dirName
);
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/helpers/HtmlTest.php
View file @
0596fa82
...
...
@@ -370,7 +370,7 @@ EOD;
<div class="radio"><label><input type="radio" name="test" value="value1<>"> text1<></label></div>
<div class="radio"><label><input type="radio" name="test" value="value 2"> text 2</label></div>
EOD;
$this
->
assertEqualsWithoutLE
(
$expected
,
Html
::
radioList
(
'test'
,
array
(
'value2'
),
$this
->
getDataItems2
()));
$this
->
assertEqualsWithoutLE
(
$expected
,
Html
::
radioList
(
'test'
,
array
(
'value2'
),
$this
->
getDataItems2
()));
$expected
=
<<<EOD
<input type="hidden" name="test" value="0"><div class="radio"><label><input type="radio" name="test" value="value1"> text1</label></div><br>
...
...
@@ -414,7 +414,7 @@ EOD;
EOD;
$this
->
assertEqualsWithoutLE
(
$expected
,
Html
::
ul
(
$data
,
array
(
'class'
=>
'test'
,
'item'
=>
function
(
$item
,
$index
)
{
'item'
=>
function
(
$item
,
$index
)
{
return
"<li class=
\"
item-
$index
\"
>
$item
</li>"
;
}
)));
...
...
@@ -444,7 +444,7 @@ EOD;
EOD;
$this
->
assertEqualsWithoutLE
(
$expected
,
Html
::
ol
(
$data
,
array
(
'class'
=>
'test'
,
'item'
=>
function
(
$item
,
$index
)
{
'item'
=>
function
(
$item
,
$index
)
{
return
"<li class=
\"
item-
$index
\"
>
$item
</li>"
;
}
)));
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/helpers/InflectorTest.php
View file @
0596fa82
...
...
@@ -8,35 +8,35 @@ use yiiunit\TestCase;
class
InflectorTest
extends
TestCase
{
public
function
testPluralize
()
{
$testData
=
array
(
'move'
=>
'moves'
,
'foot'
=>
'feet'
,
'child'
=>
'children'
,
'human'
=>
'humans'
,
'man'
=>
'men'
,
'staff'
=>
'staff'
,
'tooth'
=>
'teeth'
,
'person'
=>
'people'
,
'mouse'
=>
'mice'
,
'touch'
=>
'touches'
,
'hash'
=>
'hashes'
,
'shelf'
=>
'shelves'
,
'potato'
=>
'potatoes'
,
'bus'
=>
'buses'
,
'test'
=>
'tests'
,
'car'
=>
'cars'
,
);
foreach
(
$testData
as
$testIn
=>
$testOut
)
{
$this
->
assertEquals
(
$testOut
,
Inflector
::
pluralize
(
$testIn
));
$this
->
assertEquals
(
ucfirst
(
$testOut
),
ucfirst
(
Inflector
::
pluralize
(
$testIn
)));
}
}
public
function
testSingularize
()
{
public
function
testPluralize
()
{
$testData
=
array
(
'move'
=>
'moves'
,
'foot'
=>
'feet'
,
'child'
=>
'children'
,
'human'
=>
'humans'
,
'man'
=>
'men'
,
'staff'
=>
'staff'
,
'tooth'
=>
'teeth'
,
'person'
=>
'people'
,
'mouse'
=>
'mice'
,
'touch'
=>
'touches'
,
'hash'
=>
'hashes'
,
'shelf'
=>
'shelves'
,
'potato'
=>
'potatoes'
,
'bus'
=>
'buses'
,
'test'
=>
'tests'
,
'car'
=>
'cars'
,
);
foreach
(
$testData
as
$testIn
=>
$testOut
)
{
$this
->
assertEquals
(
$testOut
,
Inflector
::
pluralize
(
$testIn
));
$this
->
assertEquals
(
ucfirst
(
$testOut
),
ucfirst
(
Inflector
::
pluralize
(
$testIn
)));
}
}
public
function
testSingularize
()
{
$testData
=
array
(
'moves'
=>
'move'
,
'feet'
=>
'foot'
,
...
...
@@ -59,77 +59,77 @@ class InflectorTest extends TestCase
$this
->
assertEquals
(
$testOut
,
Inflector
::
singularize
(
$testIn
));
$this
->
assertEquals
(
ucfirst
(
$testOut
),
ucfirst
(
Inflector
::
singularize
(
$testIn
)));
}
}
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
(
'MeMySelfAndI'
));
}
public
function
testCamel2words
()
{
$this
->
assertEquals
(
'Camel Case'
,
Inflector
::
camel2words
(
'camelCase'
));
$this
->
assertEquals
(
'Lower Case'
,
Inflector
::
camel2words
(
'lower_case'
));
$this
->
assertEquals
(
'Tricky Stuff It Is Testing'
,
Inflector
::
camel2words
(
' tricky_stuff.it-is testing... '
));
}
public
function
testCamel2id
()
{
$this
->
assertEquals
(
'post-tag'
,
Inflector
::
camel2id
(
'PostTag'
));
$this
->
assertEquals
(
'post_tag'
,
Inflector
::
camel2id
(
'PostTag'
,
'_'
));
$this
->
assertEquals
(
'post-tag'
,
Inflector
::
camel2id
(
'postTag'
));
$this
->
assertEquals
(
'post_tag'
,
Inflector
::
camel2id
(
'postTag'
,
'_'
));
}
public
function
testId2camel
()
{
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post-tag'
));
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post_tag'
,
'_'
));
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post-tag'
));
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post_tag'
,
'_'
));
}
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
));
}
public
function
testVariablize
()
{
$this
->
assertEquals
(
"customerTable"
,
Inflector
::
variablize
(
'customer_table'
));
}
public
function
testTableize
()
{
$this
->
assertEquals
(
"customer_tables"
,
Inflector
::
tableize
(
'customerTable'
));
}
public
function
testSlug
()
{
$this
->
assertEquals
(
"this-is-a-title"
,
Inflector
::
slug
(
'this is a title'
));
}
public
function
testClassify
()
{
$this
->
assertEquals
(
"CustomerTable"
,
Inflector
::
classify
(
'customer_tables'
));
}
public
function
testOrdinalize
()
{
$this
->
assertEquals
(
'21st'
,
Inflector
::
ordinalize
(
'21'
));
}
}
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
(
'MeMySelfAndI'
));
}
public
function
testCamel2words
()
{
$this
->
assertEquals
(
'Camel Case'
,
Inflector
::
camel2words
(
'camelCase'
));
$this
->
assertEquals
(
'Lower Case'
,
Inflector
::
camel2words
(
'lower_case'
));
$this
->
assertEquals
(
'Tricky Stuff It Is Testing'
,
Inflector
::
camel2words
(
' tricky_stuff.it-is testing... '
));
}
public
function
testCamel2id
()
{
$this
->
assertEquals
(
'post-tag'
,
Inflector
::
camel2id
(
'PostTag'
));
$this
->
assertEquals
(
'post_tag'
,
Inflector
::
camel2id
(
'PostTag'
,
'_'
));
$this
->
assertEquals
(
'post-tag'
,
Inflector
::
camel2id
(
'postTag'
));
$this
->
assertEquals
(
'post_tag'
,
Inflector
::
camel2id
(
'postTag'
,
'_'
));
}
public
function
testId2camel
()
{
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post-tag'
));
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post_tag'
,
'_'
));
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post-tag'
));
$this
->
assertEquals
(
'PostTag'
,
Inflector
::
id2camel
(
'post_tag'
,
'_'
));
}
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
));
}
public
function
testVariablize
()
{
$this
->
assertEquals
(
"customerTable"
,
Inflector
::
variablize
(
'customer_table'
));
}
public
function
testTableize
()
{
$this
->
assertEquals
(
"customer_tables"
,
Inflector
::
tableize
(
'customerTable'
));
}
public
function
testSlug
()
{
$this
->
assertEquals
(
"this-is-a-title"
,
Inflector
::
slug
(
'this is a title'
));
}
public
function
testClassify
()
{
$this
->
assertEquals
(
"CustomerTable"
,
Inflector
::
classify
(
'customer_tables'
));
}
public
function
testOrdinalize
()
{
$this
->
assertEquals
(
'21st'
,
Inflector
::
ordinalize
(
'21'
));
}
}
This diff is collapsed.
Click to expand it.
tests/unit/framework/helpers/JsonTest.php
View file @
0596fa82
...
...
@@ -23,7 +23,8 @@ class JsonTest extends TestCase
// simple object encoding
$data
=
new
\stdClass
();
$data
->
a
=
1
;
$data
->
b
=
2
;
$data
->
a
=
1
;
$data
->
b
=
2
;
$this
->
assertSame
(
'{"a":1,"b":2}'
,
Json
::
encode
(
$data
));
// expression encoding
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/helpers/StringHelperTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\helpers
;
use
\yii\helpers\StringHelper
as
StringHelper
;
use
yii\test\TestCase
;
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/helpers/VarDumperTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\helpers
;
use
\yii\helpers\VarDumper
;
use
yii\test\TestCase
;
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/requirements/YiiRequirementCheckerTest.php
View file @
0596fa82
...
...
@@ -60,7 +60,8 @@ class YiiRequirementCheckerTest extends TestCase
/**
* @depends testCheck
*/
public
function
testCheckEval
()
{
public
function
testCheckEval
()
{
$requirementsChecker
=
new
YiiRequirementChecker
();
$requirements
=
array
(
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/validators/EmailValidatorTest.php
View file @
0596fa82
<?php
namespace
yiiunit\framework\validators
;
use
yii\validators\EmailValidator
;
use
yiiunit\TestCase
;
...
...
This diff is collapsed.
Click to expand it.
tests/unit/framework/widgets/SpacelessTest.php
View file @
0596fa82
...
...
@@ -33,6 +33,6 @@ class SpacelessTest extends \yiiunit\TestCase
$expected
=
"<body>
\n
<div class='wrapper'><div class='left-column'><p>This is a left bar!</p>"
.
"</div><div class='right-column'><p>This is a right bar!</p></div></div>
\t
<p>Bye!</p>
\n
</body>
\n
"
;
$this
->
assertEquals
(
$expected
,
ob_get_clean
());
$this
->
assertEquals
(
$expected
,
ob_get_clean
());
}
}
This diff is collapsed.
Click to expand it.
tests/web/app/protected/controllers/SiteController.php
View file @
0596fa82
...
...
@@ -16,7 +16,7 @@ class DefaultController extends \yii\web\Controller
'value 1'
=>
'item 1'
,
'value 2'
=>
'item 2'
,
'value 3'
=>
'item 3'
,
),
isset
(
$_POST
[
'test'
])
?
$_POST
[
'test'
]
:
null
,
),
isset
(
$_POST
[
'test'
])
?
$_POST
[
'test'
]
:
null
,
function
(
$index
,
$label
,
$name
,
$value
,
$checked
)
{
return
Html
::
label
(
$label
.
' '
.
Html
::
checkbox
(
$name
,
$value
,
$checked
),
...
...
This diff is collapsed.
Click to expand it.
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