Koha/t/db_dependent/BiblioObject.t
Kyle M Hall 8db6b0f533 Bug 15586 - References to Koha::Branches remain in unit tests
The unit tests BiblioObject.t and Hold.t still have references to
Koha::Branches that need to be changed to Koha::Libraries. These tests
currently fail because of this.

Test Plan:
1) prove t/db_dependent/BiblioObject.t should fail
2) prove t/db_dependent/Hold.t should fail
3) Apply this patch
1) prove t/db_dependent/BiblioObject.t should pass
2) prove t/db_dependent/Hold.t should pass

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-01-19 12:32:39 +00:00

58 lines
1.9 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use C4::Context;
use C4::Biblio qw( AddBiblio );
use Koha::Database;
use Koha::Libraries;
use Koha::Borrowers;
use Test::More tests => 4;
use_ok('Koha::Biblio');
use_ok('Koha::Biblios');
my $schema = Koha::Database->new()->schema();
$schema->storage->txn_begin();
my $dbh = C4::Context->dbh;
$dbh->{RaiseError} = 1;
my @branches = Koha::Libraries->search();
my $borrower = Koha::Borrowers->search()->next();
my $biblio = MARC::Record->new();
$biblio->append_fields(
MARC::Field->new( '100', ' ', ' ', a => 'Hall, Kyle' ),
MARC::Field->new( '245', ' ', ' ', a => "Test Record", b => "Test Record Subtitle", b => "Another Test Record Subtitle" ),
);
my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $biblio, '' );
my $field_mappings = Koha::Database->new()->schema()->resultset('Fieldmapping');
$field_mappings->delete();
$field_mappings->create( { field => 'subtitle', fieldcode => '245', subfieldcode => 'b' } );
$biblio = Koha::Biblios->find( $biblionumber );
my @subtitles = $biblio->subtitles();
is( $subtitles[0], 'Test Record Subtitle', 'Got first subtitle correctly' );
is( $subtitles[1], 'Another Test Record Subtitle', 'Got second subtitle correctly' );
$schema->storage->txn_rollback();
1;