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
d1015750
Commit
d1015750
authored
Jan 08, 2013
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:IvanChepurnyi/EcomDev_PHPUnit into dev
parents
35b3e62c
2efafd3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
16 deletions
+39
-16
app/code/community/EcomDev/PHPUnit/Model/Fixture/Processor/Eav.php
...community/EcomDev/PHPUnit/Model/Fixture/Processor/Eav.php
+7
-1
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Abstract.php
...ity/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Abstract.php
+32
-15
No files found.
app/code/community/EcomDev/PHPUnit/Model/Fixture/Processor/Eav.php
View file @
d1015750
...
@@ -84,10 +84,12 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Eav
...
@@ -84,10 +84,12 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Eav
*/
*/
public
function
apply
(
array
$data
,
$key
,
EcomDev_PHPUnit_Model_Fixture_Interface
$fixture
)
public
function
apply
(
array
$data
,
$key
,
EcomDev_PHPUnit_Model_Fixture_Interface
$fixture
)
{
{
$eavLoaders
=
array
();
$this
->
getResource
()
->
beginTransaction
();
$this
->
getResource
()
->
beginTransaction
();
foreach
(
$data
as
$entityType
=>
$values
)
{
foreach
(
$data
as
$entityType
=>
$values
)
{
$this
->
_getEavLoader
(
$entityType
)
$
eavLoaders
[]
=
$
this
->
_getEavLoader
(
$entityType
)
->
setFixture
(
$fixture
)
->
setFixture
(
$fixture
)
->
setOptions
(
$fixture
->
getOptions
())
->
setOptions
(
$fixture
->
getOptions
())
->
loadEntity
(
$entityType
,
$values
);
->
loadEntity
(
$entityType
,
$values
);
...
@@ -95,6 +97,10 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Eav
...
@@ -95,6 +97,10 @@ class EcomDev_PHPUnit_Model_Fixture_Processor_Eav
$this
->
getResource
()
->
commit
();
$this
->
getResource
()
->
commit
();
foreach
(
$eavLoaders
as
$eavLoader
){
$eavLoader
->
runRequiredIndexers
();
}
$fixture
->
setStorageData
(
self
::
STORAGE_KEY
,
array_keys
(
$data
));
$fixture
->
setStorageData
(
self
::
STORAGE_KEY
,
array_keys
(
$data
));
return
$this
;
return
$this
;
}
}
...
...
app/code/community/EcomDev/PHPUnit/Model/Mysql4/Fixture/Eav/Abstract.php
View file @
d1015750
...
@@ -31,15 +31,45 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract
...
@@ -31,15 +31,45 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract
protected
$_requiredIndexers
=
array
();
protected
$_requiredIndexers
=
array
();
/**
/**
*
Retrieve required indexers for re-building
*
Original list of indexers required to build
*
*
* @var array
* @var array
*/
*/
protected
$_originalIndexers
=
array
();
/**
* Retrieve required indexers for re-building
*
* @return array
*/
public
function
getRequiredIndexers
()
public
function
getRequiredIndexers
()
{
{
return
$this
->
_requiredIndexers
;
return
$this
->
_requiredIndexers
;
}
}
/**
* Run required indexers and reset to original required indexers
*
* @return EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract
*/
public
function
runRequiredIndexers
()
{
if
(
empty
(
$this
->
_options
[
'doNotIndexAll'
]))
{
$indexer
=
Mage
::
getSingleton
(
'index/indexer'
);
foreach
(
$this
->
getRequiredIndexers
()
as
$indexerCode
)
{
if
(
empty
(
$this
->
_options
[
'doNotIndex'
])
||
!
in_array
(
$indexerCode
,
$this
->
_options
[
'doNotIndex'
]))
{
$indexer
->
getProcessByCode
(
$indexerCode
)
->
reindexAll
();
}
}
}
// Restoring original required indexers for making tests isolated
$this
->
_requiredIndexers
=
$this
->
_originalIndexers
;
return
$this
;
}
/**
/**
* Add indexer by specific code to required indexers list
* Add indexer by specific code to required indexers list
*
*
...
@@ -78,7 +108,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract
...
@@ -78,7 +108,7 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract
*/
*/
public
function
loadEntity
(
$entityType
,
$values
)
public
function
loadEntity
(
$entityType
,
$values
)
{
{
$
originalRequired
Indexers
=
$this
->
_requiredIndexers
;
$
this
->
_original
Indexers
=
$this
->
_requiredIndexers
;
if
(
!
empty
(
$this
->
_options
[
'addRequiredIndex'
]))
{
if
(
!
empty
(
$this
->
_options
[
'addRequiredIndex'
]))
{
foreach
(
$this
->
_options
[
'addRequiredIndex'
]
as
$data
)
{
foreach
(
$this
->
_options
[
'addRequiredIndex'
]
as
$data
)
{
if
(
preg_match
(
'/^([a-z0-9_\\-])+\\s+([a-z0-9_\\-])\s*$/i'
,
$data
,
$match
)
if
(
preg_match
(
'/^([a-z0-9_\\-])+\\s+([a-z0-9_\\-])\s*$/i'
,
$data
,
$match
)
...
@@ -182,19 +212,6 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract
...
@@ -182,19 +212,6 @@ abstract class EcomDev_PHPUnit_Model_Mysql4_Fixture_Eav_Abstract
$this
->
_customEntityAction
(
$entity
,
$entityTypeModel
);
$this
->
_customEntityAction
(
$entity
,
$entityTypeModel
);
}
}
if
(
empty
(
$this
->
_options
[
'doNotIndexAll'
]))
{
$indexer
=
Mage
::
getSingleton
(
'index/indexer'
);
foreach
(
$this
->
getRequiredIndexers
()
as
$indexerCode
)
{
if
(
empty
(
$this
->
_options
[
'doNotIndex'
])
||
!
in_array
(
$indexerCode
,
$this
->
_options
[
'doNotIndex'
]))
{
$indexer
->
getProcessByCode
(
$indexerCode
)
->
reindexAll
();
}
}
}
// Restoring original required indexers for making tests isolated
$this
->
_requiredIndexers
=
$originalRequiredIndexers
;
return
$this
;
return
$this
;
}
}
...
...
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