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
316fd3e3
Commit
316fd3e3
authored
Oct 26, 2013
by
Mike Pretzlaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Container will flush an restore each fixture loader
parent
be87c2f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
3 deletions
+70
-3
app/code/community/EcomDev/PHPUnit/Model/Fixture/Loader/Container.php
...munity/EcomDev/PHPUnit/Model/Fixture/Loader/Container.php
+29
-1
app/code/community/EcomDev/PHPUnitTest/Test/Model/Fixture/Loader/Container.php
...omDev/PHPUnitTest/Test/Model/Fixture/Loader/Container.php
+41
-2
No files found.
app/code/community/EcomDev/PHPUnit/Model/Fixture/Loader/Container.php
View file @
316fd3e3
...
...
@@ -61,4 +61,32 @@ class EcomDev_PHPUnit_Model_Fixture_Loader_Container
{
return
isset
(
$this
->
_loaders
[
$code
]);
}
}
\ No newline at end of file
/**
* Flush all loader in this container.
*
* @return void
*/
public
function
flush
()
{
foreach
(
$this
->
_loaders
as
$loader
)
{
$loader
->
flush
();
}
}
/**
* Restore all loader in this container.
*
* @return void
*/
public
function
restore
()
{
foreach
(
$this
->
_loaders
as
$loader
)
{
$loader
->
restore
();
}
}
}
app/code/community/EcomDev/PHPUnitTest/Test/Model/Fixture/Loader/Container.php
View file @
316fd3e3
...
...
@@ -9,7 +9,7 @@ class EcomDev_PHPUnitTest_Test_Model_Fixture_Loader_Container
* @var EcomDev_PHPUnit_Model_Fixture_Loader_Container
*/
protected
$_factory
;
protected
function
setUp
()
{
$this
->
_factory
=
new
EcomDev_PHPUnit_Model_Fixture_Loader_Container
();
...
...
@@ -79,6 +79,45 @@ class EcomDev_PHPUnitTest_Test_Model_Fixture_Loader_Container
);
}
/**
* Check if the methods are forwarded by the collection to it's elements.
*
* @dataProvider getMethods
*
* @param string $methodName
* @param array $args []
*
* @return void
*/
public
function
testFlushAndRestoreWillBeForwardedToEachLoader
(
$methodName
,
$args
)
{
$loaderSet
=
$this
->
_stubLoaders
(
2
);
foreach
(
$loaderSet
as
$loader
)
{
/** @var PHPUnit_Framework_MockObject_MockObject $loader */
$loader
->
expects
(
$this
->
exactly
(
1
))
->
method
(
$methodName
);
}
$this
->
_factory
->
$methodName
();
}
/**
* Data provider for methods to check forwarding with.
*
* @see testFlushAndRestoreWillBeForwardedToEachLoader
*
* @return array
*/
public
function
getMethods
()
{
return
array
(
array
(
'flush'
,
array
()),
array
(
'restore'
,
array
()),
);
}
/**
* Generates loaders for tests
*
...
...
@@ -112,4 +151,4 @@ class EcomDev_PHPUnitTest_Test_Model_Fixture_Loader_Container
return
$loaders
;
}
}
\ 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