Bugzilla – Attachment 140076 Details for
Bug 30571
Table z3950servers: Make host, syntax and encoding NOT NULL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30571: Z3950Servers.t - Create subtest for existing tests
Bug-30571-Z3950Serverst---Create-subtest-for-exist.patch (text/plain), 3.61 KB, created by
Nick Clemens (kidclamp)
on 2022-09-02 07:28:23 UTC
(
hide
)
Description:
Bug 30571: Z3950Servers.t - Create subtest for existing tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-09-02 07:28:23 UTC
Size:
3.61 KB
patch
obsolete
>From b9bb11157654e7bc6fcb761cd24295e13857f12e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 24 Aug 2022 12:42:33 +0000 >Subject: [PATCH] Bug 30571: Z3950Servers.t - Create subtest for existing tests > >No real changes, just moving code and indentation. >Ground work for following patch. > >Test plan: >To let the test pass, disable strict_mode in koha-conf. >Run perl t/db_dependent/Koha/Z3950Servers.t. Should pass now. >However, in strict mode or with prove, it should fail. >Run prove t/db_dependent/Koha/Z3950Servers.t. Failed? > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Koha/Z3950Servers.t | 71 +++++++++++++++--------------- > 1 file changed, 36 insertions(+), 35 deletions(-) > >diff --git a/t/db_dependent/Koha/Z3950Servers.t b/t/db_dependent/Koha/Z3950Servers.t >index 9714cb4599..282f982db8 100755 >--- a/t/db_dependent/Koha/Z3950Servers.t >+++ b/t/db_dependent/Koha/Z3950Servers.t >@@ -18,44 +18,45 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+use Test::More tests => 1; > >-use Test::More tests => 4; >- >+use t::lib::TestBuilder; >+use Koha::Database; > use Koha::Z3950Server; > use Koha::Z3950Servers; >-use Koha::Database; >- >-use t::lib::TestBuilder; > > my $schema = Koha::Database->new->schema; >-$schema->storage->txn_begin; >- > my $builder = t::lib::TestBuilder->new; >-my $nb_of_z39s = Koha::Z3950Servers->search->count; >-my $new_z39_1 = Koha::Z3950Server->new({ >- host => 'my_host1.org', >- port => '32', >- db => 'db1', >- servername => 'my_test_1', >- servertype => 'zed', >- recordtype => 'biblio', >-})->store; >-my $new_z39_2 = Koha::Z3950Server->new({ >- host => 'my_host2.org', >- port => '64', >- db => 'db2', >- servername => 'my_test_2', >- servertype => 'zed', >- recordtype => 'authority', >-})->store; >- >-like( $new_z39_1->id, qr|^\d+$|, 'Adding a new z39 server should have set the id'); >-is( Koha::Z3950Servers->search->count, $nb_of_z39s + 2, 'The 2 z39 servers should have been added' ); >- >-my $retrieved_z39_1 = Koha::Z3950Servers->find( $new_z39_1->id ); >-is( $retrieved_z39_1->servername, $new_z39_1->servername, 'Find a z39 server by id should return the correct z39 server' ); >- >-$retrieved_z39_1->delete; >-is( Koha::Z3950Servers->search->count, $nb_of_z39s + 1, 'Delete should have deleted the z39 server' ); >- >-$schema->storage->txn_rollback; >+ >+subtest 'new, find and delete tests' => sub { >+ plan tests => 4; >+ $schema->storage->txn_begin; >+ my $nb_of_z39s = Koha::Z3950Servers->search->count; >+ my $new_z39_1 = Koha::Z3950Server->new({ >+ host => 'my_host1.org', >+ port => '32', >+ db => 'db1', >+ servername => 'my_test_1', >+ servertype => 'zed', >+ recordtype => 'biblio', >+ })->store; >+ my $new_z39_2 = Koha::Z3950Server->new({ >+ host => 'my_host2.org', >+ port => '64', >+ db => 'db2', >+ servername => 'my_test_2', >+ servertype => 'zed', >+ recordtype => 'authority', >+ })->store; >+ >+ like( $new_z39_1->id, qr|^\d+$|, 'Adding a new z39 server should have set the id'); >+ is( Koha::Z3950Servers->search->count, $nb_of_z39s + 2, 'The 2 z39 servers should have been added' ); >+ >+ my $retrieved_z39_1 = Koha::Z3950Servers->find( $new_z39_1->id ); >+ is( $retrieved_z39_1->servername, $new_z39_1->servername, 'Find a z39 server by id should return the correct z39 server' ); >+ >+ $retrieved_z39_1->delete; >+ is( Koha::Z3950Servers->search->count, $nb_of_z39s + 1, 'Delete should have deleted the z39 server' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.30.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 30571
:
139713
|
139714
|
139715
|
139716
|
140074
|
140075
|
140076
|
140077
|
141238
|
141240
|
141242
|
141243
|
141244
|
141361