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
9ffeac99
Commit
9ffeac99
authored
Mar 21, 2013
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #96 from aligent/issues/78_configurable_fixtures
Issues/78 configurable fixtures
parents
ad62b444
9264db77
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
9 deletions
+54
-9
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
+2
-2
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
...mDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
+45
-0
lib/EcomDev/PHPUnit/Helper.php
lib/EcomDev/PHPUnit/Helper.php
+4
-4
lib/EcomDev/PHPUnit/Helper/Abstract.php
lib/EcomDev/PHPUnit/Helper/Abstract.php
+1
-1
lib/EcomDev/PHPUnit/Helper/Interface.php
lib/EcomDev/PHPUnit/Helper/Interface.php
+1
-1
lib/EcomDev/PHPUnit/Helper/Listener/Interface.php
lib/EcomDev/PHPUnit/Helper/Listener/Interface.php
+1
-1
No files found.
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture.php
View file @
9ffeac99
...
...
@@ -42,7 +42,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
->
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
),
sprintf
(
'Unable to clear records for a table "%s"
- "%s"'
,
$tableEntity
,
$e
->
getMessage
()
),
$e
);
}
...
...
@@ -72,7 +72,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture extends Mage_Core_Model_Mysql4_Abstra
);
}
catch
(
Exception
$e
)
{
throw
new
EcomDev_PHPUnit_Model_Mysql4_Fixture_Exception
(
sprintf
(
'Unable to insert/update records for a table "%s"
'
,
$tableEntity
),
sprintf
(
'Unable to insert/update records for a table "%s"
- "%s"'
,
$tableEntity
,
$e
->
getMessage
()
),
$e
);
}
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Catalog/Product.php
View file @
9ffeac99
...
...
@@ -59,6 +59,7 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
$records
+=
$this
->
_getTierPriceRecords
(
$row
,
$entityTypeModel
);
$records
+=
$this
->
_getCategoryAssociationRecords
(
$row
,
$entityTypeModel
);
$records
+=
$this
->
_getProductStockRecords
(
$row
,
$entityTypeModel
);
$records
+=
$this
->
_getProductSuperRelations
(
$row
,
$entityTypeModel
);
return
$records
;
}
...
...
@@ -79,6 +80,50 @@ class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Catalog_Product extends EcomDev_P
return
parent
::
_getAttributeRecords
(
$row
,
$attribute
,
$tableColumns
);
}
/**
* Generates records for catalog_product_super_attribute and catalog_product_super_link tables
*
* @param array $row
* @param Mage_Eav_Model_Entity_Type $entityTypeModel
* @return array
* @throws RuntimeException
*/
protected
function
_getProductSuperRelations
(
$row
,
$entityTypeModel
)
{
$result
=
array
();
if
(
isset
(
$row
[
'super_attributes'
])
&&
is_array
(
$row
[
'super_attributes'
]))
{
$records
=
array
();
$attributeCodes
=
$entityTypeModel
->
getAttributeCollection
();
foreach
(
$row
[
'super_attributes'
]
as
$attributeCode
)
{
$attributeId
=
$attributeCodes
->
getItemByColumnValue
(
'attribute_code'
,
$attributeCode
)
->
getId
();
$records
[]
=
array
(
'product_id'
=>
$row
[
$this
->
_getEntityIdField
(
$entityTypeModel
)],
'attribute_id'
=>
$attributeId
);
}
if
(
$records
)
{
$result
+=
array
(
'catalog/product_super_attribute'
=>
$records
);
}
}
if
(
isset
(
$row
[
'configurable_children'
])
&&
is_array
(
$row
[
'configurable_children'
]))
{
$records
=
array
();
foreach
(
$row
[
'configurable_children'
]
as
$childId
)
{
$records
[]
=
array
(
'parent_id'
=>
$row
[
$this
->
_getEntityIdField
(
$entityTypeModel
)],
'product_id'
=>
$childId
);
}
if
(
$records
)
{
$result
+=
array
(
'catalog/product_super_link'
=>
$records
);
}
}
return
$result
;
}
/**
* Generates records for catalog_product_website table
*
...
...
lib/EcomDev/PHPUnit/Helper.php
View file @
9ffeac99
...
...
@@ -9,7 +9,7 @@ class EcomDev_PHPUnit_Helper
/**
* Helpers container
*
* @var EcomDev_PHP
u
nit_Helper_Interface[]
* @var EcomDev_PHP
U
nit_Helper_Interface[]
*/
protected
static
$helpers
=
array
();
...
...
@@ -19,12 +19,12 @@ class EcomDev_PHPUnit_Helper
* If $position is specified, it will use value
* from before or after key as related helper
*
* @param EcomDev_PHP
u
nit_Helper_Interface $helper
* @param EcomDev_PHP
U
nit_Helper_Interface $helper
* @param bool|array $position
*
* @throws RuntimeException
*/
public
static
function
add
(
EcomDev_PHP
u
nit_Helper_Interface
$helper
,
$position
=
false
)
public
static
function
add
(
EcomDev_PHP
U
nit_Helper_Interface
$helper
,
$position
=
false
)
{
if
(
$position
===
false
)
{
self
::
$helpers
[]
=
$helper
;
...
...
@@ -82,7 +82,7 @@ class EcomDev_PHPUnit_Helper
* if helper for action was not found it returns false
*
* @param $action
* @return bool|EcomDev_PHP
u
nit_Helper_Interface
* @return bool|EcomDev_PHP
U
nit_Helper_Interface
*/
public
static
function
getByAction
(
$action
)
{
...
...
lib/EcomDev/PHPUnit/Helper/Abstract.php
View file @
9ffeac99
...
...
@@ -19,7 +19,7 @@
/**
* Base helper implementation
*/
abstract
class
EcomDev_PHPUnit_Helper_Abstract
implements
EcomDev_PHP
u
nit_Helper_Interface
abstract
class
EcomDev_PHPUnit_Helper_Abstract
implements
EcomDev_PHP
U
nit_Helper_Interface
{
/**
* @var PHPUnit_Framework_TestCase
...
...
lib/EcomDev/PHPUnit/Helper/Interface.php
View file @
9ffeac99
...
...
@@ -19,7 +19,7 @@
/**
* Interface for PHPUnit Test Helpers
*/
interface
EcomDev_PHP
u
nit_Helper_Interface
interface
EcomDev_PHP
U
nit_Helper_Interface
{
/**
* Checks if helper has action for invocation
...
...
lib/EcomDev/PHPUnit/Helper/Listener/Interface.php
View file @
9ffeac99
...
...
@@ -7,7 +7,7 @@
* These methods are invoked when test setUp() or tearDown() is executed
*
*/
interface
EcomDev_PHPUnit_Helper_Listener_Interface
extends
EcomDev_PHP
u
nit_Helper_Interface
interface
EcomDev_PHPUnit_Helper_Listener_Interface
extends
EcomDev_PHP
U
nit_Helper_Interface
{
public
function
setUp
();
...
...
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