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

(-)a/t/db_dependent/Suggestions.t (-2 / +34 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use DateTime::Duration;
20
use DateTime::Duration;
21
use Test::More tests => 113;
21
use Test::More tests => 114;
22
use Test::Warn;
22
use Test::Warn;
23
23
24
use t::lib::Mocks;
24
use t::lib::Mocks;
Lines 145-150 my $my_suggestion_with_budget2 = { Link Here
145
    note          => 'my note',
145
    note          => 'my note',
146
    budgetid      => $budget_id,
146
    budgetid      => $budget_id,
147
};
147
};
148
my $my_suggestion_without_suggestedby = {
149
    title         => 'my title',
150
    author        => 'my author',
151
    publishercode => 'my publishercode',
152
    suggestedby   => undef,
153
    biblionumber  => $biblio_1->biblionumber,
154
    branchcode    => 'CPL',
155
    managedby     => '',
156
    manageddate   => '',
157
    accepteddate  => dt_from_string,
158
    note          => 'my note',
159
    quantity      => '', # Insert an empty string into int to catch strict SQL modes errors
160
};
148
161
149
is( CountSuggestion(), 0, 'CountSuggestion without the status returns 0' );
162
is( CountSuggestion(), 0, 'CountSuggestion without the status returns 0' );
150
is( CountSuggestion('ASKED'), 0, 'CountSuggestion returns the correct number of suggestions' );
163
is( CountSuggestion('ASKED'), 0, 'CountSuggestion returns the correct number of suggestions' );
Lines 627-630 subtest 'EmailPurchaseSuggestions' => sub { Link Here
627
        'suggestions@b.c', 'EmailAddressForSuggestions uses EmailAddressForSuggestions when set' );
640
        'suggestions@b.c', 'EmailAddressForSuggestions uses EmailAddressForSuggestions when set' );
628
};
641
};
629
642
643
subtest 'ModSuggestion should work on suggestions without a suggester' => sub {
644
    plan tests => 2;
645
646
    $dbh->do(q|DELETE FROM suggestions|);
647
    my $my_suggestionid = NewSuggestion($my_suggestion_without_suggestedby);
648
    $suggestion = GetSuggestion($my_suggestionid);
649
    is( $suggestion->{suggestedby}, undef, "Suggestedby is undef" );
650
651
    ModSuggestion(
652
        {
653
            suggestionid => $my_suggestionid,
654
            STATUS       => 'CHECKED',
655
            note         => "Test note"
656
        }
657
    );
658
    $suggestion = GetSuggestion($my_suggestionid);
659
660
    is( $suggestion->{note}, "Test note", "ModSuggestion works on suggestions without a suggester" );
661
};
662
630
$schema->storage->txn_rollback;
663
$schema->storage->txn_rollback;
631
- 

Return to bug 22778