blob: 6b5d8bfd6325092ae8cc91ca1b6038d2dc7e4ddc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
use 5.10.1;
use strict;
use warnings;
use lib qw( . lib local/lib/perl5 );
use Test::More;
use Test2::Tools::Mock;
use Try::Tiny;
use Capture::Tiny qw(capture_merged);
use Bugzilla::Test::MockParams;
BEGIN {
$ENV{LOCALCONFIG_ENV} = 'BMO';
$ENV{BMO_db_driver} = 'sqlite';
$ENV{BMO_db_name} = ':memory:';
}
use Bugzilla;
BEGIN { Bugzilla->extensions }
isa_ok(Bugzilla->dbh, 'Bugzilla::DB::Sqlite');
use ok 'Bugzilla::Install';
use ok 'Bugzilla::Install::DB';
my $lives_ok = sub {
my ($desc, $code) = @_;
my $output;
try {
$output = capture_merged { $code->() };
pass($desc);
}
catch {
diag $_;
fail($desc);
}
finally {
diag "OUTPUT: $output" if $output;
};
};
my $output = '';
$lives_ok->(
'bz_setup_database' => sub {
Bugzilla->dbh->bz_setup_database;
}
);
$lives_ok->(
'bz_populate_enum_tables' => sub {
# Populate the tables that hold the values for the <select> fields.
Bugzilla->dbh->bz_populate_enum_tables();
}
);
$lives_ok->(
'update_fielddefs_definition' => sub {
Bugzilla::Install::DB::update_fielddefs_definition();
}
);
$lives_ok->(
'populate_field_definitions' => sub {
Bugzilla::Field::populate_field_definitions();
}
);
$lives_ok->(
'init_workflow' => sub {
Bugzilla::Install::init_workflow();
}
);
$lives_ok->(
'update_table_definitions' => sub {
Bugzilla::Install::DB->update_table_definitions({});
}
);
$lives_ok->(
'update_system_groups' => sub {
Bugzilla::Install::update_system_groups();
}
);
# "Log In" as the fake superuser who can do everything.
Bugzilla->set_user(Bugzilla::User->super_user);
$lives_ok->(
'update_settings' => sub {
Bugzilla::Install::update_settings();
}
);
SKIP: {
skip 'default product cannot be created without default assignee', 1;
$lives_ok->(
'create_default_product' => sub {
Bugzilla::Install::create_default_product();
}
);
}
done_testing;
|