Bug 37870: Run tests from ClassSources.t within transactions

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-09-10 10:40:20 +02:00 committed by Katrin Fischer
parent 405c2ac6b6
commit b824c29eef
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,8 @@ subtest 'GetClassSources' => sub {
plan tests => 5;
$schema->storage->txn_begin;
my $class_rule = $builder->build(
{
source => 'ClassSortRule',
@ -82,12 +84,17 @@ subtest 'GetClassSources' => sub {
is( $class_sources_cached->{$source_code}, undef, "New value now present after cache cleared" );
$class_sources_cached = GetClassSources();
is_deeply( $class_sources, $class_sources_cached, "New cached version does match the updated fresh version" );
$schema->storage->txn_rollback;
};
subtest 'GetClassSource' => sub {
plan tests => 4;
$schema->storage->txn_begin;
my $class_rule = $builder->build(
{
source => 'ClassSortRule',
@ -123,12 +130,16 @@ subtest 'GetClassSource' => sub {
$class_source_cache = GetClassSource($source_code);
is( $class_source_cache->{description}, $class_source_db->{description}, "Now both get the correct value" );
$schema->storage->txn_rollback;
};
subtest 'GetClassSortRule' => sub {
plan tests => 4;
$schema->storage->txn_begin;
my $class_rule_1 = $builder->build(
{
source => 'ClassSortRule',
@ -153,4 +164,6 @@ subtest 'GetClassSortRule' => sub {
$class_sort_rule_cache = GetClassSortRule($sort_rule);
is_deeply( $class_sort_rule_cache, $class_sort_rule_db, "Now both get the correct value" );
$schema->storage->txn_rollback;
};