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
0300683b
Commit
0300683b
authored
Jan 10, 2015
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved db test, avoid error by accessing db directlry
always use getConnection()
parent
f177f170
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
DatabaseTestCase.php
tests/unit/framework/db/DatabaseTestCase.php
+7
-7
No files found.
tests/unit/framework/db/DatabaseTestCase.php
View file @
0300683b
...
@@ -11,7 +11,7 @@ abstract class DatabaseTestCase extends TestCase
...
@@ -11,7 +11,7 @@ abstract class DatabaseTestCase extends TestCase
/**
/**
* @var Connection
* @var Connection
*/
*/
pr
otected
$
db
;
pr
ivate
$_
db
;
protected
function
setUp
()
protected
function
setUp
()
{
{
...
@@ -28,8 +28,8 @@ abstract class DatabaseTestCase extends TestCase
...
@@ -28,8 +28,8 @@ abstract class DatabaseTestCase extends TestCase
protected
function
tearDown
()
protected
function
tearDown
()
{
{
if
(
$this
->
db
)
{
if
(
$this
->
_
db
)
{
$this
->
db
->
close
();
$this
->
_
db
->
close
();
}
}
$this
->
destroyApplication
();
$this
->
destroyApplication
();
}
}
...
@@ -41,8 +41,8 @@ abstract class DatabaseTestCase extends TestCase
...
@@ -41,8 +41,8 @@ abstract class DatabaseTestCase extends TestCase
*/
*/
public
function
getConnection
(
$reset
=
true
,
$open
=
true
)
public
function
getConnection
(
$reset
=
true
,
$open
=
true
)
{
{
if
(
!
$reset
&&
$this
->
db
)
{
if
(
!
$reset
&&
$this
->
_
db
)
{
return
$this
->
db
;
return
$this
->
_
db
;
}
}
$config
=
$this
->
database
;
$config
=
$this
->
database
;
if
(
isset
(
$config
[
'fixture'
]))
{
if
(
isset
(
$config
[
'fixture'
]))
{
...
@@ -52,11 +52,11 @@ abstract class DatabaseTestCase extends TestCase
...
@@ -52,11 +52,11 @@ abstract class DatabaseTestCase extends TestCase
$fixture
=
null
;
$fixture
=
null
;
}
}
try
{
try
{
$this
->
db
=
$this
->
prepareDatabase
(
$config
,
$fixture
,
$open
);
$this
->
_
db
=
$this
->
prepareDatabase
(
$config
,
$fixture
,
$open
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$this
->
markTestSkipped
(
"Something wrong when preparing database: "
.
$e
->
getMessage
());
$this
->
markTestSkipped
(
"Something wrong when preparing database: "
.
$e
->
getMessage
());
}
}
return
$this
->
db
;
return
$this
->
_
db
;
}
}
public
function
prepareDatabase
(
$config
,
$fixture
,
$open
=
true
)
public
function
prepareDatabase
(
$config
,
$fixture
,
$open
=
true
)
...
...
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