|
Lines 586-592
subtest 'add() tests' => sub {
Link Here
|
| 586 |
|
586 |
|
| 587 |
subtest 'extended_attributes handling tests' => sub { |
587 |
subtest 'extended_attributes handling tests' => sub { |
| 588 |
|
588 |
|
| 589 |
plan tests => 25; |
589 |
plan tests => 29; |
| 590 |
|
590 |
|
| 591 |
$mocked_patron->mock( |
591 |
$mocked_patron->mock( |
| 592 |
'extended_attributes', |
592 |
'extended_attributes', |
|
Lines 622-627
subtest 'add() tests' => sub {
Link Here
|
| 622 |
|
622 |
|
| 623 |
is( Koha::Patrons->search->count, $patrons_count, 'No patron added' ); |
623 |
is( Koha::Patrons->search->count, $patrons_count, 'No patron added' ); |
| 624 |
|
624 |
|
|
|
625 |
# Bug 40219: Test that welcome email is not sent when extended attribute validation fails |
| 626 |
t::lib::Mocks::mock_preference( 'AutoEmailNewUser', 1 ); |
| 627 |
$letter_enqueued = 0; |
| 628 |
$extended_attrs_exception = 'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute'; |
| 629 |
$t->post_ok( |
| 630 |
"//$userid:$password\@/api/v1/patrons" => json => { |
| 631 |
"firstname" => "Bug", |
| 632 |
"surname" => "FortyZeroTwoOneNine", |
| 633 |
"address" => "Somewhere", |
| 634 |
"category_id" => "ST", |
| 635 |
"city" => "TestCity", |
| 636 |
"library_id" => "MPL", |
| 637 |
"email" => 'bug40219@test.com' |
| 638 |
} |
| 639 |
)->status_is(400)->json_is( '/error' => "Missing mandatory extended attribute (type=$type)" ); |
| 640 |
is( $letter_enqueued, 0, 'Bug 40219: No welcome email sent when extended attribute validation fails' ); |
| 641 |
|
| 625 |
$extended_attrs_exception = 'Koha::Exceptions::Patron::Attribute::InvalidType'; |
642 |
$extended_attrs_exception = 'Koha::Exceptions::Patron::Attribute::InvalidType'; |
| 626 |
$t->post_ok( |
643 |
$t->post_ok( |
| 627 |
"//$userid:$password@/api/v1/patrons" => json => { |
644 |
"//$userid:$password@/api/v1/patrons" => json => { |
| 628 |
- |
|
|