Lines 25-31
use Test::More tests => 13;
Link Here
|
25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
26 |
use Test::Warn; |
26 |
use Test::Warn; |
27 |
use DateTime; |
27 |
use DateTime; |
28 |
use Capture::Tiny ':all'; |
|
|
29 |
use XML::Simple; |
28 |
use XML::Simple; |
30 |
use t::lib::Mocks; |
29 |
use t::lib::Mocks; |
31 |
|
30 |
|
Lines 74-81
t::lib::Mocks::mock_preference('OAI-PMH:MaxCount', 3);
Link Here
|
74 |
t::lib::Mocks::mock_preference('OAI-PMH:DeletedRecord', 'persistent'); |
73 |
t::lib::Mocks::mock_preference('OAI-PMH:DeletedRecord', 'persistent'); |
75 |
|
74 |
|
76 |
%param = ( verb => 'ListMetadataFormats' ); |
75 |
%param = ( verb => 'ListMetadataFormats' ); |
77 |
my ($response) = capture { Koha::OAI::Server::Repository->new(); }; |
76 |
my $response; |
78 |
$response = XMLin($response); |
77 |
my $get_response = sub { |
|
|
78 |
my $stdout; |
79 |
local *STDOUT; |
80 |
open STDOUT, '>', \$stdout; |
81 |
Koha::OAI::Server::Repository->new(); |
82 |
$response = XMLin($stdout); |
83 |
}; |
84 |
$get_response->(); |
79 |
my $now = DateTime->now . 'Z'; |
85 |
my $now = DateTime->now . 'Z'; |
80 |
my $expected = { |
86 |
my $expected = { |
81 |
request => 'http://localhost', |
87 |
request => 'http://localhost', |
Lines 101-108
my $expected = {
Link Here
|
101 |
is_deeply($response, $expected, "ListMetadataFormats"); |
107 |
is_deeply($response, $expected, "ListMetadataFormats"); |
102 |
|
108 |
|
103 |
%param = ( verb => 'ListIdentifiers' ); |
109 |
%param = ( verb => 'ListIdentifiers' ); |
104 |
($response) = capture { Koha::OAI::Server::Repository->new(); }; |
110 |
$get_response->(); |
105 |
$response = XMLin($response); |
|
|
106 |
$now = DateTime->now . 'Z'; |
111 |
$now = DateTime->now . 'Z'; |
107 |
$expected = { |
112 |
$expected = { |
108 |
request => 'http://localhost', |
113 |
request => 'http://localhost', |
109 |
- |
|
|