fix(test): Refactored PearPackageXmlParserTest
@@ -48,8 +48,7 @@ class PearPackageXmlParserTest {
}
void parse(boolean includeDoctype) throws IOException, SAXException, ParserConfigurationException {
- final String samplePackageXml = (includeDoctype ? "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n" : "")
- + "<package>\n"
+ String samplePackageXml = "<package>\n"
+ " <name>test-name</name>\n"
+ " <version>\n"
+ " <release>1.1.1</release>\n"
@@ -57,6 +56,10 @@ class PearPackageXmlParserTest {
+ " </version>\n"
+ "</package>";
+ if (includeDoctype) {
+ samplePackageXml = "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n" + samplePackageXml;
+ }
+
final InputStream inputStream = IOUtils.toInputStream(samplePackageXml, StandardCharsets.UTF_8);
final NameVersion nameVersion = pearPackageXmlParser.parse(inputStream);
