+
+ SKIP: {
+ eval { require Test::Deep; import Test::Deep; };
+ skip "Test::Deep required to run the GetAuthorisedValues() tests.", 2 if $@;
+ AddAuthorisedValue('BUG10656', 'ZZZ', 'Z_STAFF', 'A_PUBLIC', '');
+ AddAuthorisedValue('BUG10656', 'AAA', 'A_STAFF', 'Z_PUBLIC', '');
+ # the next one sets lib_opac to NULL; in that case, the staff
+ # display value is meant to be used.
+ AddAuthorisedValue('BUG10656', 'DDD', 'D_STAFF', undef, '');
+ my $authvals = GetAuthorisedValues('BUG10656');
+ cmp_deeply(
+ $authvals,
+ [
+ {
+ id => ignore(),
+ category => 'BUG10656',
+ authorised_value => 'AAA',
+ selected => 0,
+ lib => 'A_STAFF',
+ lib_opac => 'Z_PUBLIC',
+ imageurl => '',
+ },
+ {
+ id => ignore(),
+ category => 'BUG10656',
+ authorised_value => 'DDD',
+ selected => 0,
+ lib => 'D_STAFF',
+ lib_opac => undef,
+ imageurl => '',
+ },
+ {
+ id => ignore(),
+ category => 'BUG10656',
+ authorised_value => 'ZZZ',
+ selected => 0,
+ lib => 'Z_STAFF',
+ lib_opac => 'A_PUBLIC',
+ imageurl => '',
+ },
+ ],
+ 'list of authorised values in staff mode sorted by staff label (bug 10656)'
+ );
+ $authvals = GetAuthorisedValues('BUG10656', '', 1);
+ cmp_deeply(
+ $authvals,
+ [
+ {
+ id => ignore(),
+ category => 'BUG10656',
+ authorised_value => 'ZZZ',
+ selected => 0,
+ lib => 'A_PUBLIC',
+ lib_opac => 'A_PUBLIC',
+ imageurl => '',
+ },
+ {
+ id => ignore(),
+ category => 'BUG10656',
+ authorised_value => 'DDD',
+ selected => 0,
+ lib => 'D_STAFF',
+ lib_opac => undef,
+ imageurl => '',
+ },
+ {
+ id => ignore(),
+ category => 'BUG10656',
+ authorised_value => 'AAA',
+ selected => 0,
+ lib => 'Z_PUBLIC',
+ lib_opac => 'Z_PUBLIC',
+ imageurl => '',
+ },
+ ],
+ 'list of authorised values in OPAC mode sorted by OPAC label (bug 10656)'
+ );
+ }
+