Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 12; |
20 |
use Test::More tests => 13; |
21 |
use Test::Warn; |
21 |
use Test::Warn; |
22 |
|
22 |
|
23 |
use C4::Context; |
23 |
use C4::Context; |
Lines 45-56
$object->branchcode( $branchcode );
Link Here
|
45 |
$object->surname("Test Surname"); |
45 |
$object->surname("Test Surname"); |
46 |
$object->store(); |
46 |
$object->store(); |
47 |
|
47 |
|
48 |
my $borrower = Koha::Database->new()->schema()->resultset('Borrower')->find( $object->borrowernumber() ); |
|
|
49 |
is( $borrower->surname(), "Test Surname", "Object found in database" ); |
50 |
|
51 |
is( $object->in_storage, 1, "Object is now stored" ); |
48 |
is( $object->in_storage, 1, "Object is now stored" ); |
52 |
|
49 |
|
|
|
50 |
my $borrowernumber = $object->borrowernumber; |
51 |
|
52 |
my $borrower = Koha::Database->new()->schema()->resultset('Borrower')->find( $borrowernumber ); |
53 |
is( $borrower->surname(), "Test Surname", "Object found in database" ); |
54 |
|
53 |
is( $object->is_changed(), 0, "Object is unchanged" ); |
55 |
is( $object->is_changed(), 0, "Object is unchanged" ); |
|
|
56 |
$object->surname("Test Surname"); |
57 |
is( $object->is_changed(), 0, "Object is still unchanged" ); |
54 |
$object->surname("Test Surname 2"); |
58 |
$object->surname("Test Surname 2"); |
55 |
is( $object->is_changed(), 1, "Object is changed" ); |
59 |
is( $object->is_changed(), 1, "Object is changed" ); |
56 |
|
60 |
|
Lines 63-69
$object->store();
Link Here
|
63 |
is( $object->is_changed(), 0, "Object no longer marked as changed after being stored" ); |
67 |
is( $object->is_changed(), 0, "Object no longer marked as changed after being stored" ); |
64 |
|
68 |
|
65 |
$object->delete(); |
69 |
$object->delete(); |
66 |
$borrower = Koha::Database->new()->schema()->resultset('Borrower')->find( $object->borrowernumber() ); |
70 |
$borrower = Koha::Database->new()->schema()->resultset('Borrower')->find( $borrowernumber ); |
67 |
ok( ! $borrower, "Object no longer found in database" ); |
71 |
ok( ! $borrower, "Object no longer found in database" ); |
68 |
is( $object->in_storage, 0, "Object is not in storage" ); |
72 |
is( $object->in_storage, 0, "Object is not in storage" ); |
69 |
|
73 |
|
70 |
- |
|
|