Lines 20-40
use Modern::Perl;
Link Here
|
20 |
use Test::More tests => 46; |
20 |
use Test::More tests => 46; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
use DBD::Mock; |
|
|
24 |
|
23 |
|
25 |
BEGIN { |
24 |
BEGIN { |
26 |
use_ok('C4::Biblio'); |
25 |
use_ok('C4::Biblio'); |
27 |
} |
26 |
} |
28 |
|
27 |
|
29 |
my $context = new Test::MockModule('C4::Context'); |
28 |
use Test::DBIx::Class { |
30 |
$context->mock( |
29 |
schema_class => 'Koha::Schema', |
31 |
'_new_dbh', |
30 |
connect_info => ['dbi:SQLite:dbname=:memory:','',''], |
32 |
sub { |
31 |
connect_opts => { name_sep => '.', quote_char => '`', }, |
33 |
my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) |
32 |
fixture_class => '::Populate', |
34 |
|| die "Cannot create handle: $DBI::errstr\n"; |
33 |
}, 'Biblio' ; |
35 |
return $dbh; |
34 |
|
36 |
} |
35 |
sub fixtures { |
37 |
); |
36 |
my ( $data ) = @_; |
|
|
37 |
fixtures_ok [ |
38 |
Biblio => [ |
39 |
[ qw/ biblionumber datecreated timestamp / ], |
40 |
@$data, |
41 |
], |
42 |
], 'add fixtures'; |
43 |
} |
44 |
|
45 |
my $db = Test::MockModule->new('Koha::Database'); |
46 |
$db->mock( _new_schema => sub { return Schema(); } ); |
38 |
|
47 |
|
39 |
my @arr; |
48 |
my @arr; |
40 |
my $ret; |
49 |
my $ret; |
41 |
- |
|
|