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
b07ac281
Commit
b07ac281
authored
Aug 12, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2
parents
922f185b
5490e2a7
Show whitespace changes
Inline
Side-by-side
Showing
81 changed files
with
309 additions
and
390 deletions
+309
-390
AppAsset.php
apps/advanced/backend/config/AppAsset.php
+1
-0
params.php
apps/advanced/backend/config/params.php
+0
-1
main.php
apps/advanced/backend/views/layouts/main.php
+31
-30
index.php
apps/advanced/backend/views/site/index.php
+32
-26
login.php
apps/advanced/backend/views/site/login.php
+11
-4
site.css
apps/advanced/backend/web/css/site.css
+7
-66
params.php
apps/advanced/console/config/params.php
+0
-1
params-local.php
...advanced/environments/dev/backend/config/params-local.php
+0
-0
params-local.php
.../advanced/environments/dev/common/config/params-local.php
+0
-0
params-local.php
...advanced/environments/dev/console/config/params-local.php
+0
-0
params-local.php
...dvanced/environments/dev/frontend/config/params-local.php
+0
-0
params-local.php
...dvanced/environments/prod/backend/config/params-local.php
+0
-0
params-local.php
...advanced/environments/prod/common/config/params-local.php
+0
-0
params-local.php
...dvanced/environments/prod/console/config/params-local.php
+0
-0
params-local.php
...vanced/environments/prod/frontend/config/params-local.php
+0
-0
AppAsset.php
apps/advanced/frontend/config/AppAsset.php
+1
-0
params.php
apps/advanced/frontend/config/params.php
+0
-1
main.php
apps/advanced/frontend/views/layouts/main.php
+21
-28
about.php
apps/advanced/frontend/views/site/about.php
+6
-6
contact.php
apps/advanced/frontend/views/site/contact.php
+14
-9
index.php
apps/advanced/frontend/views/site/index.php
+32
-26
login.php
apps/advanced/frontend/views/site/login.php
+14
-7
requestPasswordResetToken.php
...dvanced/frontend/views/site/requestPasswordResetToken.php
+11
-5
resetPassword.php
apps/advanced/frontend/views/site/resetPassword.php
+11
-4
signup.php
apps/advanced/frontend/views/site/signup.php
+10
-4
site.css
apps/advanced/frontend/web/css/site.css
+7
-66
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
ArrayDataProvider.php
framework/yii/data/ArrayDataProvider.php
+0
-1
TestCase.php
tests/unit/TestCase.php
+2
-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
+2
-1
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
+1
-1
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
+1
-1
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
+0
-1
QueryTest.php
tests/unit/framework/db/QueryTest.php
+9
-11
MssqlActiveRecordTest.php
tests/unit/framework/db/mssql/MssqlActiveRecordTest.php
+0
-0
MssqlCommandTest.php
tests/unit/framework/db/mssql/MssqlCommandTest.php
+3
-3
MssqlConnectionTest.php
tests/unit/framework/db/mssql/MssqlConnectionTest.php
+3
-3
MssqlQueryTest.php
tests/unit/framework/db/mssql/MssqlQueryTest.php
+0
-0
PostgreSQLActiveRecordTest.php
tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php
+0
-0
PostgreSQLConnectionTest.php
tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
+10
-10
PostgreSQLQueryBuilderTest.php
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
+0
-1
SqliteActiveRecordTest.php
tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
+0
-0
SqliteCommandTest.php
tests/unit/framework/db/sqlite/SqliteCommandTest.php
+0
-0
SqliteConnectionTest.php
tests/unit/framework/db/sqlite/SqliteConnectionTest.php
+0
-0
SqliteQueryBuilderTest.php
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
+0
-1
SqliteQueryTest.php
tests/unit/framework/db/sqlite/SqliteQueryTest.php
+0
-0
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
+2
-2
InflectorTest.php
tests/unit/framework/helpers/InflectorTest.php
+0
-0
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
+0
-0
No files found.
apps/advanced/backend/config/AppAsset.php
View file @
b07ac281
...
...
@@ -6,6 +6,7 @@
*/
namespace
backend\config
;
use
yii\web\AssetBundle
;
/**
...
...
apps/advanced/backend/config/params.php
View file @
b07ac281
<?php
return
array
(
'adminEmail'
=>
'admin@example.com'
,
);
apps/advanced/backend/views/layouts/main.php
View file @
b07ac281
<?php
use
backend\config\AppAsset
;
use
yii\helpers\Html
;
use
yii\widgets\Menu
;
use
yii\bootstrap\Nav
;
use
yii\bootstrap\NavBar
;
use
yii\widgets\Breadcrumbs
;
/**
...
...
@@ -19,45 +20,45 @@ AppAsset::register($this);
<?php
$this
->
head
();
?>
</head>
<body>
<div
class=
"container"
>
<?php
$this
->
beginBody
();
?>
<div
class=
"masthead"
>
<h3
class=
"muted"
>
My Company
</h3>
<div
class=
"navbar fullwidth"
>
<div
class=
"navbar-inner"
>
<div
class=
"container"
>
<?php
echo
Menu
::
widget
(
array
(
'options'
=>
array
(
'class'
=>
'nav'
),
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
array
(
'/site/index'
)),
Yii
::
$app
->
user
->
isGuest
?
array
(
'label'
=>
'Login'
,
'url'
=>
array
(
'/site/login'
))
:
array
(
'label'
=>
'Logout ('
.
Yii
::
$app
->
user
->
identity
->
username
.
')'
,
'url'
=>
array
(
'/site/logout'
)),
<?php
NavBar
::
begin
(
array
(
'brandLabel'
=>
'My Company'
,
'brandUrl'
=>
Yii
::
$app
->
homeUrl
,
'options'
=>
array
(
'class'
=>
'navbar-inverse navbar-fixed-top'
,
),
));
?>
</div>
</div>
</div>
<!-- /.navbar -->
</div>
));
$menuItems
=
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
array
(
'/site/index'
)),
);
if
(
Yii
::
$app
->
user
->
isGuest
)
{
$menuItems
[]
=
array
(
'label'
=>
'Login'
,
'url'
=>
array
(
'/site/login'
));
}
else
{
$menuItems
[]
=
array
(
'label'
=>
'Logout ('
.
Yii
::
$app
->
user
->
identity
->
username
.
')'
,
'url'
=>
array
(
'/site/logout'
));
}
echo
Nav
::
widget
(
array
(
'options'
=>
array
(
'class'
=>
'navbar-nav pull-right'
),
'items'
=>
$menuItems
,
));
NavBar
::
end
();
?>
<div
class=
"container"
>
<?php
echo
Breadcrumbs
::
widget
(
array
(
'links'
=>
isset
(
$this
->
params
[
'breadcrumbs'
])
?
$this
->
params
[
'breadcrumbs'
]
:
array
(),
));
?>
<?php
echo
$content
;
?>
</div>
<hr>
<div
class=
"footer"
>
<p>
©
My Company
<?php
echo
date
(
'Y'
);
?>
</p>
<p>
<?php
echo
Yii
::
powered
();
?>
Template by
<a
href=
"http://twitter.github.io/bootstrap/"
>
Twitter Bootstrap
</a>
</p>
<footer
class=
"footer"
>
<div
class=
"container"
>
<p
class=
"pull-left"
>
©
My Company
<?php
echo
date
(
'Y'
);
?>
</p>
<p
class=
"pull-right"
>
<?php
echo
Yii
::
powered
();
?>
</p>
</div>
</footer>
<?php
$this
->
endBody
();
?>
</div>
</body>
</html>
<?php
$this
->
endPage
();
?>
apps/advanced/backend/views/site/index.php
View file @
b07ac281
...
...
@@ -2,46 +2,52 @@
/**
* @var yii\base\View $this
*/
$this
->
title
=
'
Welcome
'
;
$this
->
title
=
'
My Yii Application
'
;
?>
<div
class=
"jumbotron"
>
<h1>
Welcome!
</h1>
<div
class=
"site-index"
>
<p
class=
"lead"
>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus
commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
</p>
<a
class=
"btn btn-large btn-success"
href=
"http://www.yiiframework.com"
>
Get started with Yii
</a>
</div>
<div
class=
"jumbotron"
>
<h1>
Congratulations!
</h1>
<p
class=
"lead"
>
You have successfully created your Yii-powered application.
</p>
<p><a
class=
"btn btn-large btn-success"
href=
"http://www.yiiframework.com"
>
Get started with Yii
</a></p>
</div>
<hr
>
<div
class=
"body-content"
>
<!-- Example row of columns -->
<div
class=
"row-fluid"
>
<div
class=
"span4"
>
<div
class=
"row"
>
<div
class=
"col-lg-4"
>
<h2>
Heading
</h2>
<p>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.
</p>
<p><a
class=
"btn"
href=
"#"
>
View details
»
</a></p>
<p><a
class=
"btn btn-default"
href=
"http://www.yiiframework.com/doc/"
>
Yii Documentation
»
</a></p>
</div>
<div
class=
"span
4"
>
<div
class=
"col-lg-
4"
>
<h2>
Heading
</h2>
<p>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.
</p>
<p><a
class=
"btn"
href=
"#"
>
View details
»
</a></p>
<p><a
class=
"btn btn-default"
href=
"http://www.yiiframework.com/forum/"
>
Yii Forum
»
</a></p>
</div>
<div
class=
"span
4"
>
<div
class=
"col-lg-
4"
>
<h2>
Heading
</h2>
<p>
Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta
felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum
massa.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.
</p>
<p><a
class=
"btn"
href=
"#"
>
View details
»
</a></p>
<p><a
class=
"btn btn-default"
href=
"http://www.yiiframework.com/extensions/"
>
Yii Extensions
»
</a></p>
</div>
</div>
</div>
</div>
</div>
apps/advanced/backend/views/site/login.php
View file @
b07ac281
...
...
@@ -10,15 +10,21 @@ use yii\widgets\ActiveForm;
$this
->
title
=
'Login'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<div
class=
"site-login"
>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
Please fill out the following fields to login:
</p>
<p>
Please fill out the following fields to login:
</p>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
)));
?>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'id'
=>
'login-form'
));
?>
<?php
echo
$form
->
field
(
$model
,
'username'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
();
?>
<div
class=
"form-actions"
>
<?php
echo
Html
::
submitButton
(
'Login'
,
array
(
'class'
=>
'btn btn-primary'
));
?>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
\ No newline at end of file
apps/advanced/backend/web/css/site.css
View file @
b07ac281
body
{
padding-top
:
20px
;
padding-bottom
:
60px
;
padding-top
:
70px
;
}
/* Custom container */
.container
{
margin
:
0
auto
;
max-width
:
1000px
;
.footer
{
border-top
:
1px
solid
#ddd
;
margin-top
:
30px
;
padding-top
:
15px
;
padding-bottom
:
30px
;
}
.container
>
hr
{
margin
:
60px
0
;
}
/* Main marketing message and sign up button */
.jumbotron
{
margin
:
80px
0
;
text-align
:
center
;
background-color
:
transparent
;
}
.jumbotron
h1
{
font-size
:
100px
;
line-height
:
1
;
}
.jumbotron
.lead
{
font-size
:
24px
;
line-height
:
1.25
;
}
.jumbotron
.btn
{
font-size
:
21px
;
padding
:
14px
24px
;
}
/* Supporting marketing content */
.marketing
{
margin
:
60px
0
;
}
.marketing
p
+
h4
{
margin-top
:
28px
;
}
/* Customize the navbar links to be fill the entire space of the .navbar */
.navbar.fullwidth
.navbar-inner
{
padding
:
0
;
}
.navbar.fullwidth
.nav
{
margin
:
0
;
display
:
table
;
width
:
100%
;
}
.navbar.fullwidth
.nav
li
{
display
:
table-cell
;
width
:
1%
;
float
:
none
;
}
.navbar.fullwidth
.nav
li
a
{
font-weight
:
bold
;
text-align
:
center
;
border-left
:
1px
solid
rgba
(
255
,
255
,
255
,
.75
);
border-right
:
1px
solid
rgba
(
0
,
0
,
0
,
.1
);
}
.navbar.fullwidth
.nav
li
:first-child
a
{
border-left
:
0
;
border-radius
:
3px
0
0
3px
;
}
.navbar.fullwidth
.nav
li
:last-child
a
{
border-right
:
0
;
border-radius
:
0
3px
3px
0
;
}
apps/advanced/console/config/params.php
View file @
b07ac281
<?php
return
array
(
'adminEmail'
=>
'admin@example.com'
,
);
apps/advanced/environments/dev/backend/config/params-local.php
View file @
b07ac281
apps/advanced/environments/dev/common/config/params-local.php
View file @
b07ac281
apps/advanced/environments/dev/console/config/params-local.php
View file @
b07ac281
apps/advanced/environments/dev/frontend/config/params-local.php
View file @
b07ac281
apps/advanced/environments/prod/backend/config/params-local.php
View file @
b07ac281
apps/advanced/environments/prod/common/config/params-local.php
View file @
b07ac281
apps/advanced/environments/prod/console/config/params-local.php
View file @
b07ac281
apps/advanced/environments/prod/frontend/config/params-local.php
View file @
b07ac281
apps/advanced/frontend/config/AppAsset.php
View file @
b07ac281
...
...
@@ -6,6 +6,7 @@
*/
namespace
frontend\config
;
use
yii\web\AssetBundle
;
/**
...
...
apps/advanced/frontend/config/params.php
View file @
b07ac281
<?php
return
array
(
'adminEmail'
=>
'admin@example.com'
,
);
apps/advanced/frontend/views/layouts/main.php
View file @
b07ac281
<?php
use
frontend\config\AppAsset
;
use
yii\helpers\Html
;
use
yii\widgets\Menu
;
use
yii\bootstrap\Nav
;
use
yii\bootstrap\NavBar
;
use
yii\widgets\Breadcrumbs
;
use
frontend\widgets\Alert
;
...
...
@@ -20,15 +21,15 @@ AppAsset::register($this);
<?php
$this
->
head
();
?>
</head>
<body>
<div
class=
"container"
>
<?php
$this
->
beginBody
();
?>
<div
class=
"masthead"
>
<h3
class=
"muted"
>
My Company
</h3>
<div
class=
"navbar fullwidth"
>
<div
class=
"navbar-inner"
>
<div
class=
"container"
>
<?php
NavBar
::
begin
(
array
(
'brandLabel'
=>
'My Company'
,
'brandUrl'
=>
Yii
::
$app
->
homeUrl
,
'options'
=>
array
(
'class'
=>
'navbar-inverse navbar-fixed-top'
,
),
));
$menuItems
=
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
array
(
'/site/index'
)),
array
(
'label'
=>
'About'
,
'url'
=>
array
(
'/site/about'
)),
...
...
@@ -37,40 +38,32 @@ 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
Menu
::
widget
(
array
(
'options'
=>
array
(
'class'
=>
'nav
'
),
echo
Nav
::
widget
(
array
(
'options'
=>
array
(
'class'
=>
'navbar-nav pull-right
'
),
'items'
=>
$menuItems
,
));
NavBar
::
end
();
?>
</div>
</div>
</div>
<!-- /.navbar -->
</div>
<div
class=
"container"
>
<?php
echo
Breadcrumbs
::
widget
(
array
(
'links'
=>
isset
(
$this
->
params
[
'breadcrumbs'
])
?
$this
->
params
[
'breadcrumbs'
]
:
array
(),
));
?>
<?php
echo
Alert
::
widget
()
?>
<?php
echo
$content
;
?>
</div>
<hr>
<div
class=
"footer"
>
<p>
©
My Company
<?php
echo
date
(
'Y'
);
?>
</p>
<p>
<?php
echo
Yii
::
powered
();
?>
Template by
<a
href=
"http://twitter.github.io/bootstrap/"
>
Twitter Bootstrap
</a>
</p>
<footer
class=
"footer"
>
<div
class=
"container"
>
<p
class=
"pull-left"
>
©
My Company
<?php
echo
date
(
'Y'
);
?>
</p>
<p
class=
"pull-right"
>
<?php
echo
Yii
::
powered
();
?>
</p>
</div>
</footer>
<?php
$this
->
endBody
();
?>
</div>
</body>
</html>
<?php
$this
->
endPage
();
?>
apps/advanced/frontend/views/site/about.php
View file @
b07ac281
<?php
use
yii\helpers\Html
;
/**
* @var yii\base\View $this
*/
$this
->
title
=
'About'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
This is the About page. You may modify the following file to customize its content:
</p>
<div
class=
"site-about"
>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<code>
<?php
echo
__FILE__
;
?>
</code
>
<p>
This is the About page. You may modify the following file to customize its content:
</p
>
<code>
<?php
echo
__FILE__
;
?>
</code>
</div>
apps/advanced/frontend/views/site/contact.php
View file @
b07ac281
...
...
@@ -11,24 +11,29 @@ use yii\captcha\Captcha;
$this
->
title
=
'Contact'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<div
class=
"site-contact"
>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
<p>
If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
</p>
</p>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
),
'fieldConfig'
=>
array
(
'inputOptions'
=>
array
(
'class'
=>
'input-xlarge'
)),
));
?>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'id'
=>
'contact-form'
));
?>
<?php
echo
$form
->
field
(
$model
,
'name'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'email'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'subject'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'body'
)
->
textArea
(
array
(
'rows'
=>
6
));
?>
<?php
echo
$form
->
field
(
$model
,
'verifyCode'
)
->
widget
(
Captcha
::
className
(),
array
(
'options'
=>
array
(
'class'
=>
'input-medium'
),
'options'
=>
array
(
'class'
=>
'form-control'
),
'template'
=>
'<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>'
,
));
?>
<div
class=
"form-actions"
>
<?php
echo
Html
::
submitButton
(
'Submit'
,
array
(
'class'
=>
'btn btn-primary'
));
?>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
apps/advanced/frontend/views/site/index.php
View file @
b07ac281
...
...
@@ -2,46 +2,52 @@
/**
* @var yii\base\View $this
*/
$this
->
title
=
'
Welcome
'
;
$this
->
title
=
'
My Yii Application
'
;
?>
<div
class=
"jumbotron"
>
<h1>
Welcome!
</h1>
<div
class=
"site-index"
>
<p
class=
"lead"
>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus
commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
</p>
<a
class=
"btn btn-large btn-success"
href=
"http://www.yiiframework.com"
>
Get started with Yii
</a>
</div>
<div
class=
"jumbotron"
>
<h1>
Congratulations!
</h1>
<p
class=
"lead"
>
You have successfully created your Yii-powered application.
</p>
<p><a
class=
"btn btn-large btn-success"
href=
"http://www.yiiframework.com"
>
Get started with Yii
</a></p>
</div>
<hr
>
<div
class=
"body-content"
>
<!-- Example row of columns -->
<div
class=
"row-fluid"
>
<div
class=
"span4"
>
<div
class=
"row"
>
<div
class=
"col-lg-4"
>
<h2>
Heading
</h2>
<p>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.
</p>
<p><a
class=
"btn"
href=
"#"
>
View details
»
</a></p>
<p><a
class=
"btn btn-default"
href=
"http://www.yiiframework.com/doc/"
>
Yii Documentation
»
</a></p>
</div>
<div
class=
"span
4"
>
<div
class=
"col-lg-
4"
>
<h2>
Heading
</h2>
<p>
Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris
condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod.
Donec sed odio dui.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.
</p>
<p><a
class=
"btn"
href=
"#"
>
View details
»
</a></p>
<p><a
class=
"btn btn-default"
href=
"http://www.yiiframework.com/forum/"
>
Yii Forum
»
</a></p>
</div>
<div
class=
"span
4"
>
<div
class=
"col-lg-
4"
>
<h2>
Heading
</h2>
<p>
Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta
felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum
massa.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.
</p>
<p><a
class=
"btn"
href=
"#"
>
View details
»
</a></p>
<p><a
class=
"btn btn-default"
href=
"http://www.yiiframework.com/extensions/"
>
Yii Extensions
»
</a></p>
</div>
</div>
</div>
</div>
</div>
apps/advanced/frontend/views/site/login.php
View file @
b07ac281
...
...
@@ -10,17 +10,24 @@ use yii\widgets\ActiveForm;
$this
->
title
=
'Login'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<div
class=
"site-login"
>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
Please fill out the following fields to login:
</p>
<p>
Please fill out the following fields to login:
</p>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
)));
?>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'id'
=>
'login-form'
));
?>
<?php
echo
$form
->
field
(
$model
,
'username'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
();
?>
<div
style=
"color:#999;margin:1em 0"
>
If you forgot your password you can
<?php
echo
Html
::
a
(
'reset it'
,
array
(
'site/request-password-reset'
))
?>
.
</div>
<div
class=
"form-actions"
>
<?php
echo
Html
::
submitButton
(
'Login'
,
array
(
'class'
=>
'btn btn-primary'
));
?>
</div>
<?php
ActiveForm
::
end
();
?>
<p>
If you forgot your password you can
<?php
echo
Html
::
a
(
'reset it'
,
array
(
'site/request-password-reset'
))
?>
.
</p>
\ No newline at end of file
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
\ No newline at end of file
apps/advanced/frontend/views/site/requestPasswordResetToken.php
View file @
b07ac281
...
...
@@ -5,18 +5,24 @@ use yii\widgets\ActiveForm;
/**
* @var yii\base\View $this
* @var yii\widgets\ActiveForm $form
* @var
frontend
\models\User $model
* @var
common
\models\User $model
*/
$this
->
title
=
'Request password reset'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<div
class=
"site-request-password-reset"
>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
Please fill out your email. A link to reset password will be sent there.
</p>
<p>
Please fill out your email. A link to reset password will be sent there.
</p>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
)));
?>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'id'
=>
'request-password-reset-form'
));
?>
<?php
echo
$form
->
field
(
$model
,
'email'
)
->
textInput
();
?>
<div
class=
"form-actions"
>
<?php
echo
Html
::
submitButton
(
'Send'
,
array
(
'class'
=>
'btn btn-primary'
));
?>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
apps/advanced/frontend/views/site/resetPassword.php
View file @
b07ac281
...
...
@@ -10,13 +10,19 @@ use yii\widgets\ActiveForm;
$this
->
title
=
'Reset password'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<div
class=
"site-reset-password"
>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
Please choose your new password:
</p>
<p>
Please choose your new password:
</p>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
)));
?>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'id'
=>
'reset-password-form'
));
?>
<?php
echo
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<div
class=
"form-actions"
>
<?php
echo
Html
::
submitButton
(
'Save'
,
array
(
'class'
=>
'btn btn-primary'
));
?>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
\ No newline at end of file
apps/advanced/frontend/views/site/signup.php
View file @
b07ac281
...
...
@@ -10,15 +10,21 @@ use yii\widgets\ActiveForm;
$this
->
title
=
'Signup'
;
$this
->
params
[
'breadcrumbs'
][]
=
$this
->
title
;
?>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<div
class=
"site-signup"
>
<h1>
<?php
echo
Html
::
encode
(
$this
->
title
);
?>
</h1>
<p>
Please fill out the following fields to signup:
</p>
<p>
Please fill out the following fields to signup:
</p>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
)));
?>
<div
class=
"row"
>
<div
class=
"col-lg-5"
>
<?php
$form
=
ActiveForm
::
begin
(
array
(
'id'
=>
'form-signup'
));
?>
<?php
echo
$form
->
field
(
$model
,
'username'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'email'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<div
class=
"form-actions"
>
<?php
echo
Html
::
submitButton
(
'Signup'
,
array
(
'class'
=>
'btn btn-primary'
));
?>
</div>
<?php
ActiveForm
::
end
();
?>
<?php
ActiveForm
::
end
();
?>
</div>
</div>
</div>
apps/advanced/frontend/web/css/site.css
View file @
b07ac281
body
{
padding-top
:
20px
;
padding-bottom
:
60px
;
padding-top
:
70px
;
}
/* Custom container */
.container
{
margin
:
0
auto
;
max-width
:
1000px
;
.footer
{
border-top
:
1px
solid
#ddd
;
margin-top
:
30px
;
padding-top
:
15px
;
padding-bottom
:
30px
;
}
.container
>
hr
{
margin
:
60px
0
;
}
/* Main marketing message and sign up button */
.jumbotron
{
margin
:
80px
0
;
text-align
:
center
;
background-color
:
transparent
;
}
.jumbotron
h1
{
font-size
:
100px
;
line-height
:
1
;
}
.jumbotron
.lead
{
font-size
:
24px
;
line-height
:
1.25
;
}
.jumbotron
.btn
{
font-size
:
21px
;
padding
:
14px
24px
;
}
/* Supporting marketing content */
.marketing
{
margin
:
60px
0
;
}
.marketing
p
+
h4
{
margin-top
:
28px
;
}
/* Customize the navbar links to be fill the entire space of the .navbar */
.navbar.fullwidth
.navbar-inner
{
padding
:
0
;
}
.navbar.fullwidth
.nav
{
margin
:
0
;
display
:
table
;
width
:
100%
;
}
.navbar.fullwidth
.nav
li
{
display
:
table-cell
;
width
:
1%
;
float
:
none
;
}
.navbar.fullwidth
.nav
li
a
{
font-weight
:
bold
;
text-align
:
center
;
border-left
:
1px
solid
rgba
(
255
,
255
,
255
,
.75
);
border-right
:
1px
solid
rgba
(
0
,
0
,
0
,
.1
);
}
.navbar.fullwidth
.nav
li
:first-child
a
{
border-left
:
0
;
border-radius
:
3px
0
0
3px
;
}
.navbar.fullwidth
.nav
li
:last-child
a
{
border-right
:
0
;
border-radius
:
0
3px
3px
0
;
}
build/controllers/ClassmapController.php
View file @
b07ac281
...
...
@@ -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'
)
{
...
...
extensions/twig/yii/twig/ViewRenderer.php
View file @
b07ac281
...
...
@@ -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
));
}));
...
...
framework/yii/captcha/Captcha.php
View file @
b07ac281
...
...
@@ -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.
*
...
...
framework/yii/data/ArrayDataProvider.php
View file @
b07ac281
...
...
@@ -7,7 +7,6 @@
namespace
yii\data
;
use
yii\base\InvalidConfigException
;
use
yii\helpers\ArrayHelper
;
/**
...
...
tests/unit/TestCase.php
View file @
b07ac281
...
...
@@ -37,6 +37,7 @@ abstract class TestCase extends \yii\test\TestCase
* Populates Yii::$app with a new application
* The application will be destroyed on tearDown() automatically.
* @param array $config The application configuration, if needed
* @param string $appClass name of the application class to create
*/
protected
function
mockApplication
(
$config
=
array
(),
$appClass
=
'\yii\console\Application'
)
{
...
...
@@ -45,7 +46,7 @@ abstract class TestCase extends \yii\test\TestCase
'basePath'
=>
__DIR__
,
);
new
$appClass
(
array_merge
(
$defaultConfig
,
$config
));
new
$appClass
(
array_merge
(
$defaultConfig
,
$config
));
}
/**
...
...
tests/unit/data/ar/Customer.php
View file @
b07ac281
<?php
namespace
yiiunit\data\ar
;
use
yii\db\ActiveQuery
;
class
Customer
extends
ActiveRecord
...
...
tests/unit/data/ar/Order.php
View file @
b07ac281
...
...
@@ -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'
);
}
...
...
tests/unit/data/base/InvalidRulesModel.php
View file @
b07ac281
<?php
namespace
yiiunit\data\base
;
use
yii\base\Model
;
/**
...
...
@@ -13,5 +14,4 @@ class InvalidRulesModel extends Model
array
(
'test'
),
);
}
}
tests/unit/data/base/Singer.php
View file @
b07ac281
<?php
namespace
yiiunit\data\base
;
use
yii\base\Model
;
/**
...
...
tests/unit/data/base/Speaker.php
View file @
b07ac281
<?php
namespace
yiiunit\data\base
;
use
yii\base\Model
;
/**
...
...
tests/unit/data/config.php
View file @
b07ac281
<?php
return
array
(
'databases'
=>
array
(
'mysql'
=>
array
(
...
...
@@ -23,6 +22,6 @@ return array(
'username'
=>
'postgres'
,
'password'
=>
'postgres'
,
'fixture'
=>
__DIR__
.
'/postgres.sql'
,
)
)
)
,
),
);
tests/unit/framework/base/BehaviorTest.php
View file @
b07ac281
...
...
@@ -8,7 +8,6 @@ use yiiunit\TestCase;
class
BarClass
extends
Component
{
}
class
FooClass
extends
Component
...
...
tests/unit/framework/base/ComponentTest.php
View file @
b07ac281
...
...
@@ -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
;
};
}
...
...
tests/unit/framework/base/ModelTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\base
;
use
yii\base\Model
;
use
yiiunit\TestCase
;
use
yiiunit\data\base\Speaker
;
...
...
tests/unit/framework/base/ObjectTest.php
View file @
b07ac281
...
...
@@ -175,7 +175,7 @@ class NewObject extends Object
public
function
getExecute
()
{
return
function
(
$param
)
{
return
function
(
$param
)
{
return
$param
*
2
;
};
}
...
...
tests/unit/framework/behaviors/AutoTimestampTest.php
View file @
b07ac281
...
...
@@ -26,7 +26,8 @@ class AutoTimestampTest extends TestCase
}
}
public
function
setUp
()
{
public
function
setUp
()
{
$this
->
mockApplication
(
array
(
'components'
=>
array
(
...
...
tests/unit/framework/caching/ApcCacheTest.php
View file @
b07ac281
<?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."
);
}
...
...
tests/unit/framework/caching/CacheTestCase.php
View file @
b07ac281
...
...
@@ -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
();
}
...
...
tests/unit/framework/caching/DbCacheTest.php
View file @
b07ac281
...
...
@@ -35,7 +35,7 @@ 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'
);
...
...
tests/unit/framework/caching/FileCacheTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\FileCache
;
/**
...
...
tests/unit/framework/caching/MemCacheTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\MemCache
;
/**
...
...
tests/unit/framework/caching/MemCachedTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\MemCache
;
/**
...
...
tests/unit/framework/caching/WinCacheTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\WinCache
;
/**
...
...
tests/unit/framework/caching/XCacheTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\XCache
;
/**
...
...
tests/unit/framework/caching/ZendDataCacheTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\caching
;
use
yii\caching\Cache
;
use
yii\caching\ZendDataCache
;
...
...
tests/unit/framework/console/controllers/AssetControllerTest.php
View file @
b07ac281
...
...
@@ -226,7 +226,7 @@ class AssetControllerTest extends TestCase
'yii'
,
),
),
);
;
);
$bundleFile
=
$this
->
testFilePath
.
DIRECTORY_SEPARATOR
.
'bundle.php'
;
$configFile
=
$this
->
testFilePath
.
DIRECTORY_SEPARATOR
.
'config.php'
;
...
...
tests/unit/framework/data/SortTest.php
View file @
b07ac281
...
...
@@ -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
...
...
tests/unit/framework/db/ActiveRecordTest.php
View file @
b07ac281
...
...
@@ -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
));
...
...
tests/unit/framework/db/CommandTest.php
View file @
b07ac281
...
...
@@ -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
()
{
}
}
tests/unit/framework/db/ConnectionTest.php
View file @
b07ac281
...
...
@@ -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'
));
...
...
tests/unit/framework/db/QueryBuilderTest.php
View file @
b07ac281
...
...
@@ -129,5 +129,4 @@ class QueryBuilderTest extends DatabaseTestCase
$tableSchema
=
$qb
->
db
->
getSchema
()
->
getTableSchema
(
$tableName
);
$this
->
assertEquals
(
0
,
count
(
$tableSchema
->
primaryKey
));
}
}
tests/unit/framework/db/QueryTest.php
View file @
b07ac281
...
...
@@ -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
()
{
}
}
tests/unit/framework/db/mssql/MssqlActiveRecordTest.php
View file @
b07ac281
tests/unit/framework/db/mssql/MssqlCommandTest.php
View file @
b07ac281
...
...
@@ -12,7 +12,7 @@ class MssqlCommandTest extends CommandTest
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
();
...
...
tests/unit/framework/db/mssql/MssqlConnectionTest.php
View file @
b07ac281
...
...
@@ -12,7 +12,7 @@ class MssqlConnectionTest extends ConnectionTest
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'
));
...
...
tests/unit/framework/db/mssql/MssqlQueryTest.php
View file @
b07ac281
tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php
View file @
b07ac281
tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
View file @
b07ac281
<?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'
));
...
...
@@ -34,7 +36,7 @@ class PostgreSQLConnectionTest extends ConnectionTest {
$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)'
));
}
}
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
View file @
b07ac281
...
...
@@ -72,5 +72,4 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
array
(
Schema
::
TYPE_MONEY
.
' NOT NULL'
,
'numeric(19,4) NOT NULL'
),
);
}
}
tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php
View file @
b07ac281
tests/unit/framework/db/sqlite/SqliteCommandTest.php
View file @
b07ac281
tests/unit/framework/db/sqlite/SqliteConnectionTest.php
View file @
b07ac281
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
View file @
b07ac281
...
...
@@ -78,5 +78,4 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
$this
->
setExpectedException
(
'yii\base\NotSupportedException'
);
parent
::
testAddDropPrimayKey
();
}
}
tests/unit/framework/db/sqlite/SqliteQueryTest.php
View file @
b07ac281
tests/unit/framework/helpers/ConsoleTest.php
View file @
b07ac281
...
...
@@ -75,5 +75,4 @@ class ConsoleTest extends TestCase
sleep(1);
}
}*/
}
tests/unit/framework/helpers/FileHelperTest.php
View file @
b07ac281
...
...
@@ -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
);
...
...
tests/unit/framework/helpers/HtmlTest.php
View file @
b07ac281
...
...
@@ -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>"
;
}
)));
...
...
tests/unit/framework/helpers/InflectorTest.php
View file @
b07ac281
tests/unit/framework/helpers/JsonTest.php
View file @
b07ac281
...
...
@@ -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
...
...
tests/unit/framework/helpers/StringHelperTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\helpers
;
use
\yii\helpers\StringHelper
as
StringHelper
;
use
yii\test\TestCase
;
...
...
tests/unit/framework/helpers/VarDumperTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\helpers
;
use
\yii\helpers\VarDumper
;
use
yii\test\TestCase
;
...
...
tests/unit/framework/requirements/YiiRequirementCheckerTest.php
View file @
b07ac281
...
...
@@ -60,7 +60,8 @@ class YiiRequirementCheckerTest extends TestCase
/**
* @depends testCheck
*/
public
function
testCheckEval
()
{
public
function
testCheckEval
()
{
$requirementsChecker
=
new
YiiRequirementChecker
();
$requirements
=
array
(
...
...
tests/unit/framework/validators/EmailValidatorTest.php
View file @
b07ac281
<?php
namespace
yiiunit\framework\validators
;
use
yii\validators\EmailValidator
;
use
yiiunit\TestCase
;
...
...
tests/unit/framework/widgets/SpacelessTest.php
View file @
b07ac281
...
...
@@ -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
());
}
}
tests/web/app/protected/controllers/SiteController.php
View file @
b07ac281
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