Bugzilla – Attachment 141243 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 - Add another subtest
Bug-30571-Z3950Serverst---Add-another-subtest.patch (text/plain), 3.03 KB, created by
Katrin Fischer
on 2022-10-03 10:36:32 UTC
(
hide
)
Description:
Bug 30571: Z3950Servers.t - Add another subtest
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-10-03 10:36:32 UTC
Size:
3.03 KB
patch
obsolete
>From f657563281d31c7f0cc2d0c541b24f739cecded1 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 24 Aug 2022 12:50:31 +0000 >Subject: [PATCH] Bug 30571: Z3950Servers.t - Add another subtest > >Subtest for testing nullability of host, syntax and encoding. > >Test plan: >Run prove t/db_dependent/Koha/Z3950Servers.t. >(Note: you need strict mode to pass this test.) > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Koha/Z3950Servers.t | 37 +++++++++++++++++++++++++++++- > 1 file changed, 36 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Z3950Servers.t b/t/db_dependent/Koha/Z3950Servers.t >index 282f982db8..6f6dbd81c3 100755 >--- a/t/db_dependent/Koha/Z3950Servers.t >+++ b/t/db_dependent/Koha/Z3950Servers.t >@@ -18,7 +18,8 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 1; >+use Test::More tests => 2; >+use Test::Exception; > > use t::lib::TestBuilder; > use Koha::Database; >@@ -39,6 +40,8 @@ subtest 'new, find and delete tests' => sub { > servername => 'my_test_1', > servertype => 'zed', > recordtype => 'biblio', >+ syntax => 'USMARC', >+ encoding => 'MARC-8', > })->store; > my $new_z39_2 = Koha::Z3950Server->new({ > host => 'my_host2.org', >@@ -47,6 +50,8 @@ subtest 'new, find and delete tests' => sub { > servername => 'my_test_2', > servertype => 'zed', > recordtype => 'authority', >+ syntax => 'USMARC', >+ encoding => 'MARC-8', > })->store; > > like( $new_z39_1->id, qr|^\d+$|, 'Adding a new z39 server should have set the id'); >@@ -60,3 +65,33 @@ subtest 'new, find and delete tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'Host, syntax and encoding are NOT NULL now (BZ 30571)' => sub { >+ plan tests => 7; >+ $schema->storage->txn_begin; >+ local $SIG{__WARN__} = sub {}; # TODO Needed it for suppressing DBIx warns >+ >+ my $server = Koha::Z3950Server->new({ >+ port => '80', >+ db => 'db', >+ servername => 'my_test_3', >+ servertype => 'zed', >+ recordtype => 'biblio', >+ }); >+ >+ throws_ok { $server->store } 'DBIx::Class::Exception', 'Exception on empty host'; >+ like( $@->{msg}, qr/'host' doesn't have a default value/, 'Verified that DBIx blamed host' ); >+ >+ $server->host('host_added.nl'); >+ throws_ok { $server->store } 'DBIx::Class::Exception', 'Exception on empty syntax'; >+ like( $@->{msg}, qr/'syntax' doesn't have a default value/, 'Verified that DBIx blamed syntax' ); >+ >+ $server->syntax('USMARC'); >+ throws_ok { $server->store } 'DBIx::Class::Exception', 'Exception on empty encoding'; >+ like( $@->{msg}, qr/'encoding' doesn't have a default value/, 'Verified that DBIx blamed encoding' ); >+ >+ $server->encoding('utf8'); >+ lives_ok { $server->store } 'No exceptions anymore'; >+ >+ $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