Lines 38-44
my $builder = t::lib::TestBuilder->new;
Link Here
|
38 |
|
38 |
|
39 |
subtest 'all() tests' => sub { |
39 |
subtest 'all() tests' => sub { |
40 |
|
40 |
|
41 |
plan tests => 16; |
41 |
plan tests => 18; |
42 |
|
42 |
|
43 |
$schema->storage->txn_begin; |
43 |
$schema->storage->txn_begin; |
44 |
|
44 |
|
Lines 46-51
subtest 'all() tests' => sub {
Link Here
|
46 |
source => 'Branch', |
46 |
source => 'Branch', |
47 |
value => { |
47 |
value => { |
48 |
branchcode => 'MYLIBRARY', |
48 |
branchcode => 'MYLIBRARY', |
|
|
49 |
branchname => 'My sweet library' |
49 |
} |
50 |
} |
50 |
}); |
51 |
}); |
51 |
my $another_library = $builder->build({ |
52 |
my $another_library = $builder->build({ |
Lines 67-78
subtest 'all() tests' => sub {
Link Here
|
67 |
$name = $plugin->GetName(undef); |
68 |
$name = $plugin->GetName(undef); |
68 |
is($name, '', 'received empty string as name of NULL/undefined library code'); |
69 |
is($name, '', 'received empty string as name of NULL/undefined library code'); |
69 |
|
70 |
|
70 |
$library = $plugin->GetLoggedInBranchcode(); |
71 |
is($plugin->GetLoggedInBranchcode(), '', 'no active library code if there is no active user session'); |
71 |
is($library, '', 'no active library if there is no active user session'); |
72 |
is($plugin->GetLoggedInBranchname(), '', 'no active library name if there is no active user session'); |
72 |
|
73 |
|
73 |
t::lib::Mocks::mock_userenv({ branchcode => 'MYLIBRARY' }); |
74 |
t::lib::Mocks::mock_userenv({ branchcode => 'MYLIBRARY' }); |
74 |
$library = $plugin->GetLoggedInBranchcode(); |
75 |
is($plugin->GetLoggedInBranchcode(), 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library code'); |
75 |
is($library, 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library'); |
76 |
is($plugin->GetLoggedInBranchname(), 'My sweet library', 'GetLoggedInBranchname() returns active library name'); |
76 |
|
77 |
|
77 |
t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); |
78 |
t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); |
78 |
my $libraries = $plugin->all(); |
79 |
my $libraries = $plugin->all(); |
79 |
- |
|
|