|
Lines 15-34
Link Here
|
| 15 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
15 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
| 16 |
|
16 |
|
| 17 |
use Modern::Perl; |
17 |
use Modern::Perl; |
|
|
18 |
|
| 18 |
use Test::More tests => 1; |
19 |
use Test::More tests => 1; |
| 19 |
use Test::MockModule; |
|
|
| 20 |
use t::lib::Mocks; |
| 21 |
use t::lib::TestBuilder; |
| 22 |
|
20 |
|
| 23 |
use C4::Patroncards::Layout qw( save new ); |
21 |
use C4::Patroncards::Layout; |
|
|
22 |
use Koha::Database; |
| 23 |
|
| 24 |
my $schema = Koha::Database->new->schema; |
| 25 |
|
| 26 |
subtest 'save() tests' => sub { |
| 24 |
|
27 |
|
| 25 |
subtest '->save' => sub { |
|
|
| 26 |
plan tests => 1; |
28 |
plan tests => 1; |
|
|
29 |
|
| 30 |
$schema->storage->txn_begin; |
| 31 |
|
| 27 |
my $layout = C4::Patroncards::Layout->new( |
32 |
my $layout = C4::Patroncards::Layout->new( |
| 28 |
layout_name => "new patron card", |
33 |
layout_name => "new patron card", |
| 29 |
layout_id => '', # The interface send an empty string |
34 |
layout_id => '', # The interface send an empty string |
| 30 |
layout_xml => 'some_xml' |
35 |
layout_xml => 'some_xml' |
| 31 |
); |
36 |
); |
| 32 |
my $layout_id = $layout->save; |
37 |
my $layout_id = $layout->save; |
| 33 |
ok($layout_id > 0, 'A layout_id should have been returned on ->save'); |
38 |
ok( $layout_id > 0, 'A layout_id should have been returned on ->save' ); |
|
|
39 |
|
| 40 |
$schema->storage->txn_rollback; |
| 34 |
}; |
41 |
}; |
| 35 |
- |
|
|