Lines 147-157
$schema->storage->txn_rollback;
Link Here
|
147 |
|
147 |
|
148 |
subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub { |
148 |
subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub { |
149 |
|
149 |
|
150 |
plan tests => 20; |
150 |
plan tests => 23; |
151 |
|
151 |
|
152 |
$schema->storage->txn_begin; |
152 |
$schema->storage->txn_begin; |
153 |
|
153 |
|
154 |
my $biblio = $builder->build_sample_biblio; |
154 |
my $biblio = $builder->build_sample_biblio; |
|
|
155 |
my $biblio2 = $builder->build_sample_biblio; |
155 |
|
156 |
|
156 |
# Have two known libraries for testing purposes |
157 |
# Have two known libraries for testing purposes |
157 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
158 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
Lines 174-179
subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub {
Link Here
|
174 |
like( $xml, qr{<homebranch>$library_1_name</homebranch>}, '$item_1 present in the XML' ); |
175 |
like( $xml, qr{<homebranch>$library_1_name</homebranch>}, '$item_1 present in the XML' ); |
175 |
like( $xml, qr{<homebranch>$library_2_name</homebranch>}, '$item_2 present in the XML' ); |
176 |
like( $xml, qr{<homebranch>$library_2_name</homebranch>}, '$item_2 present in the XML' ); |
176 |
unlike( $xml, qr{<homebranch>$library_3_name</homebranch>}, '$item_3 not present in the XML' ); |
177 |
unlike( $xml, qr{<homebranch>$library_3_name</homebranch>}, '$item_3 not present in the XML' ); |
|
|
178 |
|
179 |
my $mocked_context = Test::MockModule->new('C4::Context'); |
180 |
$mocked_context->mock( 'yaml_preference', sub { |
181 |
return { biblionumber => [ $biblio2->biblionumber ] }; |
182 |
}); |
183 |
my $hid_rs = $biblio->items->search({ "me.itemnumber" => { '!=' => $item_3->itemnumber } })->filter_by_visible_in_opac(); |
184 |
$xml = C4::XSLT::buildKohaItemsNamespace( $biblio->biblionumber, undef, $hid_rs ); |
185 |
like( $xml, qr{<homebranch>$library_1_name</homebranch>}, '$item_1 present in the XML' ); |
186 |
like( $xml, qr{<homebranch>$library_2_name</homebranch>}, '$item_2 present in the XML' ); |
187 |
unlike( $xml, qr{<homebranch>$library_3_name</homebranch>}, '$item_3 not present in the XML' ); |
188 |
|
177 |
## Test passing one item in hidden_items and items_rs |
189 |
## Test passing one item in hidden_items and items_rs |
178 |
$xml = C4::XSLT::buildKohaItemsNamespace( $biblio->biblionumber, [ $item_1->itemnumber ], $items_rs->reset ); |
190 |
$xml = C4::XSLT::buildKohaItemsNamespace( $biblio->biblionumber, [ $item_1->itemnumber ], $items_rs->reset ); |
179 |
|
191 |
|
180 |
- |
|
|