3 # Copyright 2015 Koha Development team
5 # This file is part of Koha
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 use Test
::More tests
=> 3;
22 use Koha
::BiblioFramework
;
23 use Koha
::BiblioFrameworks
;
25 my $schema = Koha
::Database
->new->schema;
26 $schema->storage->txn_begin;
28 my $nb_of_frameworks = Koha
::BiblioFrameworks
->search->count;
29 my $new_framework_1 = Koha
::BiblioFramework
->new({
30 frameworkcode
=> 'mfw1',
31 frameworktext
=> 'my_frameworktext_for_fw_1',
33 my $new_framework_2 = Koha
::BiblioFramework
->new({
34 frameworkcode
=> 'mfw2',
35 frameworktext
=> 'my_frameworktext_for_fw_2',
38 is
( Koha
::BiblioFrameworks
->search->count, $nb_of_frameworks + 2, 'The 2 biblio frameworks should have been added' );
40 my $retrieved_framework_1 = Koha
::BiblioFrameworks
->find( $new_framework_1->frameworkcode );
41 is
( $retrieved_framework_1->frameworktext, $new_framework_1->frameworktext, 'Find a biblio framework by frameworkcode should return the correct framework' );
43 $retrieved_framework_1->delete;
44 is
( Koha
::BiblioFrameworks
->search->count, $nb_of_frameworks + 1, 'Delete should have deleted the biblio framework' );
45 $schema->storage->txn_rollback;