View | Details | Raw Unified | Return to bug 18247
Collapse All | Expand All

(-)a/t/db_dependent/AuthorisedValues.t (-2 / +25 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 15;
4
use Test::More tests => 17;
5
5
6
use C4::Context;
6
use C4::Context;
7
use Koha::AuthorisedValue;
7
use Koha::AuthorisedValue;
Lines 20-25 $dbh->do("DELETE FROM authorised_value_categories"); Link Here
20
Koha::AuthorisedValueCategory->new({ category_name => 'av_for_testing' })->store;
20
Koha::AuthorisedValueCategory->new({ category_name => 'av_for_testing' })->store;
21
Koha::AuthorisedValueCategory->new({ category_name => 'aaav_for_testing' })->store;
21
Koha::AuthorisedValueCategory->new({ category_name => 'aaav_for_testing' })->store;
22
Koha::AuthorisedValueCategory->new({ category_name => 'restricted_for_testing' })->store;
22
Koha::AuthorisedValueCategory->new({ category_name => 'restricted_for_testing' })->store;
23
Koha::AuthorisedValueCategory->new({ category_name => 'CCODE' })->store;
24
23
my $av1 = Koha::AuthorisedValue->new(
25
my $av1 = Koha::AuthorisedValue->new(
24
    {
26
    {
25
        category         => 'av_for_testing',
27
        category         => 'av_for_testing',
Lines 76-81 my $av_0 = Koha::AuthorisedValue->new( Link Here
76
    }
78
    }
77
)->store();
79
)->store();
78
80
81
my $CatAuthValue = Koha::AuthorisedValue->new(
82
   {
83
       category         => 'CCODE',
84
       authorised_value => 'value 5',
85
   }
86
)->store();
87
79
ok( $av1->id(), 'AV 1 is inserted' );
88
ok( $av1->id(), 'AV 1 is inserted' );
80
ok( $av2->id(), 'AV 2 is inserted' );
89
ok( $av2->id(), 'AV 2 is inserted' );
81
ok( $av3->id(), 'AV 3 is inserted' );
90
ok( $av3->id(), 'AV 3 is inserted' );
Lines 114-120 my $limits = $av1->branch_limitations; Link Here
114
is( @$limits, 2, 'branch_limitations functions correctly both as setter and getter' );
123
is( @$limits, 2, 'branch_limitations functions correctly both as setter and getter' );
115
124
116
my @categories = Koha::AuthorisedValues->new->categories;
125
my @categories = Koha::AuthorisedValues->new->categories;
117
is( @categories, 3, 'There should have 2 categories inserted' );
126
is( @categories, 4, 'There should have 4 categories inserted' );
118
is( $categories[0], $av4->category, 'The first category should be correct (ordered by category name)' );
127
is( $categories[0], $av4->category, 'The first category should be correct (ordered by category name)' );
119
is( $categories[1], $av1->category, 'The second category should be correct (ordered by category name)' );
128
is( $categories[1], $av1->category, 'The second category should be correct (ordered by category name)' );
120
129
Lines 225-227 subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { Link Here
225
        );
234
        );
226
    };
235
    };
227
};
236
};
237
238
ok( $CatAuthValue->id(), 'CatAuthValue is inserted' );
239
240
sub GetCatAuthValues {
241
    my $dbh = C4::Context->dbh;
242
    my $sth = $dbh->prepare('SELECT authorised_value AS ccode FROM authorised_values WHERE category = "CCODE"');
243
    $sth->execute();
244
    return $sth->rows;
245
}
246
247
my $AuthValues = GetCatAuthValues();
248
is($AuthValues, 1, "Correct number of authorised_value's with category=CCODE");
249
250
(-)a/t/db_dependent/Koha/ItemTypes.t (-1 / +11 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 18;
22
use Test::More tests => 19;
23
use Data::Dumper;
23
use Data::Dumper;
24
use Koha::Database;
24
use Koha::Database;
25
25
Lines 76-79 is( $type->summary, 'summary', 'summary' ); Link Here
76
is( $type->checkinmsg,     'checkinmsg',     'checkinmsg' );
76
is( $type->checkinmsg,     'checkinmsg',     'checkinmsg' );
77
is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' );
77
is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' );
78
78
79
sub GetItemTypes {
80
    my $dbh = C4::Context->dbh;
81
    my $sth = $dbh->prepare('SELECT itemtype FROM itemtypes');
82
    $sth->execute();
83
    return $sth->rows;
84
}
85
86
my $ItemTypes = GetItemTypes();
87
is($ItemTypes,10, "Correct number of itemtypes");
88
79
$schema->txn_rollback;
89
$schema->txn_rollback;
(-)a/t/db_dependent/Koha/Libraries.t (-2 / +12 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 9;
22
use Test::More tests => 10;
23
23
24
use Koha::Library;
24
use Koha::Library;
25
use Koha::Libraries;
25
use Koha::Libraries;
Lines 86-90 is( Koha::Libraries->search->count, $nb_of_libraries + 1, 'Delete should have de Link Here
86
$retrieved_category_2->delete;
86
$retrieved_category_2->delete;
87
is( Koha::LibraryCategories->search->count, $nb_of_categories + 2, 'Delete should have deleted the library category' );
87
is( Koha::LibraryCategories->search->count, $nb_of_categories + 2, 'Delete should have deleted the library category' );
88
88
89
sub GetBranchCodes {
90
    my $dbh = C4::Context->dbh;
91
    my $query = qq{ SELECT branchcode FROM branches };
92
    my $sth = $dbh->prepare($query);
93
    $sth->execute();
94
    return $sth->rows;
95
}
96
97
my $BranchCodes = GetBranchCodes();
98
is($BranchCodes, 13, "Correct number of branchcodes");
99
89
$schema->storage->txn_rollback;
100
$schema->storage->txn_rollback;
90
1;
101
1;
91
- 

Return to bug 18247