Lines 269-286
subtest 'send_or_die() tests' => sub {
Link Here
|
269 |
}; |
269 |
}; |
270 |
|
270 |
|
271 |
subtest 'is_valid' => sub { |
271 |
subtest 'is_valid' => sub { |
272 |
plan tests => 8; |
272 |
plan tests => 11; |
273 |
|
273 |
|
274 |
is( Koha::Email->is_valid('Fróm <from@example.com>'), 1 ); |
274 |
is( Koha::Email->is_valid('Fróm <from@example.com>'), 1 ); |
275 |
is( Koha::Email->is_valid('from@example.com'), 1 ); |
275 |
is( Koha::Email->is_valid('from@example.com'), 1 ); |
276 |
is( Koha::Email->is_valid('<from@example.com>'), 1 ); |
276 |
is( Koha::Email->is_valid('<from@example.com>'), 1 ); |
277 |
is( Koha::Email->is_valid('root@localhost'), 1 ); # See bug 28017 |
277 |
is( Koha::Email->is_valid('root@localhost'), 1, 'localhost allowed as exception' ); # See bug 28017 |
|
|
278 |
is( Koha::Email->is_valid('root@example.com.'), 1, 'trailing period got accepted, dont ask me why' ); |
278 |
|
279 |
|
279 |
is( Koha::Email->is_valid('<from@fróm.com>'), 0 ) |
280 |
is( Koha::Email->is_valid('<from@fróm.com>'), 0 ) |
280 |
; # "In accordance with RFC 822 and its descendants, this module demands that email addresses be ASCII only" |
281 |
; # "In accordance with RFC 822 and its descendants, this module demands that email addresses be ASCII only" |
281 |
isnt( Koha::Email->is_valid('@example.com'), 1 ); |
282 |
isnt( Koha::Email->is_valid('@example.com'), 1 ); |
282 |
isnt( Koha::Email->is_valid('example.com'), 1 ); |
283 |
isnt( Koha::Email->is_valid('example.com'), 1 ); |
283 |
isnt( Koha::Email->is_valid('from'), 1 ); |
284 |
isnt( Koha::Email->is_valid('from'), 1 ); |
|
|
285 |
isnt( Koha::Email->is_valid('root@example'), 1, 'example is not a TLD' ); |
286 |
isnt( Koha::Email->is_valid('root@.example.com'), 1, 'period in front of domain' ); |
284 |
}; |
287 |
}; |
285 |
|
288 |
|
286 |
subtest 'new_from_string() tests' => sub { |
289 |
subtest 'new_from_string() tests' => sub { |
287 |
- |
|
|