Bug 30399: Make Patron.t pass even if mandatory attributes exist

t/db_dependent/Koha/Patron.t is failing if mandatory attributes already
exist in the DB. We can make it pass easily by deleting all the
attributes before we run the tests.

Test plan:
  prove t/db_dependent/Koha/Patron.t
must return green even if one mandatory patron attribute exists.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 523a2f297d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2022-06-08 11:39:43 +02:00 committed by Lucas Gass
parent ffbaee5afa
commit efcd9f8798

View file

@ -377,6 +377,8 @@ subtest 'extended_attributes' => sub {
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;
Koha::Patron::Attribute::Types->search->delete;
my $patron_1 = $builder->build_object({class=> 'Koha::Patrons'});
my $patron_2 = $builder->build_object({class=> 'Koha::Patrons'});
@ -507,6 +509,7 @@ subtest 'extended_attributes' => sub {
plan tests => 3;
$schema->storage->txn_begin;
Koha::Patron::Attribute::Types->search->delete;
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
my $attribute_type = $builder->build_object(
@ -541,6 +544,7 @@ subtest 'extended_attributes' => sub {
plan tests => 5;
$schema->storage->txn_begin;
Koha::Patron::Attribute::Types->search->delete;
my $patron_1 = $builder->build_object({ class => 'Koha::Patrons' });
my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' });
@ -593,6 +597,7 @@ subtest 'extended_attributes' => sub {
plan tests => 3;
$schema->storage->txn_begin;
Koha::Patron::Attribute::Types->search->delete;
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
@ -637,6 +642,7 @@ subtest 'extended_attributes' => sub {
plan tests => 5;
$schema->storage->txn_begin;
Koha::Patron::Attribute::Types->search->delete;
my $patron = $builder->build_object({ class => 'Koha::Patrons' });