Bug 28787: Send a notice with the TOTP token
[koha-ffzg.git] / t / db_dependent / Biblio_holdsqueue.t
index 5753a3c..4c687a6 100755 (executable)
@@ -36,6 +36,8 @@ subtest 'ModBiblio() + holds_queue update tests' => sub {
 
     my $biblio = $builder->build_sample_biblio;
 
+    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 1 );
+
     my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue');
     $mock->mock( 'enqueue', sub {
         my ( $self, $args ) = @_;
@@ -69,6 +71,20 @@ subtest 'ModBiblio() + holds_queue update tests' => sub {
         $biblio->frameworkcode, { skip_holds_queue => 1 }
     );
 
+    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 );
+
+    # this call should not trigger the mocked 'enqueue'
+    C4::Biblio::ModBiblio(
+        $biblio->metadata->record, $biblio->id,
+        $biblio->frameworkcode, { skip_holds_queue => 0 }
+    );
+
+    # this call shoul not trigger the mocked 'enqueue'
+    C4::Biblio::ModBiblio(
+        $biblio->metadata->record, $biblio->id,
+        $biblio->frameworkcode, { skip_holds_queue => 1 }
+    );
+
     $schema->storage->txn_rollback;
 };
 
@@ -78,6 +94,8 @@ subtest 'DelBiblio + holds_queue update tests' => sub {
 
     $schema->storage->txn_begin;
 
+    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 1 );
+
     my $biblio = $builder->build_sample_biblio;
 
     my $mock = Test::MockModule->new('Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue');
@@ -102,5 +120,11 @@ subtest 'DelBiblio + holds_queue update tests' => sub {
 
     C4::Biblio::DelBiblio( $biblio->id );
 
+    t::lib::Mocks::mock_preference( 'RealTimeHoldsQueue', 0 );
+
+    $biblio = $builder->build_sample_biblio;
+
+    C4::Biblio::DelBiblio( $biblio->id );
+
     $schema->storage->txn_rollback;
 };