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

_______________________________________________
Koha-patches mailing list
Koha-patches@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to