|
1
|
|
|
<?php |
|
2
|
|
|
namespace EWW\Dpf\Tests\Unit\Services; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
use Nimut\TestingFramework\TestCase\UnitTestCase; |
|
|
|
|
|
|
18
|
|
|
include_once 'Classes/Services/XPathXMLGenerator.php'; |
|
19
|
|
|
|
|
20
|
|
|
class XPathXMLGeneratorTest extends UnitTestCase |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var XPathXMLGenerator |
|
25
|
|
|
*/ |
|
26
|
|
|
private $xpathGenerator = null; |
|
27
|
|
|
|
|
28
|
|
|
protected function setUp() { |
|
29
|
|
|
$this->xpathGenerator = new \EWW\Dpf\Services\XPathXMLGenerator(); |
|
|
|
|
|
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @test |
|
34
|
|
|
*/ |
|
35
|
|
|
public function testXMLGeneration1() |
|
36
|
|
|
{ |
|
37
|
|
|
$xpath = 'mods:name[mods:role/mods:roleTerm[@type="code"][@authority="marcrelator"]="edt"]/mods:displayForm'; |
|
38
|
|
|
$expectedXml = '<mods:name><mods:role><mods:roleTerm type="code" authority="marcrelator">edt</mods:roleTerm></mods:role><mods:displayForm/></mods:name>'; |
|
39
|
|
|
|
|
40
|
|
|
$this->xpathGenerator->loop($xpath); |
|
41
|
|
|
|
|
42
|
|
|
$this->assertEquals( |
|
43
|
|
|
$expectedXml, |
|
44
|
|
|
$this->xpathGenerator->getXML() |
|
45
|
|
|
); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @test |
|
50
|
|
|
*/ |
|
51
|
|
|
public function testXMLGeneration2() |
|
52
|
|
|
{ |
|
53
|
|
|
$xpath = 'mods:language/mods:languageTerm[@authority="iso639-2b"][@type="code"]="ger"'; |
|
54
|
|
|
$expectedXml = '<mods:language><mods:languageTerm authority="iso639-2b" type="code">ger</mods:languageTerm></mods:language>'; |
|
55
|
|
|
|
|
56
|
|
|
$this->xpathGenerator->loop($xpath); |
|
57
|
|
|
|
|
58
|
|
|
$this->assertEquals( |
|
59
|
|
|
$expectedXml, |
|
60
|
|
|
$this->xpathGenerator->getXML() |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @test |
|
66
|
|
|
*/ |
|
67
|
|
|
public function testXMLGeneration3() |
|
68
|
|
|
{ |
|
69
|
|
|
$xpath = 'mods:originInfo[@eventType="publication"]'; |
|
70
|
|
|
$expectedXml = '<mods:originInfo eventType="publication"/>'; |
|
71
|
|
|
|
|
72
|
|
|
$this->xpathGenerator->loop($xpath); |
|
73
|
|
|
|
|
74
|
|
|
$this->assertEquals( |
|
75
|
|
|
$expectedXml, |
|
76
|
|
|
$this->xpathGenerator->getXML() |
|
77
|
|
|
); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
|
|
81
|
|
|
|
|
82
|
|
|
} |
|
83
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths