|
Lines 1810-1833
subtest 'Test Koha::Patrons::merge' => sub {
Link Here
|
| 1810 |
}; |
1810 |
}; |
| 1811 |
|
1811 |
|
| 1812 |
subtest '->store' => sub { |
1812 |
subtest '->store' => sub { |
| 1813 |
plan tests => 8; |
1813 |
plan tests => 9; |
| 1814 |
my $schema = Koha::Database->new->schema; |
1814 |
my $schema = Koha::Database->new->schema; |
| 1815 |
$schema->storage->txn_begin; |
1815 |
$schema->storage->txn_begin; |
| 1816 |
|
1816 |
|
| 1817 |
my $print_error = $schema->storage->dbh->{PrintError}; |
|
|
| 1818 |
$schema->storage->dbh->{PrintError} = 0; ; # FIXME This does not longer work - because of the transaction in Koha::Patron->store? |
| 1819 |
|
| 1820 |
my $patron_1 = $builder->build_object({class=> 'Koha::Patrons'}); |
1817 |
my $patron_1 = $builder->build_object({class=> 'Koha::Patrons'}); |
| 1821 |
my $patron_2 = $builder->build_object({class=> 'Koha::Patrons'}); |
1818 |
my $patron_2 = $builder->build_object({class=> 'Koha::Patrons'}); |
| 1822 |
|
1819 |
|
| 1823 |
{ |
1820 |
throws_ok { $patron_2->userid( $patron_1->userid )->store; } |
| 1824 |
local *STDERR; |
1821 |
'Koha::Exceptions::Patron::InvalidUserid', |
| 1825 |
open STDERR, '>', '/dev/null'; |
1822 |
'Koha::Patron->store raises an exception on duplicate ID'; |
| 1826 |
throws_ok { $patron_2->userid( $patron_1->userid )->store; } |
1823 |
|
| 1827 |
'Koha::Exceptions::Object::DuplicateID', |
1824 |
# Clear userid and check regeneration |
| 1828 |
'Koha::Patron->store raises an exception on duplicate ID'; |
1825 |
$patron_2->userid(undef)->store; |
| 1829 |
close STDERR; |
1826 |
like( $patron_2->userid, qr/\w+\.\w+/, 'Userid regenerated' ); # old school userid |
| 1830 |
} |
|
|
| 1831 |
|
1827 |
|
| 1832 |
# Test password |
1828 |
# Test password |
| 1833 |
t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); |
1829 |
t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); |
|
Lines 1853-1859
subtest '->store' => sub {
Link Here
|
| 1853 |
$patron_1->relationship("")->store; |
1849 |
$patron_1->relationship("")->store; |
| 1854 |
is( $patron_1->relationship, undef, ); |
1850 |
is( $patron_1->relationship, undef, ); |
| 1855 |
|
1851 |
|
| 1856 |
$schema->storage->dbh->{PrintError} = $print_error; |
|
|
| 1857 |
$schema->storage->txn_rollback; |
1852 |
$schema->storage->txn_rollback; |
| 1858 |
|
1853 |
|
| 1859 |
subtest 'skip updated_on for BorrowersLog' => sub { |
1854 |
subtest 'skip updated_on for BorrowersLog' => sub { |
| 1860 |
- |
|
|