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
f21c2c29
Commit
f21c2c29
authored
Sep 05, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test breaks.
parent
a27b6e92
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
11 deletions
+23
-11
TestCase.php
tests/unit/TestCase.php
+16
-9
.gitignore
tests/unit/assets/.gitignore
+3
-0
bootstrap.php
tests/unit/bootstrap.php
+2
-0
ViewRendererTest.php
tests/unit/extensions/smarty/ViewRendererTest.php
+1
-1
ViewRendererTest.php
tests/unit/extensions/twig/ViewRendererTest.php
+1
-1
No files found.
tests/unit/TestCase.php
View file @
f21c2c29
...
@@ -44,29 +44,36 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
...
@@ -44,29 +44,36 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
*/
*/
protected
function
mockApplication
(
$config
=
[],
$appClass
=
'\yii\console\Application'
)
protected
function
mockApplication
(
$config
=
[],
$appClass
=
'\yii\console\Application'
)
{
{
static
$defaultConfig
=
[
new
$appClass
(
ArrayHelper
::
merge
(
[
'id'
=>
'testapp'
,
'id'
=>
'testapp'
,
'basePath'
=>
__DIR__
,
'basePath'
=>
__DIR__
,
];
'vendorPath'
=>
$this
->
getVendorPath
(),
$defaultConfig
[
'vendorPath'
]
=
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
;
],
$config
));
new
$appClass
(
ArrayHelper
::
merge
(
$defaultConfig
,
$config
));
}
}
protected
function
mockWebApplication
(
$config
=
[],
$appClass
=
'\yii\web\Application'
)
protected
function
mockWebApplication
(
$config
=
[],
$appClass
=
'\yii\web\Application'
)
{
{
static
$defaultConfig
=
[
new
$appClass
(
ArrayHelper
::
merge
(
[
'id'
=>
'testapp'
,
'id'
=>
'testapp'
,
'basePath'
=>
__DIR__
,
'basePath'
=>
__DIR__
,
'vendorPath'
=>
$this
->
getVendorPath
(),
'components'
=>
[
'components'
=>
[
'request'
=>
[
'request'
=>
[
'cookieValidationKey'
=>
'wefJDF8sfdsfSDefwqdxj9oq'
,
'cookieValidationKey'
=>
'wefJDF8sfdsfSDefwqdxj9oq'
,
'scriptFile'
=>
__DIR__
.
'/index.php'
,
'scriptUrl'
=>
'/index.php'
,
],
],
]
]
];
]
,
$config
))
;
$defaultConfig
[
'vendorPath'
]
=
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
;
}
new
$appClass
(
ArrayHelper
::
merge
(
$defaultConfig
,
$config
));
protected
function
getVendorPath
()
{
$vendor
=
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
;
if
(
!
is_dir
(
$vendor
))
{
$vendor
=
dirname
(
dirname
(
dirname
(
dirname
(
__DIR__
))));
}
return
$vendor
;
}
}
/**
/**
...
...
tests/unit/assets/.gitignore
0 → 100644
View file @
f21c2c29
*
!.gitignore
!/coveralls/.gitkeep
tests/unit/bootstrap.php
View file @
f21c2c29
...
@@ -12,6 +12,8 @@ $_SERVER['SCRIPT_FILENAME'] = __FILE__;
...
@@ -12,6 +12,8 @@ $_SERVER['SCRIPT_FILENAME'] = __FILE__;
$composerAutoload
=
__DIR__
.
'/../../vendor/autoload.php'
;
$composerAutoload
=
__DIR__
.
'/../../vendor/autoload.php'
;
if
(
is_file
(
$composerAutoload
))
{
if
(
is_file
(
$composerAutoload
))
{
require_once
(
$composerAutoload
);
require_once
(
$composerAutoload
);
}
else
{
require_once
(
__DIR__
.
'/../../../../autoload.php'
);
}
}
require_once
(
__DIR__
.
'/../../framework/Yii.php'
);
require_once
(
__DIR__
.
'/../../framework/Yii.php'
);
...
...
tests/unit/extensions/smarty/ViewRendererTest.php
View file @
f21c2c29
...
@@ -22,7 +22,7 @@ class ViewRendererTest extends TestCase
...
@@ -22,7 +22,7 @@ class ViewRendererTest extends TestCase
protected
function
setUp
()
protected
function
setUp
()
{
{
parent
::
setUp
();
parent
::
setUp
();
$this
->
mockApplication
();
$this
->
mock
Web
Application
();
}
}
protected
function
tearDown
()
protected
function
tearDown
()
...
...
tests/unit/extensions/twig/ViewRendererTest.php
View file @
f21c2c29
...
@@ -22,7 +22,7 @@ class ViewRendererTest extends DatabaseTestCase
...
@@ -22,7 +22,7 @@ class ViewRendererTest extends DatabaseTestCase
protected
function
setUp
()
protected
function
setUp
()
{
{
parent
::
setUp
();
parent
::
setUp
();
$this
->
mockApplication
();
$this
->
mock
Web
Application
();
}
}
protected
function
tearDown
()
protected
function
tearDown
()
...
...
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