Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EcomDev_PHPUnit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open
EcomDev_PHPUnit
Commits
66fca00f
Commit
66fca00f
authored
Sep 21, 2011
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
! Add wrapper exception for fixture database query failures
parent
77932a42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
+21
-7
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Exception.php
...munity/EcomDev/PHPUnit/Model/Mysql4/Fixture/Exception.php
+9
-0
No files found.
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
View file @
66fca00f
...
@@ -37,8 +37,15 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
...
@@ -37,8 +37,15 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
*/
*/
public
function
cleanTable
(
$tableEntity
)
public
function
cleanTable
(
$tableEntity
)
{
{
$this
->
_getWriteAdapter
()
try
{
->
truncate
(
$this
->
getTable
(
$tableEntity
));
$this
->
_getWriteAdapter
()
->
delete
(
$this
->
getTable
(
$tableEntity
));
}
catch
(
Exception
$e
)
{
throw
new
EcomDev_PHPUnit_Model_Mysql4_Fixture_Exception
(
sprintf
(
'Unable to clear records for a table "%s"'
,
$tableEntity
),
$e
);
}
return
$this
;
return
$this
;
}
}
...
@@ -58,11 +65,18 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
...
@@ -58,11 +65,18 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
$records
[]
=
$this
->
_getTableRecord
(
$row
,
$tableColumns
);
$records
[]
=
$this
->
_getTableRecord
(
$row
,
$tableColumns
);
}
}
$this
->
_getWriteAdapter
()
->
insertOnDuplicate
(
try
{
$this
->
getTable
(
$tableEntity
),
$this
->
_getWriteAdapter
()
->
insertOnDuplicate
(
$records
$this
->
getTable
(
$tableEntity
),
);
$records
);
}
catch
(
Exception
$e
)
{
throw
new
EcomDev_PHPUnit_Model_Mysql4_Fixture_Exception
(
sprintf
(
'Unable to insert/update records for a table "%s"'
,
$tableEntity
),
$e
);
}
return
$this
;
return
$this
;
}
}
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Exception.php
0 → 100644
View file @
66fca00f
<?php
class
EcomDev_PHPUnit_Model_Mysql4_Fixture_Exception
extends
RuntimeException
{
public
function
__construct
(
$message
,
Exception
$previous
)
{
parent
::
__construct
(
$message
,
0
,
$previous
);
}
}
\ No newline at end of file
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