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
1260662b
Commit
1260662b
authored
Oct 02, 2011
by
Ivan Chepurnyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
! Imporved speed of fixtures loading by adding transaction wrapper
parent
66fca00f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
+11
-1
No files found.
app/code/community/EcomDev/PHPUnit/Model/Fixture.php
View file @
1260662b
...
@@ -525,6 +525,7 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -525,6 +525,7 @@ class EcomDev_PHPUnit_Model_Fixture
$ignoreCleanUp
=
array_keys
(
$this
->
getStorageData
(
self
::
STORAGE_KEY_TABLES
,
self
::
SCOPE_SHARED
));
$ignoreCleanUp
=
array_keys
(
$this
->
getStorageData
(
self
::
STORAGE_KEY_TABLES
,
self
::
SCOPE_SHARED
));
}
}
$this
->
getResource
()
->
beginTransaction
();
foreach
(
$tables
as
$tableEntity
=>
$data
)
{
foreach
(
$tables
as
$tableEntity
=>
$data
)
{
if
(
!
in_array
(
$tableEntity
,
$ignoreCleanUp
))
{
if
(
!
in_array
(
$tableEntity
,
$ignoreCleanUp
))
{
$this
->
getResource
()
->
cleanTable
(
$tableEntity
);
$this
->
getResource
()
->
cleanTable
(
$tableEntity
);
...
@@ -534,7 +535,7 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -534,7 +535,7 @@ class EcomDev_PHPUnit_Model_Fixture
$this
->
getResource
()
->
loadTableData
(
$tableEntity
,
$data
);
$this
->
getResource
()
->
loadTableData
(
$tableEntity
,
$data
);
}
}
}
}
$this
->
getResource
()
->
commit
();
$this
->
setStorageData
(
self
::
STORAGE_KEY_TABLES
,
$tables
);
$this
->
setStorageData
(
self
::
STORAGE_KEY_TABLES
,
$tables
);
}
}
...
@@ -558,6 +559,7 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -558,6 +559,7 @@ class EcomDev_PHPUnit_Model_Fixture
if
(
$this
->
isScopeLocal
()
&&
$this
->
getStorageData
(
self
::
STORAGE_KEY_TABLES
,
self
::
SCOPE_SHARED
))
{
if
(
$this
->
isScopeLocal
()
&&
$this
->
getStorageData
(
self
::
STORAGE_KEY_TABLES
,
self
::
SCOPE_SHARED
))
{
$restoreTableData
=
$this
->
getStorageData
(
self
::
STORAGE_KEY_TABLES
,
self
::
SCOPE_SHARED
);
$restoreTableData
=
$this
->
getStorageData
(
self
::
STORAGE_KEY_TABLES
,
self
::
SCOPE_SHARED
);
}
}
$this
->
getResource
()
->
beginTransaction
();
foreach
(
array_keys
(
$tables
)
as
$tableEntity
)
{
foreach
(
array_keys
(
$tables
)
as
$tableEntity
)
{
$this
->
getResource
()
->
cleanTable
(
$tableEntity
);
$this
->
getResource
()
->
cleanTable
(
$tableEntity
);
...
@@ -567,6 +569,7 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -567,6 +569,7 @@ class EcomDev_PHPUnit_Model_Fixture
}
}
}
}
$this
->
getResource
()
->
commit
();
$this
->
setStorageData
(
self
::
STORAGE_KEY_TABLES
,
null
);
$this
->
setStorageData
(
self
::
STORAGE_KEY_TABLES
,
null
);
}
}
...
@@ -640,6 +643,8 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -640,6 +643,8 @@ class EcomDev_PHPUnit_Model_Fixture
throw
new
InvalidArgumentException
(
'EAV part should be an associative list with rows as value and entity type as key'
);
throw
new
InvalidArgumentException
(
'EAV part should be an associative list with rows as value and entity type as key'
);
}
}
$this
->
getResource
()
->
beginTransaction
();
foreach
(
$entities
as
$entityType
=>
$values
)
{
foreach
(
$entities
as
$entityType
=>
$values
)
{
$this
->
_getEavLoader
(
$entityType
)
$this
->
_getEavLoader
(
$entityType
)
->
setFixture
(
$this
)
->
setFixture
(
$this
)
...
@@ -647,6 +652,8 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -647,6 +652,8 @@ class EcomDev_PHPUnit_Model_Fixture
->
loadEntity
(
$entityType
,
$values
);
->
loadEntity
(
$entityType
,
$values
);
}
}
$this
->
getResource
()
->
commit
();
$this
->
setStorageData
(
self
::
STORAGE_KEY_ENTITIES
,
array_keys
(
$entities
));
$this
->
setStorageData
(
self
::
STORAGE_KEY_ENTITIES
,
array_keys
(
$entities
));
return
$this
;
return
$this
;
...
@@ -667,6 +674,7 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -667,6 +674,7 @@ class EcomDev_PHPUnit_Model_Fixture
$ignoreCleanUp
=
$this
->
getStorageData
(
self
::
STORAGE_KEY_ENTITIES
,
self
::
SCOPE_SHARED
);
$ignoreCleanUp
=
$this
->
getStorageData
(
self
::
STORAGE_KEY_ENTITIES
,
self
::
SCOPE_SHARED
);
}
}
$this
->
getResource
()
->
beginTransaction
();
foreach
(
array_keys
(
$entities
)
as
$entityType
)
{
foreach
(
array_keys
(
$entities
)
as
$entityType
)
{
if
(
in_array
(
$entityType
,
$ignoreCleanUp
))
{
if
(
in_array
(
$entityType
,
$ignoreCleanUp
))
{
continue
;
continue
;
...
@@ -675,6 +683,8 @@ class EcomDev_PHPUnit_Model_Fixture
...
@@ -675,6 +683,8 @@ class EcomDev_PHPUnit_Model_Fixture
->
cleanEntity
(
$entityType
);
->
cleanEntity
(
$entityType
);
}
}
$this
->
getResource
()
->
commit
();
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