| 
      
            Lines 24-40
          use JSON qw( decode_json );
      
      
        Link Here
      
     | 
  
        
          | 24 | 
          use Getopt::Long;  | 
          24 | 
          use Getopt::Long;  | 
        
        
          | 25 | 
          use Koha::Patrons;  | 
          25 | 
          use Koha::Patrons;  | 
        
        
          | 26 | 
          use Koha::Libraries;  | 
          26 | 
          use Koha::Libraries;  | 
        
            
               | 
               | 
              27 | 
              use Koha::Patron::Category;  | 
            
        
          | 27 | 
           | 
          28 | 
           | 
        
        
          | 28 | 
          my %data;  | 
          29 | 
          my %data;  | 
        
        
          | 29 | 
          my $class;  | 
          30 | 
          my $class;  | 
        
        
          | 30 | 
          my $teardown;  | 
          31 | 
          my $teardown;  | 
        
        
          | 31 | 
           | 
          32 | 
           | 
        
            
               | 
               | 
              33 | 
              =head1 DESCRIPTION  | 
            
            
              | 34 | 
               | 
            
            
              | 35 | 
              creates/deletes Koha Objects via command line, for each object to create an id has to be provided  | 
            
            
              | 36 | 
               | 
            
            
              | 37 | 
              create:  | 
            
            
              | 38 | 
              perl t/cypress/support/cypress_builder.pl  --class Koha::Patrons --data cardnumber=999 --data firstname=Mark  | 
            
            
              | 39 | 
               | 
            
            
              | 40 | 
              teardown:  | 
            
            
              | 41 | 
              perl t/cypress/support/cypress_builder.pl  --class Koha::Patrons --data cardnumber=999 --data firstname=Mark --teardown  | 
            
            
              | 42 | 
               | 
            
            
              | 43 | 
              =cut  | 
            
            
              | 44 | 
               | 
            
        
          | 32 | 
          GetOptions( "data=s" => \%data, "class=s" => \$class, "teardown" => \$teardown);  | 
          45 | 
          GetOptions( "data=s" => \%data, "class=s" => \$class, "teardown" => \$teardown);  | 
        
        
          | 33 | 
           | 
          46 | 
           | 
        
        
          | 34 | 
          my $builder = t::lib::TestBuilder->new;  | 
          47 | 
          my $builder = t::lib::TestBuilder->new;  | 
        
        
          | 35 | 
           | 
          48 | 
           | 
        
        
          | 36 | 
          my $objects = { | 
          49 | 
          my $objects = { | 
        
          
            
              | 37 | 
                  "Koha::Patrons" => { id => 'cardnumber', teardown => 'patron_delete', source => 'Borrower'}, | 
              50 | 
                  "Koha::Patrons" => { id => 'cardnumber', teardown => 'patron_delete',}, | 
            
        
          | 38 | 
          };  | 
          51 | 
          };  | 
        
        
          | 39 | 
           | 
          52 | 
           | 
        
        
          | 40 | 
          die unless $data{$objects->{$class}->{id}}; | 
          53 | 
          die unless $data{$objects->{$class}->{id}}; | 
        
  
    | 
      
            Lines 54-57
          sub patron_delete {
      
      
        Link Here
      
     | 
  
        
          | 54 | 
               | 
          67 | 
               | 
        
        
          | 55 | 
              $builder->delete({ source => 'Borrower',  records => $patron}); | 
          68 | 
              $builder->delete({ source => 'Borrower',  records => $patron}); | 
        
        
          | 56 | 
              $builder->delete({ source => 'Branch',  records => $branch});    | 
          69 | 
              $builder->delete({ source => 'Branch',  records => $branch});    | 
        
            
               | 
               | 
              70 | 
                  $builder->delete({ source => 'Category',  records => $patron->category});    | 
            
        
          | 57 | 
          }  | 
          71 | 
          }  | 
        
            
              | 58 | 
              -   | 
               | 
               |