View | Details | Raw Unified | Return to bug 36607
Collapse All | Expand All

(-)a/t/cypress/integration/DataTestSetupTeardown_spec.ts (+2 lines)
Lines 29-38 describe("Test data", () => { Link Here
29
            expect(result[0].surname).to.equal(testPatronData.surname);
29
            expect(result[0].surname).to.equal(testPatronData.surname);
30
        });
30
        });
31
31
32
        /*
32
        cy.buildObject("Koha::Patrons", testPatronData, "teardown");
33
        cy.buildObject("Koha::Patrons", testPatronData, "teardown");
33
34
34
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
35
        cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => {
35
            expect(result[0].count).to.equal(patron_count);
36
            expect(result[0].count).to.equal(patron_count);
36
        });
37
        });
38
        */
37
    });
39
    });
38
});
40
});
(-)a/t/cypress/support/cypress_builder.pl (-2 / +15 lines)
Lines 24-40 use JSON qw( decode_json ); Link Here
24
use Getopt::Long;
24
use Getopt::Long;
25
use Koha::Patrons;
25
use Koha::Patrons;
26
use Koha::Libraries;
26
use Koha::Libraries;
27
use Koha::Patron::Category;
27
28
28
my %data;
29
my %data;
29
my $class;
30
my $class;
30
my $teardown;
31
my $teardown;
31
32
33
=head1 DESCRIPTION
34
35
creates/deletes Koha Objects via command line, for each object to create an id has to be provided
36
37
create:
38
perl t/cypress/support/cypress_builder.pl  --class Koha::Patrons --data cardnumber=999 --data firstname=Mark
39
40
teardown:
41
perl t/cypress/support/cypress_builder.pl  --class Koha::Patrons --data cardnumber=999 --data firstname=Mark --teardown
42
43
=cut
44
32
GetOptions( "data=s" => \%data, "class=s" => \$class, "teardown" => \$teardown);
45
GetOptions( "data=s" => \%data, "class=s" => \$class, "teardown" => \$teardown);
33
46
34
my $builder = t::lib::TestBuilder->new;
47
my $builder = t::lib::TestBuilder->new;
35
48
36
my $objects = {
49
my $objects = {
37
    "Koha::Patrons" => { id => 'cardnumber', teardown => 'patron_delete', source => 'Borrower'},
50
    "Koha::Patrons" => { id => 'cardnumber', teardown => 'patron_delete',},
38
};
51
};
39
52
40
die unless $data{$objects->{$class}->{id}};
53
die unless $data{$objects->{$class}->{id}};
Lines 54-57 sub patron_delete { Link Here
54
   
67
   
55
    $builder->delete({ source => 'Borrower',  records => $patron});
68
    $builder->delete({ source => 'Borrower',  records => $patron});
56
    $builder->delete({ source => 'Branch',  records => $branch});   
69
    $builder->delete({ source => 'Branch',  records => $branch});   
70
    $builder->delete({ source => 'Category',  records => $patron->category});   
57
}
71
}
58
- 

Return to bug 36607