From 695f615b9f716ac79824a9fddca460b3ab1e8921 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 5 Nov 2014 15:14:12 -0500 Subject: [PATCH] Added test. --- .../unit-tests/src/VuFindTest/ExportTest.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/ExportTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/ExportTest.php index ca47fe44520..710f3dd1053 100644 --- a/module/VuFind/tests/unit-tests/src/VuFindTest/ExportTest.php +++ b/module/VuFind/tests/unit-tests/src/VuFindTest/ExportTest.php @@ -91,6 +91,45 @@ class ExportTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test XML case of process group + * + * @return void + */ + public function testProcessGroupXML() + { + $config = array( + 'foo' => array( + 'combineNamespaces' => array('marc21|http://www.loc.gov/MARC21/slim'), + 'combineXpath' => '/marc21:collection/marc21:record', + ), + ); + $this->assertEquals( + "<?xml version=\"1.0\"?>\n" + . '<collection xmlns="http://www.loc.gov/MARC21/slim">' + . '<record><id>a</id></record><record><id>b</id></record></collection>', + trim ( + $this->getExport(array(), $config)->processGroup( + 'foo', + array($this->getFakeMARCXML('a'), $this->getFakeMARCXML('b')) + ) + ) + ); + } + + /** + * Get a fake MARCXML record + * + * @param string $id ID to put in record. + * + * @return string + */ + public function getFakeMARCXML($id) + { + return '<collection xmlns="http://www.loc.gov/MARC21/slim"><record><id>' + . $id . '</id></record></collection>'; + } + /** * Get a configured Export object. * -- GitLab