[Koha-patches] [PATCH] Bug 10398 - Provide xml_valid.t for checking XML validity

Tomas Cohen Arazi tomascohen at gmail.com
Mon Jun 3 20:15:09 CEST 2013


This patch adds a script that checks every XML file in Koha's source tree using xmllint.
To test:
 - Run find . -name '*.xml'
 - Apply the patch, and run prove -v xt/xml_valid.t
 - Verify every xml file was tested.

Regards
To+

Sponsored-by: Universidad Nacional de Córdoba
---
 xt/xml_valid.t |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100755 xt/xml_valid.t

diff --git a/xt/xml_valid.t b/xt/xml_valid.t
new file mode 100755
index 0000000..6caca6c
--- /dev/null
+++ b/xt/xml_valid.t
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2013 Universidad Nacional de Cordoba
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+use Test::More;
+
+BEGIN {
+    use FindBin;
+    eval { require "$FindBin::Bin/../misc/kohalib.pl" };
+}
+
+my $filebase = "$FindBin::Bin/..";
+my @files    = `find $filebase -name '*.xml'`;
+my @command  = qw(xmllint --noout);
+
+plan tests => scalar @files;
+
+foreach my $file (@files) {
+    chomp $file;
+    ok(system(@command, "$file") == 0, "XML validation for $file");
+}
+
+=head1 NAME
+
+xml_valid.t
+
+=head1 DESCRIPTION
+
+Tests every XML file inside Koha is valid using xmllint.
+
+=head1 USAGE
+
+From everywhere:
+
+prove xt/xml_valid.t
+
+=cut
-- 
1.7.9.5



More information about the Koha-patches mailing list