3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Test
::More tests
=> 2;
26 my $parsing_result = 'ok';
28 my $xml_simple = Test
::MockModule
->new('XML::Simple');
31 if ( $parsing_result eq 'error' ) {
39 use_ok
('Koha::Config');
41 subtest
'read_from_file() tests' => sub {
45 is
( Koha
::Config
->read_from_file(undef), undef,
46 "Undef parameter makes function return undef");
48 $parsing_result = 'ok';
50 my $result = Koha
::Config
->read_from_file("SomeFile.xml");
51 is
( $result, 'XML data', 'File read correctly' );
53 $parsing_result = 'error';
56 {$result = Koha
::Config
->read_from_file("SomeFile.xml")}
57 'Error reading file SomeFile.xml',
58 'File failing to read raises warning';
59 is
( $result, undef, 'Returns undef on error confition' );