Bug 36317: Add unit test

If fails it shows :
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'itemnumber' in where clause is ambiguous at /kohadevbox/koha/Koha/Objects.pm line 399

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit d193455ec2)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Fridolin Somers 2024-03-18 15:18:27 +01:00 committed by Lucas Gass
parent 5e7e39e10d
commit a267e9a25d
1 changed files with 22 additions and 1 deletions

View File

@ -1230,7 +1230,7 @@ subtest 'get_marc_notes() UNIMARC tests' => sub {
};
subtest 'host_items() tests' => sub {
plan tests => 7;
plan tests => 8;
$schema->storage->txn_begin;
@ -1261,6 +1261,27 @@ subtest 'host_items() tests' => sub {
is_deeply( [ $host_items->get_column('itemnumber') ],
[ $host_item_1->itemnumber, $host_item_2->itemnumber ] );
my $transfer = $builder->build_object(
{
class => 'Koha::Item::Transfers',
value => {
itemnumber => $host_item_1->itemnumber,
frombranch => $host_item_1->holdingbranch,
}
}
);
ok(
$host_items->search(
{},
{
join => 'branchtransfers',
order_by => 'branchtransfers.daterequested'
}
)->as_list,
"host_items can be used with a join query on itemnumber"
);
$transfer->delete;
t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords', 0 );
$host_items = $biblio->host_items;
is( ref($host_items), 'Koha::Items' );