Bug 13967: Add a couple of tests for SysPref and Object
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
This commit is contained in:
parent
6882949b1b
commit
2fa99fc7a0
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 12;
|
||||
use Test::More tests => 13;
|
||||
use Test::Warn;
|
||||
|
||||
use C4::Context;
|
||||
|
|
@ -72,6 +72,9 @@ is( $b1->surname(), $b1_new->surname(), "Found matching borrower" );
|
|||
my @borrowers = Koha::Borrowers->search( { branchcode => $branchcode } );
|
||||
is( @borrowers, 3, "Found 3 borrowers with Search" );
|
||||
|
||||
my $unexistent = Koha::Borrowers->find( '1234567890' );
|
||||
is( $unexistent, undef, 'Koha::Objects->Find should return undef if the record does not exist' );
|
||||
|
||||
my $borrowers = Koha::Borrowers->search( { branchcode => $branchcode } );
|
||||
is( $borrowers->count( { branchcode => $branchcode } ), 3, "Counted 3 borrowers with Count" );
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 5;
|
||||
use C4::Context;
|
||||
|
||||
# Start transaction
|
||||
|
|
@ -31,10 +31,10 @@ my $opacheader = C4::Context->preference('opacheader');
|
|||
my $newopacheader = "newopacheader";
|
||||
|
||||
C4::Context->set_preference( 'OPACHEADER', $newopacheader );
|
||||
is( C4::Context->preference('opacheader'), $newopacheader );
|
||||
is( C4::Context->preference('opacheader'), $newopacheader, 'The pref should have been set correctly' );
|
||||
|
||||
C4::Context->set_preference( 'opacheader', $opacheader );
|
||||
is( C4::Context->preference('OPACHEADER'), $opacheader );
|
||||
is( C4::Context->preference('OPACHEADER'), $opacheader, 'A pref name should be case insensitive');
|
||||
|
||||
$ENV{OVERRIDE_SYSPREF_opacheader} = 'this is an override';
|
||||
C4::Context->clear_syspref_cache();
|
||||
|
|
@ -44,5 +44,7 @@ is(
|
|||
'system preference value overridden from environment'
|
||||
);
|
||||
|
||||
is( C4::Context->preference('IDoNotExist'), undef, 'Get a non-existent system preference should return undef');
|
||||
|
||||
C4::Context->set_preference( 'IDoNotExist', 'NonExistent' );
|
||||
is( C4::Context->preference('IDoNotExist'), 'NonExistent', 'Test creation of non-existant system preferencer' );
|
||||
is( C4::Context->preference('IDoNotExist'), 'NonExistent', 'Test creation of non-existent system preference' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue