Lines 1-46
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
|
2 |
|
3 |
use C4::Auth; |
|
|
4 |
use C4::Output; |
5 |
use Koha::FrameworkPlugin; |
6 |
|
7 |
use CGI; |
3 |
use CGI; |
8 |
use File::Temp qw/tempfile/; |
4 |
use File::Temp qw/tempfile/; |
9 |
use Getopt::Long; |
5 |
use Getopt::Long; |
10 |
use Test::MockModule; |
6 |
use Test::MockModule; |
11 |
use Test::More tests => 5; |
7 |
use Test::More tests => 5; |
12 |
|
8 |
|
13 |
my @includes; |
9 |
use t::lib::TestBuilder; |
|
|
10 |
|
11 |
use C4::Auth; |
12 |
use C4::Output; |
13 |
use Koha::Database; |
14 |
use Koha::FrameworkPlugin; |
15 |
|
16 |
our @includes; |
14 |
GetOptions( 'include=s{,}' => \@includes ); #not used by default ! |
17 |
GetOptions( 'include=s{,}' => \@includes ); #not used by default ! |
15 |
|
18 |
|
16 |
my $dbh = C4::Context->dbh; |
19 |
my $schema = Koha::Database->new->schema; |
17 |
$dbh->{AutoCommit} = 0; |
20 |
$schema->storage->txn_begin; |
18 |
$dbh->{RaiseError} = 1; |
21 |
our $dbh = C4::Context->dbh; |
|
|
22 |
our $builder = t::lib::TestBuilder->new; |
19 |
|
23 |
|
20 |
subtest 'Test01 -- Simple tests for new and name' => sub { |
24 |
subtest 'Test01 -- Simple tests for new and name' => sub { |
21 |
plan tests => 7; |
25 |
plan tests => 7; |
22 |
test01(); |
26 |
test01(); |
23 |
$dbh->rollback; |
|
|
24 |
}; |
27 |
}; |
25 |
subtest 'Test02 -- test build with old styler and marc21_leader' => sub { |
28 |
subtest 'Test02 -- test build with old styler and marc21_leader' => sub { |
26 |
plan tests => 5; |
29 |
plan tests => 5; |
27 |
test02(); |
30 |
test02(); |
28 |
$dbh->rollback; |
|
|
29 |
}; |
31 |
}; |
30 |
subtest 'Test03 -- tests with bad plugins' => sub { |
32 |
subtest 'Test03 -- tests with bad plugins' => sub { |
31 |
test03(); |
33 |
test03(); |
32 |
$dbh->rollback; |
|
|
33 |
}; |
34 |
}; |
34 |
subtest 'Test04 -- tests with new style plugin' => sub { |
35 |
subtest 'Test04 -- tests with new style plugin' => sub { |
35 |
plan tests => 5; |
36 |
plan tests => 5; |
36 |
test04(); |
37 |
test04(); |
37 |
$dbh->rollback; |
|
|
38 |
}; |
38 |
}; |
39 |
subtest 'Test05 -- tests with build and launch for default plugins' => sub { |
39 |
subtest 'Test05 -- tests with build and launch for default plugins' => sub { |
40 |
test05( \@includes ); |
40 |
test05( \@includes ); |
41 |
$dbh->rollback; |
|
|
42 |
}; |
41 |
}; |
43 |
$dbh->rollback; |
42 |
$schema->storage->txn_rollback; |
44 |
|
43 |
|
45 |
sub test01 { |
44 |
sub test01 { |
46 |
#empty plugin |
45 |
#empty plugin |
Lines 179-185
unimarc_field_4XX.pl |;
Link Here
|
179 |
} |
178 |
} |
180 |
|
179 |
|
181 |
sub mock_userenv { |
180 |
sub mock_userenv { |
182 |
return { branch => 'CPL', flags => 1, id => 1 }; |
181 |
my $branch = $builder->build({ source => 'Branch' }); |
|
|
182 |
return { branch => $branch->{branchcode}, flags => 1, id => 1 }; |
183 |
} |
183 |
} |
184 |
|
184 |
|
185 |
sub all_perms { |
185 |
sub all_perms { |
186 |
- |
|
|