|
Lines 18-24
Link Here
|
| 18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use Test::More tests => 1; |
21 |
use Test::More tests => 2; |
|
|
22 |
use Test::Exception; |
| 22 |
|
23 |
|
| 23 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
| 24 |
use Koha::Database; |
25 |
use Koha::Database; |
|
Lines 39-44
subtest 'new, find and delete tests' => sub {
Link Here
|
| 39 |
servername => 'my_test_1', |
40 |
servername => 'my_test_1', |
| 40 |
servertype => 'zed', |
41 |
servertype => 'zed', |
| 41 |
recordtype => 'biblio', |
42 |
recordtype => 'biblio', |
|
|
43 |
syntax => 'USMARC', |
| 44 |
encoding => 'MARC-8', |
| 42 |
})->store; |
45 |
})->store; |
| 43 |
my $new_z39_2 = Koha::Z3950Server->new({ |
46 |
my $new_z39_2 = Koha::Z3950Server->new({ |
| 44 |
host => 'my_host2.org', |
47 |
host => 'my_host2.org', |
|
Lines 47-52
subtest 'new, find and delete tests' => sub {
Link Here
|
| 47 |
servername => 'my_test_2', |
50 |
servername => 'my_test_2', |
| 48 |
servertype => 'zed', |
51 |
servertype => 'zed', |
| 49 |
recordtype => 'authority', |
52 |
recordtype => 'authority', |
|
|
53 |
syntax => 'USMARC', |
| 54 |
encoding => 'MARC-8', |
| 50 |
})->store; |
55 |
})->store; |
| 51 |
|
56 |
|
| 52 |
like( $new_z39_1->id, qr|^\d+$|, 'Adding a new z39 server should have set the id'); |
57 |
like( $new_z39_1->id, qr|^\d+$|, 'Adding a new z39 server should have set the id'); |
|
Lines 60-62
subtest 'new, find and delete tests' => sub {
Link Here
|
| 60 |
|
65 |
|
| 61 |
$schema->storage->txn_rollback; |
66 |
$schema->storage->txn_rollback; |
| 62 |
}; |
67 |
}; |
| 63 |
- |
68 |
|
|
|
69 |
subtest 'Host, syntax and encoding are NOT NULL now (BZ 30571)' => sub { |
| 70 |
plan tests => 7; |
| 71 |
$schema->storage->txn_begin; |
| 72 |
local $SIG{__WARN__} = sub {}; # TODO Needed it for suppressing DBIx warns |
| 73 |
|
| 74 |
my $server = Koha::Z3950Server->new({ |
| 75 |
port => '80', |
| 76 |
db => 'db', |
| 77 |
servername => 'my_test_3', |
| 78 |
servertype => 'zed', |
| 79 |
recordtype => 'biblio', |
| 80 |
}); |
| 81 |
|
| 82 |
throws_ok { $server->store } 'DBIx::Class::Exception', 'Exception on empty host'; |
| 83 |
like( $@->{msg}, qr/'host' doesn't have a default value/, 'Verified that DBIx blamed host' ); |
| 84 |
|
| 85 |
$server->host('host_added.nl'); |
| 86 |
throws_ok { $server->store } 'DBIx::Class::Exception', 'Exception on empty syntax'; |
| 87 |
like( $@->{msg}, qr/'syntax' doesn't have a default value/, 'Verified that DBIx blamed syntax' ); |
| 88 |
|
| 89 |
$server->syntax('USMARC'); |
| 90 |
throws_ok { $server->store } 'DBIx::Class::Exception', 'Exception on empty encoding'; |
| 91 |
like( $@->{msg}, qr/'encoding' doesn't have a default value/, 'Verified that DBIx blamed encoding' ); |
| 92 |
|
| 93 |
$server->encoding('utf8'); |
| 94 |
lives_ok { $server->store } 'No exceptions anymore'; |
| 95 |
|
| 96 |
$schema->storage->txn_rollback; |
| 97 |
}; |