Bug 29523: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2021-11-19 13:12:14 -03:00
parent c24b46b403
commit 1fd366ddf7
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 36 additions and 1 deletions

View File

@ -225,7 +225,7 @@ subtest 'TO_JSON tests' => sub {
subtest "to_api() tests" => sub {
plan tests => 31;
plan tests => 32;
$schema->storage->txn_begin;
@ -535,6 +535,41 @@ subtest "to_api() tests" => sub {
$schema->storage->txn_rollback;
};
subtest 'accessible usage tests' => sub {
plan tests => 2;
$schema->storage->txn_begin;
my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } );
my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $patron = $builder->build_object(
{
class => 'Koha::Patrons',
value => {
flags => 2**2, # only has catalogue permissions
branchcode => $library_1->id
}
}
);
my $patron_1 = $builder->build_object(
{ class => 'Koha::Patrons', value => { branchcode => $library_1->id } }
);
my $patron_2 = $builder->build_object(
{ class => 'Koha::Patrons', value => { branchcode => $library_2->id } }
);
t::lib::Mocks::mock_userenv( { patron => $patron } );
is( ref($patron_1->to_api), 'HASH', 'Returns the object hash' );
is( $patron_2->to_api, undef, 'Not accessible, returns undef' );
$schema->storage->txn_rollback;
};
$schema->storage->txn_rollback;
};