From 09a3ae2c1eb904fe03dc41bf71d57fc419bb04b3 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 3 Mar 2017 16:03:30 -0500 Subject: [PATCH] LP#1442276 pgTAP test for oils_xslt_process In moving from the deprecated XML::LibXSLT::output_string() to output_as_chars(), add a regression test to ensure that we do not suffer from corrputed encoding output in the future. We test both the case where an output encoding has been explicitly declared, as well as the case where an output encoding has not been explicitly declared. It was this subtle difference that was causing the problem with output_string(). Signed-off-by: Dan Scott Signed-off-by: Kathy Lussier --- .../Pg/t/regress/lp1442276_oils_xslt_encoding.pg | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/t/regress/lp1442276_oils_xslt_encoding.pg diff --git a/Open-ILS/src/sql/Pg/t/regress/lp1442276_oils_xslt_encoding.pg b/Open-ILS/src/sql/Pg/t/regress/lp1442276_oils_xslt_encoding.pg new file mode 100644 index 0000000000..628b1346a9 --- /dev/null +++ b/Open-ILS/src/sql/Pg/t/regress/lp1442276_oils_xslt_encoding.pg @@ -0,0 +1,45 @@ +BEGIN; + +SELECT plan(2); + +INSERT INTO biblio.record_entry(id, last_xact_id, marc) VALUES +(999999999, 'pgtap', '01750 am a2200481Ia 45002784593CONIFER20121031173514.0121026s2012 ja ac 001 0beng d2760550060Association d''économie politique.Syndicalisme et sociétéSillery [Que.] :Presses de l''Université du Québec,1988.209 p. ;29 cm.SyndicalismPolitical aspectsQuébec (Province)Congresses.5894462OCoLC2784593biblio') +; +INSERT INTO config.xml_transform(name, namespace_uri, prefix, xslt) VALUES ( +'testdeclaration', 'http://example.org/testdeclaration', 'testdeclaration', $$ + + + + + + <xsl:value-of select="text()" /> + + + +$$ +),('testnodeclaration', 'http://example.org/testnodeclaration', 'testnodeclaration', +$$ + + + + + <xsl:value-of select="text()" /> + + + +$$ +); + +SELECT is(evergreen.oils_xslt_process(bre.marc, cxt.xslt), $$ +Syndicalisme et société +$$, 'Is our XSLT output corrupted?') FROM biblio.record_entry bre, config.xml_transform cxt WHERE bre.id = 999999999 AND cxt.name = 'testdeclaration'; + +SELECT is(evergreen.oils_xslt_process(bre.marc, cxt.xslt), $$ +Syndicalisme et société +$$, 'Is our XSLT output corrupted?') FROM biblio.record_entry bre, config.xml_transform cxt WHERE bre.id = 999999999 AND cxt.name = 'testnodeclaration'; + +ROLLBACK; -- 2.11.0