Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
M2 content provisioning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TechDivision Public
M2 content provisioning
Commits
1f079b85
Commit
1f079b85
authored
5 years ago
by
Vadim Justus
Browse files
Options
Downloads
Patches
Plain Diff
#22
Reproduce issue in integration test
parent
18d91072
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!23
Reproducing issue #22 with tests
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Model/Config/Parser/ParserChain.php
+4
-2
4 additions, 2 deletions
Model/Config/Parser/ParserChain.php
Test/Integration/Model/Config/Parser/Query/FetchMediaFilesChainTest.php
+66
-0
66 additions, 0 deletions
...on/Model/Config/Parser/Query/FetchMediaFilesChainTest.php
with
70 additions
and
2 deletions
Model/Config/Parser/ParserChain.php
+
4
−
2
View file @
1f079b85
...
...
@@ -39,9 +39,11 @@ class ParserChain implements ConfigParserInterface
public
function
execute
(
DOMElement
$element
):
array
{
$data
=
[];
foreach
(
$this
->
parser
as
$parser
)
{
$data
=
array_merge
(
$data
,
$parser
->
execute
(
$element
)
)
;
$data
[]
=
$parser
->
execute
(
$element
);
}
return
$data
;
return
array_merge
(
...
$data
);
}
}
This diff is collapsed.
Click to expand it.
Test/Integration/Model/Config/Parser/Query/FetchMediaFilesChainTest.php
0 → 100644
+
66
−
0
View file @
1f079b85
<?php
declare
(
strict_types
=
1
);
namespace
Firegento\ContentProvisioning\Test\Integration\Model\Config\Parser\Query
;
use
Firegento\ContentProvisioning\Api\MediaFilesParserInterface
;
use
Firegento\ContentProvisioning\Model\Config\Parser\Query\FetchMediaFilesChain
;
use
PHPUnit\Framework\MockObject\MockObject
;
class
FetchMediaFilesChainTest
extends
\PHPUnit\Framework\TestCase
{
/**
* @var FetchMediaFilesChain
*/
private
$chain
;
/**
* @var MediaFilesParserInterface|MockObject
*/
private
$parser1
;
/**
* @var MediaFilesParserInterface|MockObject
*/
private
$parser2
;
protected
function
setUp
()
{
$this
->
parser1
=
self
::
getMockBuilder
(
MediaFilesParserInterface
::
class
)
->
disableOriginalConstructor
()
->
getMock
();
$this
->
parser2
=
self
::
getMockBuilder
(
MediaFilesParserInterface
::
class
)
->
disableOriginalConstructor
()
->
getMock
();
$this
->
chain
=
\Magento\TestFramework\Helper\Bootstrap
::
getObjectManager
()
->
create
(
FetchMediaFilesChain
::
class
,
[
'parsers'
=>
[
$this
->
parser1
,
$this
->
parser2
,
]]);
}
public
function
testMergingData
()
{
$this
->
parser1
->
method
(
'execute'
)
->
willReturn
([
'path/to/file1.png'
,
'path/to/file2.png'
,
'file3.png'
,
]);
$this
->
parser2
->
method
(
'execute'
)
->
willReturn
([
'file3.png'
,
'some/other/path.jpg'
,
]);
$result
=
$this
->
chain
->
execute
(
''
);
$this
->
assertSame
([
'path/to/file1.png'
,
'path/to/file2.png'
,
'file3.png'
,
'file3.png'
,
'some/other/path.jpg'
,
],
$result
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment