| 
      
            Lines 19-25
          
      
      
        Link Here
      
     | 
  
        
          | 19 | 
           | 
          19 | 
           | 
        
        
          | 20 | 
          use Modern::Perl;  | 
          20 | 
          use Modern::Perl;  | 
        
        
          | 21 | 
           | 
          21 | 
           | 
        
          
            
              | 22 | 
              use Test::More tests => 7;  | 
              22 | 
              use Test::More tests => 3;  | 
            
        
          | 23 | 
           | 
          23 | 
           | 
        
        
          | 24 | 
          use t::lib::TestBuilder;  | 
          24 | 
          use t::lib::TestBuilder;  | 
        
        
          | 25 | 
          use Test::Exception;  | 
          25 | 
          use Test::Exception;  | 
        
  
    | 
      
            Lines 274-339
          subtest 'type() tests' => sub {
      
      
        Link Here
      
     | 
  
        
          | 274 | 
           | 
          274 | 
           | 
        
        
          | 275 | 
              $schema->storage->txn_rollback;  | 
          275 | 
              $schema->storage->txn_rollback;  | 
        
        
          | 276 | 
          };  | 
          276 | 
          };  | 
        
            
              | 277 | 
               | 
               | 
               | 
            
            
              | 278 | 
              subtest 'display_checkout() tests' => sub { | 
            
            
              | 279 | 
               | 
            
            
              | 280 | 
                  plan tests => 2;  | 
            
            
              | 281 | 
               | 
            
            
              | 282 | 
                  $schema->storage->txn_begin;  | 
            
            
              | 283 | 
               | 
            
            
              | 284 | 
                  my $patron = $builder->build( { source => 'Borrower' } )->{borrowernumber}; | 
            
            
              | 285 | 
                  my $attribute_type_1 = $builder->build(  | 
            
            
              | 286 | 
                      {   source => 'BorrowerAttributeType', | 
            
            
              | 287 | 
                          value  => { display_checkout => 1 } | 
            
            
              | 288 | 
                      }  | 
            
            
              | 289 | 
                  );  | 
            
            
              | 290 | 
               | 
            
            
              | 291 | 
                  my $attribute_1 = Koha::Patron::Attribute->new(  | 
            
            
              | 292 | 
                      {   borrowernumber => $patron, | 
            
            
              | 293 | 
                          code           => $attribute_type_1->{code}, | 
            
            
              | 294 | 
                          attribute      => $patron  | 
            
            
              | 295 | 
                      }  | 
            
            
              | 296 | 
                  );  | 
            
            
              | 297 | 
                  is( $attribute_1->display_checkout, 1, '->display_checkout returns 1' );  | 
            
            
              | 298 | 
               | 
            
            
              | 299 | 
                  my $attribute_type_2 = $builder->build(  | 
            
            
              | 300 | 
                      {   source => 'BorrowerAttributeType', | 
            
            
              | 301 | 
                          value  => { display_checkout => 0 } | 
            
            
              | 302 | 
                      }  | 
            
            
              | 303 | 
                  );  | 
            
            
              | 304 | 
               | 
            
            
              | 305 | 
                  my $attribute_2 = Koha::Patron::Attribute->new(  | 
            
            
              | 306 | 
                      {   borrowernumber => $patron, | 
            
            
              | 307 | 
                          code           => $attribute_type_2->{code}, | 
            
            
              | 308 | 
                          attribute      => $patron  | 
            
            
              | 309 | 
                      }  | 
            
            
              | 310 | 
                  );  | 
            
            
              | 311 | 
                  is( $attribute_2->display_checkout, 0, '->display_checkout returns 0' );  | 
            
            
              | 312 | 
               | 
            
            
              | 313 | 
                  $schema->storage->txn_rollback;  | 
            
            
              | 314 | 
              };  | 
            
            
              | 315 | 
               | 
            
            
              | 316 | 
              subtest 'type_description() and value_description tests' => sub { | 
            
            
              | 317 | 
               | 
            
            
              | 318 | 
                  plan tests => 2;  | 
            
            
              | 319 | 
               | 
            
            
              | 320 | 
                  $schema->storage->txn_begin;  | 
            
            
              | 321 | 
               | 
            
            
              | 322 | 
                  my $patron = $builder->build( { source => 'Borrower' } )->{borrowernumber}; | 
            
            
              | 323 | 
                  my $attribute_type_1 = $builder->build(  | 
            
            
              | 324 | 
                      {   source => 'BorrowerAttributeType', | 
            
            
              | 325 | 
                          value  => { description => "Type 1" } | 
            
            
              | 326 | 
                      }  | 
            
            
              | 327 | 
                  );  | 
            
            
              | 328 | 
               | 
            
            
              | 329 | 
                  my $attribute_1 = Koha::Patron::Attribute->new(  | 
            
            
              | 330 | 
                      {   borrowernumber => $patron, | 
            
            
              | 331 | 
                          code           => $attribute_type_1->{code}, | 
            
            
              | 332 | 
                          attribute      => "Attribute 1"  | 
            
            
              | 333 | 
                      }  | 
            
            
              | 334 | 
                  );  | 
            
            
              | 335 | 
                  is( $attribute_1->type_description, "Type 1" , '->type_description returns right value' );  | 
            
            
              | 336 | 
                  is( $attribute_1->value_description, "Attribute 1" , '->value_description returns right value' );  | 
            
            
              | 337 | 
               | 
            
            
              | 338 | 
                  $schema->storage->txn_rollback;  | 
            
            
              | 339 | 
              };  |