|
Lines 18-24
Link Here
|
| 18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use Test::More tests => 73; |
21 |
use Test::More tests => 74; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
|
24 |
|
|
Lines 210-223
my $externalid = 'my external id';
Link Here
|
| 210 |
my $alert_id = C4::Letters::addalert($borrowernumber, $type, $externalid); |
210 |
my $alert_id = C4::Letters::addalert($borrowernumber, $type, $externalid); |
| 211 |
isnt( $alert_id, undef, 'addalert does not return undef' ); |
211 |
isnt( $alert_id, undef, 'addalert does not return undef' ); |
| 212 |
|
212 |
|
| 213 |
my $alerts = C4::Letters::getalert($borrowernumber); |
213 |
|
|
|
214 |
# getalert |
| 215 |
my $alerts = C4::Letters::getalert(); |
| 216 |
is( @$alerts, 1, 'addalert should not fail without parameter' ); |
| 217 |
$alerts = C4::Letters::getalert($borrowernumber); |
| 214 |
is( @$alerts, 1, 'addalert adds an alert' ); |
218 |
is( @$alerts, 1, 'addalert adds an alert' ); |
| 215 |
is( $alerts->[0]->{alertid}, $alert_id, 'addalert returns the alert id correctly' ); |
219 |
is( $alerts->[0]->{alertid}, $alert_id, 'addalert returns the alert id correctly' ); |
| 216 |
is( $alerts->[0]->{type}, $type, 'addalert stores the type correctly' ); |
220 |
is( $alerts->[0]->{type}, $type, 'addalert stores the type correctly' ); |
| 217 |
is( $alerts->[0]->{externalid}, $externalid, 'addalert stores the externalid correctly' ); |
221 |
is( $alerts->[0]->{externalid}, $externalid, 'addalert stores the externalid correctly' ); |
| 218 |
|
222 |
|
| 219 |
|
|
|
| 220 |
# getalert |
| 221 |
$alerts = C4::Letters::getalert($borrowernumber, $type); |
223 |
$alerts = C4::Letters::getalert($borrowernumber, $type); |
| 222 |
is( @$alerts, 1, 'getalert returns the correct number of alerts' ); |
224 |
is( @$alerts, 1, 'getalert returns the correct number of alerts' ); |
| 223 |
$alerts = C4::Letters::getalert($borrowernumber, $type, $externalid); |
225 |
$alerts = C4::Letters::getalert($borrowernumber, $type, $externalid); |
| 224 |
- |
|
|