| 
      
            Lines 6-11
          
      
      
        Link Here
      
     | 
  
        
          | 6 | 
          use Modern::Perl;  | 
          6 | 
          use Modern::Perl;  | 
        
        
          | 7 | 
          use Test::More tests => 5;  | 
          7 | 
          use Test::More tests => 5;  | 
        
        
          | 8 | 
          use Test::Warn;  | 
          8 | 
          use Test::Warn;  | 
        
            
               | 
               | 
              9 | 
              use Test::Deep;  | 
            
        
          | 9 | 
           | 
          10 | 
           | 
        
        
          | 10 | 
          use t::lib::TestBuilder;  | 
          11 | 
          use t::lib::TestBuilder;  | 
        
        
          | 11 | 
           | 
          12 | 
           | 
        
  
    | 
      
            Lines 58-158
          subtest 'Authorized Values Tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 58 | 
                  $sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl}); | 
          59 | 
                  $sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl}); | 
        
        
          | 59 | 
              }  | 
          60 | 
              }  | 
        
        
          | 60 | 
           | 
          61 | 
           | 
        
          
            
              | 61 | 
                  SKIP: { | 
              62 | 
                  Koha::AuthorisedValueCategory->new({ category_name => 'BUG10656' })->store; | 
            
            
              | 62 | 
                      eval { require Test::Deep; import Test::Deep; }; | 
              63 | 
                  Koha::AuthorisedValue->new(  | 
            
            
              | 63 | 
                      skip "Test::Deep required to run the GetAuthorisedValues() tests.", 2 if $@;  | 
              64 | 
                      {   category         => 'BUG10656', | 
            
            
              | 64 | 
                      Koha::AuthorisedValueCategory->new({ category_name => 'BUG10656' })->store; | 
              65 | 
                          authorised_value => 'ZZZ',  | 
            
            
              | 65 | 
                      Koha::AuthorisedValue->new(  | 
              66 | 
                          lib              => 'Z_STAFF',  | 
            
            
              | 66 | 
                          {   category         => 'BUG10656', | 
              67 | 
                          lib_opac         => 'A_PUBLIC',  | 
            
            
              | 67 | 
                              authorised_value => 'ZZZ',  | 
              68 | 
                          imageurl         => ''  | 
            
            
              | 68 | 
                              lib              => 'Z_STAFF',  | 
              69 | 
                      }  | 
            
            
              | 69 | 
                              lib_opac         => 'A_PUBLIC',  | 
              70 | 
                  )->store;  | 
            
            
              | 70 | 
                              imageurl         => ''  | 
              71 | 
                  Koha::AuthorisedValue->new(  | 
            
            
              | 71 | 
                          }  | 
              72 | 
                      {   category         => 'BUG10656', | 
            
            
              | 72 | 
                      )->store;  | 
              73 | 
                          authorised_value => 'AAA',  | 
            
            
              | 73 | 
                      Koha::AuthorisedValue->new(  | 
              74 | 
                          lib              => 'A_STAFF',  | 
            
            
              | 74 | 
                          {   category         => 'BUG10656', | 
              75 | 
                          lib_opac         => 'Z_PUBLIC',  | 
            
            
               | 
               | 
              76 | 
                          imageurl         => ''  | 
            
            
              | 77 | 
                      }  | 
            
            
              | 78 | 
                  )->store;  | 
            
            
              | 79 | 
               | 
            
            
              | 80 | 
                  # the next one sets lib_opac to NULL; in that case, the staff  | 
            
            
              | 81 | 
                  # display value is meant to be used.  | 
            
            
              | 82 | 
                  Koha::AuthorisedValue->new(  | 
            
            
              | 83 | 
                      {   category         => 'BUG10656', | 
            
            
              | 84 | 
                          authorised_value => 'DDD',  | 
            
            
              | 85 | 
                          lib              => 'D_STAFF',  | 
            
            
              | 86 | 
                          lib_opac         => undef,  | 
            
            
              | 87 | 
                          imageurl         => ''  | 
            
            
              | 88 | 
                      }  | 
            
            
              | 89 | 
                  )->store;  | 
            
            
              | 90 | 
               | 
            
            
              | 91 | 
                  my $authvals = GetAuthorisedValues('BUG10656'); | 
            
            
              | 92 | 
                  cmp_deeply(  | 
            
            
              | 93 | 
                      $authvals,  | 
            
            
              | 94 | 
                      [  | 
            
            
              | 95 | 
                          { | 
            
            
              | 96 | 
                              id => ignore(),  | 
            
            
              | 97 | 
                              category => 'BUG10656',  | 
            
        
          | 75 | 
                          authorised_value => 'AAA',  | 
          98 | 
                          authorised_value => 'AAA',  | 
        
          
            
              | 76 | 
                              lib              => 'A_STAFF',  | 
              99 | 
                              lib => 'A_STAFF',  | 
            
            
              | 77 | 
                              lib_opac         => 'Z_PUBLIC',  | 
              100 | 
                              lib_opac => 'Z_PUBLIC',  | 
            
            
              | 78 | 
                              imageurl         => ''  | 
              101 | 
                              imageurl => '',  | 
            
            
              | 79 | 
                          }  | 
              102 | 
                          },  | 
            
            
              | 80 | 
                      )->store;  | 
              103 | 
                          { | 
            
            
              | 81 | 
               | 
              104 | 
                              id => ignore(),  | 
            
            
              | 82 | 
                      # the next one sets lib_opac to NULL; in that case, the staff  | 
              105 | 
                              category => 'BUG10656',  | 
            
            
              | 83 | 
                      # display value is meant to be used.  | 
               | 
               | 
            
            
              | 84 | 
                      Koha::AuthorisedValue->new(  | 
            
            
              | 85 | 
                          {   category         => 'BUG10656', | 
            
        
          | 86 | 
                          authorised_value => 'DDD',  | 
          106 | 
                          authorised_value => 'DDD',  | 
        
          
            
              | 87 | 
                              lib              => 'D_STAFF',  | 
              107 | 
                              lib => 'D_STAFF',  | 
            
            
              | 88 | 
                              lib_opac         => undef,  | 
              108 | 
                              lib_opac => undef,  | 
            
            
              | 89 | 
                              imageurl         => ''  | 
              109 | 
                              imageurl => '',  | 
            
            
              | 90 | 
                          }  | 
              110 | 
                          },  | 
            
            
              | 91 | 
                      )->store;  | 
              111 | 
                          { | 
            
            
              | 92 | 
               | 
              112 | 
                              id => ignore(),  | 
            
            
              | 93 | 
                      my $authvals = GetAuthorisedValues('BUG10656'); | 
              113 | 
                              category => 'BUG10656',  | 
            
            
              | 94 | 
                      cmp_deeply(  | 
              114 | 
                              authorised_value => 'ZZZ',  | 
            
            
              | 95 | 
                          $authvals,  | 
              115 | 
                              lib => 'Z_STAFF',  | 
            
            
              | 96 | 
                          [  | 
              116 | 
                              lib_opac => 'A_PUBLIC',  | 
            
            
              | 97 | 
                              { | 
              117 | 
                              imageurl => '',  | 
            
            
              | 98 | 
                                  id => ignore(),  | 
              118 | 
                          },  | 
            
            
              | 99 | 
                                  category => 'BUG10656',  | 
              119 | 
                      ],  | 
            
            
              | 100 | 
                                  authorised_value => 'AAA',  | 
              120 | 
                      'list of authorised values in staff mode sorted by staff label (bug 10656)'  | 
            
            
              | 101 | 
                                  lib => 'A_STAFF',  | 
              121 | 
                  );  | 
            
            
              | 102 | 
                                  lib_opac => 'Z_PUBLIC',  | 
              122 | 
                  $authvals = GetAuthorisedValues('BUG10656', 1); | 
            
            
              | 103 | 
                                  imageurl => '',  | 
              123 | 
                  cmp_deeply(  | 
            
            
              | 104 | 
                              },  | 
              124 | 
                      $authvals,  | 
            
            
              | 105 | 
                              { | 
              125 | 
                      [  | 
            
            
              | 106 | 
                                  id => ignore(),  | 
              126 | 
                          { | 
            
            
              | 107 | 
                                  category => 'BUG10656',  | 
              127 | 
                              id => ignore(),  | 
            
            
              | 108 | 
                                  authorised_value => 'DDD',  | 
              128 | 
                              category => 'BUG10656',  | 
            
            
              | 109 | 
                                  lib => 'D_STAFF',  | 
              129 | 
                              authorised_value => 'ZZZ',  | 
            
            
              | 110 | 
                                  lib_opac => undef,  | 
              130 | 
                              lib => 'A_PUBLIC',  | 
            
            
              | 111 | 
                                  imageurl => '',  | 
              131 | 
                              lib_opac => 'A_PUBLIC',  | 
            
            
              | 112 | 
                              },  | 
              132 | 
                              imageurl => '',  | 
            
            
              | 113 | 
                              { | 
              133 | 
                          },  | 
            
            
              | 114 | 
                                  id => ignore(),  | 
              134 | 
                          { | 
            
            
              | 115 | 
                                  category => 'BUG10656',  | 
              135 | 
                              id => ignore(),  | 
            
            
              | 116 | 
                                  authorised_value => 'ZZZ',  | 
              136 | 
                              category => 'BUG10656',  | 
            
            
              | 117 | 
                                  lib => 'Z_STAFF',  | 
              137 | 
                              authorised_value => 'DDD',  | 
            
            
              | 118 | 
                                  lib_opac => 'A_PUBLIC',  | 
              138 | 
                              lib => 'D_STAFF',  | 
            
            
              | 119 | 
                                  imageurl => '',  | 
              139 | 
                              lib_opac => undef,  | 
            
            
              | 120 | 
                              },  | 
              140 | 
                              imageurl => '',  | 
            
            
              | 121 | 
                          ],  | 
              141 | 
                          },  | 
            
            
              | 122 | 
                          'list of authorised values in staff mode sorted by staff label (bug 10656)'  | 
              142 | 
                          { | 
            
            
              | 123 | 
                      );  | 
              143 | 
                              id => ignore(),  | 
            
            
              | 124 | 
                      $authvals = GetAuthorisedValues('BUG10656', 1); | 
              144 | 
                              category => 'BUG10656',  | 
            
            
              | 125 | 
                      cmp_deeply(  | 
              145 | 
                              authorised_value => 'AAA',  | 
            
            
              | 126 | 
                          $authvals,  | 
              146 | 
                              lib => 'Z_PUBLIC',  | 
            
            
              | 127 | 
                          [  | 
              147 | 
                              lib_opac => 'Z_PUBLIC',  | 
            
            
              | 128 | 
                              { | 
              148 | 
                              imageurl => '',  | 
            
            
              | 129 | 
                                  id => ignore(),  | 
              149 | 
                          },  | 
            
            
              | 130 | 
                                  category => 'BUG10656',  | 
              150 | 
                      ],  | 
            
            
              | 131 | 
                                  authorised_value => 'ZZZ',  | 
              151 | 
                      'list of authorised values in OPAC mode sorted by OPAC label (bug 10656)'  | 
            
            
              | 132 | 
                                  lib => 'A_PUBLIC',  | 
              152 | 
                  );  | 
            
            
              | 133 | 
                                  lib_opac => 'A_PUBLIC',  | 
               | 
               | 
            
            
              | 134 | 
                                  imageurl => '',  | 
            
            
              | 135 | 
                              },  | 
            
            
              | 136 | 
                              { | 
            
            
              | 137 | 
                                  id => ignore(),  | 
            
            
              | 138 | 
                                  category => 'BUG10656',  | 
            
            
              | 139 | 
                                  authorised_value => 'DDD',  | 
            
            
              | 140 | 
                                  lib => 'D_STAFF',  | 
            
            
              | 141 | 
                                  lib_opac => undef,  | 
            
            
              | 142 | 
                                  imageurl => '',  | 
            
            
              | 143 | 
                              },  | 
            
            
              | 144 | 
                              { | 
            
            
              | 145 | 
                                  id => ignore(),  | 
            
            
              | 146 | 
                                  category => 'BUG10656',  | 
            
            
              | 147 | 
                                  authorised_value => 'AAA',  | 
            
            
              | 148 | 
                                  lib => 'Z_PUBLIC',  | 
            
            
              | 149 | 
                                  lib_opac => 'Z_PUBLIC',  | 
            
            
              | 150 | 
                                  imageurl => '',  | 
            
            
              | 151 | 
                              },  | 
            
            
              | 152 | 
                          ],  | 
            
            
              | 153 | 
                          'list of authorised values in OPAC mode sorted by OPAC label (bug 10656)'  | 
            
            
              | 154 | 
                      );  | 
            
            
              | 155 | 
                  }  | 
            
        
          | 156 | 
           | 
          153 | 
           | 
        
        
          | 157 | 
              warning_is { GetAuthorisedValues() } [], 'No warning when no parameter passed to GetAuthorisedValues'; | 
          154 | 
              warning_is { GetAuthorisedValues() } [], 'No warning when no parameter passed to GetAuthorisedValues'; | 
        
        
          | 158 | 
           | 
          155 | 
           | 
        
            
              | 159 | 
              -   | 
               | 
               |