View | Details | Raw Unified | Return to bug 13937
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Z3950Responder/GenericSession.t (-4 / +8 lines)
Lines 7-12 use Test::WWW::Mechanize; Link Here
7
use t::lib::Mocks qw(mock_preference);
7
use t::lib::Mocks qw(mock_preference);
8
8
9
use File::Basename;
9
use File::Basename;
10
use File::Copy;
10
use XML::LibXML;
11
use XML::LibXML;
11
use YAML;
12
use YAML;
12
use ZOOM;
13
use ZOOM;
Lines 81-90 subtest 'test_search' => sub { Link Here
81
    $child = fork();
82
    $child = fork();
82
    if ($child == 0) {
83
    if ($child == 0) {
83
        my $config_dir = dirname(__FILE__) . '/';
84
        my $config_dir = dirname(__FILE__) . '/';
85
        # Copy pqf.properties from etc/z3950
86
        copy($config_dir . '../../../../etc/z3950/pqf.properties', $config_dir . 'pqf.properties') || die "Copying pqf.properties failed: $!";
84
        my $z = Koha::Z3950Responder->new( {
87
        my $z = Koha::Z3950Responder->new( {
85
            config_dir => $config_dir
88
            config_dir => $config_dir
86
        });
89
        });
87
        $z->start();
90
        $z->start();
91
        unlink($config_dir . 'pqf.properties');
88
        exit;
92
        exit;
89
    }
93
    }
90
    sleep(1);
94
    sleep(1);
Lines 116-136 subtest 'test_search' => sub { Link Here
116
120
117
    # SRU protocol tests
121
    # SRU protocol tests
118
    my $base = 'http://localhost:42111';
122
    my $base = 'http://localhost:42111';
119
    my $ns = 'http://docs.oasis-open.org/ns/search-ws/sruResponse';
123
    my $ns = 'http://www.loc.gov/zing/srw/';
120
    my $marc_ns = 'http://www.loc.gov/MARC21/slim';
124
    my $marc_ns = 'http://www.loc.gov/MARC21/slim';
121
    my $agent = Test::WWW::Mechanize->new( autocheck => 1 );
125
    my $agent = Test::WWW::Mechanize->new( autocheck => 1 );
122
126
123
    $agent->get_ok("$base", 'Retrieve explain response');
127
    $agent->get_ok("$base?version=1.1", 'Retrieve explain response');
124
    my $dom = XML::LibXML->load_xml(string => $agent->content());
128
    my $dom = XML::LibXML->load_xml(string => $agent->content());
125
    my @nodes = $dom->getElementsByTagNameNS($ns, 'explainResponse');
129
    my @nodes = $dom->getElementsByTagNameNS($ns, 'explainResponse');
126
    is(scalar(@nodes), 1, 'explainResponse returned');
130
    is(scalar(@nodes), 1, 'explainResponse returned');
127
131
128
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&maximumRecords=10&query=", 'Try bad search query');
132
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&version=1.1&maximumRecords=10&query=", 'Try bad search query');
129
    $dom = XML::LibXML->load_xml(string => $agent->content());
133
    $dom = XML::LibXML->load_xml(string => $agent->content());
130
    @nodes = $dom->getElementsByTagNameNS($ns, 'diagnostics');
134
    @nodes = $dom->getElementsByTagNameNS($ns, 'diagnostics');
131
    is(scalar(@nodes), 1, 'diagnostics returned for bad query');
135
    is(scalar(@nodes), 1, 'diagnostics returned for bad query');
132
136
133
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&maximumRecords=10&query=(dc.author%3dauthor AND (dc.title%3d\"title(s)\" OR dc.title%3danother))", 'Retrieve search results');
137
    $agent->get_ok("$base/biblios?operation=searchRetrieve&recordSchema=marcxml&version=1.1&maximumRecords=10&query=(dc.author%3dauthor AND (dc.title%3d\"title(s)\" OR dc.title%3danother))", 'Retrieve search results');
134
    $dom = XML::LibXML->load_xml(string => $agent->content());
138
    $dom = XML::LibXML->load_xml(string => $agent->content());
135
    @nodes = $dom->getElementsByTagNameNS($ns, 'searchRetrieveResponse');
139
    @nodes = $dom->getElementsByTagNameNS($ns, 'searchRetrieveResponse');
136
    is(scalar(@nodes), 1, 'searchRetrieveResponse returned');
140
    is(scalar(@nodes), 1, 'searchRetrieveResponse returned');
(-)a/t/db_dependent/Koha/Z3950Responder/Session2.t (-1 / +7 lines)
Lines 5-10 use Test::More tests => 3; Link Here
5
use t::lib::TestBuilder;
5
use t::lib::TestBuilder;
6
use C4::Items;
6
use C4::Items;
7
7
8
use Koha::Caches;
9
8
BEGIN {
10
BEGIN {
9
    use_ok('Koha::Z3950Responder');
11
    use_ok('Koha::Z3950Responder');
10
    use_ok('Koha::Z3950Responder::Session');
12
    use_ok('Koha::Z3950Responder::Session');
Lines 20-26 subtest 'add_item_status' => sub { Link Here
20
    plan tests => 2;
22
    plan tests => 2;
21
23
22
    # This time we are sustituting some values
24
    # This time we are sustituting some values
23
    $builder->schema->resultset( 'AuthorisedValue' )->delete_all;
25
    $builder->schema->resultset( 'AuthorisedValue' )->delete_all();
24
    $builder->build({
26
    $builder->build({
25
        source => 'AuthorisedValue',
27
        source => 'AuthorisedValue',
26
        value => {
28
        value => {
Lines 37-42 subtest 'add_item_status' => sub { Link Here
37
            lib => "Borked completely"
39
            lib => "Borked completely"
38
        }
40
        }
39
    });
41
    });
42
    
43
    # Clear the cache to make sure the above values take effect
44
    my $cache = Koha::Caches->get_instance();
45
    $cache->flush_all();
40
46
41
    ## FIRST ITEM HAS ALL THE STATUSES ##
47
    ## FIRST ITEM HAS ALL THE STATUSES ##
42
    my $item_1 = $builder->build({
48
    my $item_1 = $builder->build({
(-)a/t/db_dependent/Koha/Z3950Responder/config.xml (-2 / +1 lines)
Lines 1-7 Link Here
1
<yazgfs>
1
<yazgfs>
2
  <listen id="public">tcp:localhost:42111</listen>
2
  <listen id="public">tcp:localhost:42111</listen>
3
  <server>
3
  <server>
4
    <cql2rpn>../../../../etc/z3950/pqf.properties</cql2rpn>
4
    <cql2rpn>pqf.properties</cql2rpn>
5
    <explain xmlns="http://explain.z3950.org/dtd/2.0/">
5
    <explain xmlns="http://explain.z3950.org/dtd/2.0/">
6
      <retrievalinfo>
6
      <retrievalinfo>
7
        <retrieval syntax="usmarc" name="marc21"/>
7
        <retrieval syntax="usmarc" name="marc21"/>
8
- 

Return to bug 13937