read configuration from koha-conf.xml
[virtual-ldap] / t / koha / 01-remove-test-user.t
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use Test::More tests => 6;
7 use Test::WWW::Mechanize;
8 use XML::Simple;
9 use Data::Dump qw(dump);
10
11 my $url =       $ENV{INTRANET}  || 'http://ffzg.koha-dev.rot13.org:8080';
12 my $koha_conf = $ENV{KOHA_CONF} || '/etc/koha/sites/ffzg/koha-conf.xml';
13
14 my $xml = XMLin( $koha_conf );
15 diag 'Koha config = ',dump $xml->{config};
16
17 our $config;
18 require 't/config.pl';
19 diag 'test config = ',dump $config;
20
21 my $mech = Test::WWW::Mechanize->new;
22
23 $mech->get_ok( $url, 'intranet' );
24
25 $mech->submit_form_ok({
26         fields => {
27                 userid   => $xml->{config}->{user},
28                 password => $xml->{config}->{pass},
29         },
30 }, "login $xml->{config}->{user}");
31
32 $mech->submit_form_ok({
33         form_number => 2,
34         fields => {
35                 member => 'kohatest@ffzg.hr',
36         },
37 }, 'find patron' );
38
39 #diag $mech->content;
40
41 $mech->follow_link_ok({ url_regex => qr/moremember/ }, 'details' );
42
43 my $html = $mech->content();
44
45 if ( $html =~ m{(/cgi-bin/koha/members/deletemem\.pl\?member=\d+)}s ) {
46         ok( $1, 'found deletemem' );
47         $mech->get_ok( $url . $1 );
48 }