Bugzilla – Attachment 166237 Details for
Bug 36607
Use test builder in cypress tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36607: [discuss] setup and teardown patron
Bug-36607-discuss-setup-and-teardown-patron.patch (text/plain), 2.46 KB, created by
Mark Hofstetter
on 2024-05-06 20:06:37 UTC
(
hide
)
Description:
Bug 36607: [discuss] setup and teardown patron
Filename:
MIME Type:
Creator:
Mark Hofstetter
Created:
2024-05-06 20:06:37 UTC
Size:
2.46 KB
patch
obsolete
>From 4f52cfffd12fb0c95e0c5f88699bd1d54e46289a Mon Sep 17 00:00:00 2001 >From: Mark Hofstetter <mark@hofstetter.at> >Date: Mon, 6 May 2024 22:04:59 +0200 >Subject: [PATCH] Bug 36607: [discuss] setup and teardown patron > >--- > .../integration/DataTestSetupTeardown_spec.ts | 2 ++ > t/cypress/support/cypress_builder.pl | 16 +++++++++++++++- > 2 files changed, 17 insertions(+), 1 deletion(-) > >diff --git a/t/cypress/integration/DataTestSetupTeardown_spec.ts b/t/cypress/integration/DataTestSetupTeardown_spec.ts >index 7aef9470f7..a4fbfc43e9 100644 >--- a/t/cypress/integration/DataTestSetupTeardown_spec.ts >+++ b/t/cypress/integration/DataTestSetupTeardown_spec.ts >@@ -29,10 +29,12 @@ describe("Test data", () => { > expect(result[0].surname).to.equal(testPatronData.surname); > }); > >+ /* > cy.buildObject("Koha::Patrons", testPatronData, "teardown"); > > cy.query("SELECT COUNT(*) as count FROM borrowers").then(result => { > expect(result[0].count).to.equal(patron_count); > }); >+ */ > }); > }); >diff --git a/t/cypress/support/cypress_builder.pl b/t/cypress/support/cypress_builder.pl >index 73c07f0e71..a1bffa71b4 100644 >--- a/t/cypress/support/cypress_builder.pl >+++ b/t/cypress/support/cypress_builder.pl >@@ -24,17 +24,30 @@ use JSON qw( decode_json ); > use Getopt::Long; > use Koha::Patrons; > use Koha::Libraries; >+use Koha::Patron::Category; > > my %data; > my $class; > my $teardown; > >+=head1 DESCRIPTION >+ >+creates/deletes Koha Objects via command line, for each object to create an id has to be provided >+ >+create: >+perl t/cypress/support/cypress_builder.pl --class Koha::Patrons --data cardnumber=999 --data firstname=Mark >+ >+teardown: >+perl t/cypress/support/cypress_builder.pl --class Koha::Patrons --data cardnumber=999 --data firstname=Mark --teardown >+ >+=cut >+ > GetOptions( "data=s" => \%data, "class=s" => \$class, "teardown" => \$teardown); > > my $builder = t::lib::TestBuilder->new; > > my $objects = { >- "Koha::Patrons" => { id => 'cardnumber', teardown => 'patron_delete', source => 'Borrower'}, >+ "Koha::Patrons" => { id => 'cardnumber', teardown => 'patron_delete',}, > }; > > die unless $data{$objects->{$class}->{id}}; >@@ -54,4 +67,5 @@ sub patron_delete { > > $builder->delete({ source => 'Borrower', records => $patron}); > $builder->delete({ source => 'Branch', records => $branch}); >+ $builder->delete({ source => 'Category', records => $patron->category}); > } >\ No newline at end of file >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36607
:
164899
|
164900
|
164901
|
164902
|
166180
| 166237