Lines 26-35
Link Here
|
26 |
|
26 |
|
27 |
use Modern::Perl; |
27 |
use Modern::Perl; |
28 |
use File::Temp qw/tempfile/; |
28 |
use File::Temp qw/tempfile/; |
29 |
use Test::More tests => 5; |
29 |
use Test::More tests => 6; |
30 |
use Test::Warn; |
30 |
use Test::Warn; |
31 |
|
31 |
|
32 |
use t::lib::Mocks qw( mock_preference ); |
32 |
use t::lib::Mocks qw( mock_preference ); |
|
|
33 |
use t::lib::TestBuilder; |
33 |
|
34 |
|
34 |
use C4::Context; |
35 |
use C4::Context; |
35 |
use C4::Breeding; |
36 |
use C4::Breeding; |
Lines 37-42
use Koha::Database;
Link Here
|
37 |
use Koha::XSLT::Base; |
38 |
use Koha::XSLT::Base; |
38 |
|
39 |
|
39 |
my $schema = Koha::Database->new->schema; |
40 |
my $schema = Koha::Database->new->schema; |
|
|
41 |
my $builder = t::lib::TestBuilder->new; |
40 |
$schema->storage->txn_begin; |
42 |
$schema->storage->txn_begin; |
41 |
|
43 |
|
42 |
#Group 1: testing _build_query and _translate_query (part of Z3950Search) |
44 |
#Group 1: testing _build_query and _translate_query (part of Z3950Search) |
Lines 84-89
subtest ImportBreedingAuth => sub {
Link Here
|
84 |
isnt( $breedingid, $breedingid_2, "For a new record, we get a new id"); |
86 |
isnt( $breedingid, $breedingid_2, "For a new record, we get a new id"); |
85 |
}; |
87 |
}; |
86 |
|
88 |
|
|
|
89 |
subtest BreedingSearch => sub { |
90 |
plan tests => 5; |
91 |
|
92 |
my $import_biblio_1 = $builder->build({ source => 'ImportBiblio', value => { |
93 |
title => 'Unique title the first adventure', |
94 |
author => 'Firstnamey Surnamey', |
95 |
isbn => '1407239961' |
96 |
} |
97 |
}); |
98 |
my $import_biblio_2 = $builder->build({ source => 'ImportBiblio', value => { |
99 |
title => 'Unique title the adventure continues', |
100 |
author => 'Firstnamey Surnamey', |
101 |
isbn => '9798200834976' |
102 |
} |
103 |
}); |
104 |
|
105 |
my ($count, @results) = C4::Breeding::BreedingSearch("Firstnamey Surnamey"); |
106 |
is( $count, 2, "Author search returns two results"); |
107 |
|
108 |
($count, @results) = C4::Breeding::BreedingSearch("first adventure"); |
109 |
is( $count, 1, "Title search returns one result"); |
110 |
|
111 |
($count, @results) = C4::Breeding::BreedingSearch("adventure continues"); |
112 |
is( $count, 1, "Title search returns one result"); |
113 |
|
114 |
($count, @results) = C4::Breeding::BreedingSearch("9781407239965"); |
115 |
is( $count, 1, "ISBN search matches normalized DB value"); |
116 |
|
117 |
($count, @results) = C4::Breeding::BreedingSearch("9798200834976"); |
118 |
is( $count, 1, "ISBN search for 13 digit ISBN matches 13 digit ISBN in database"); |
119 |
# FIXME - Import doesn't currently store these, but this proves the search works |
120 |
}; |
121 |
|
87 |
$schema->storage->txn_rollback; |
122 |
$schema->storage->txn_rollback; |
88 |
|
123 |
|
89 |
#------------------------------------------------------------------------------- |
124 |
#------------------------------------------------------------------------------- |
90 |
- |
|
|