View | Details | Raw Unified | Return to bug 13906
Collapse All | Expand All

(-)a/t/db_dependent/TestObjects/Biblios/BiblioFactory.pm (+96 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Biblios::BiblioFactory;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use C4::Biblio;
25
26
use t::db_dependent::TestObjects::Biblios::ExampleBiblios;
27
use t::db_dependent::TestObjects::ObjectFactory;
28
29
=head t::db_dependent::TestObjects::Biblios::createTestGroup( $data [, $hashKey] )
30
Calls C4::Biblio::TransformKohaToMarc() to make a MARC::Record and add it to
31
the DB. Returns a HASH of MARC::Records.
32
The HASH is keyed with the biblionumber, or the given $hashKey.
33
The biblionumber is injected to the MARC::Record-object to be easily accessable,
34
so we can get it like this:
35
    $records->{$key}->{biblionumber};
36
37
See C4::Biblio::TransformKohaToMarc() for how the biblio- or biblioitem-tables'
38
columns need to be given.
39
=cut
40
41
sub createTestGroup {
42
    my ($biblios, $hashKey) = @_;
43
    my %records;
44
    foreach my $biblio (@$biblios) {
45
        my $record = C4::Biblio::TransformKohaToMarc($biblio);
46
        my ($biblionumber, $biblioitemnumber) = C4::Biblio::AddBiblio($record,'');
47
        $record->{biblionumber} = $biblionumber;
48
49
        my $key = t::db_dependent::TestObjects::ObjectFactory::getHashKey($biblio, $biblionumber, $hashKey);
50
51
        $records{$key} = $record;
52
    }
53
    return \%records;
54
}
55
56
=head
57
58
    my $records = createTestGroup();
59
    ##Do funky stuff
60
    deleteTestGroup($records);
61
62
Removes the given test group from the DB.
63
64
=cut
65
66
sub deleteTestGroup {
67
    my $records = shift;
68
69
    my ( $biblionumberFieldCode, $biblionumberSubfieldCode ) =
70
            C4::Biblio::GetMarcFromKohaField( "biblio.biblionumber", '' );
71
72
    my $schema = Koha::Database->new_schema();
73
    while( my ($key, $record) = each %$records) {
74
        my $biblionumber = $record->subfield($biblionumberFieldCode, $biblionumberSubfieldCode);
75
        $schema->resultset('Biblio')->search($biblionumber)->delete_all();
76
        $schema->resultset('Biblioitem')->search($biblionumber)->delete_all();
77
    }
78
}
79
sub _deleteTestGroupFromIdentifiers {
80
    my $testGroupIdentifiers = shift;
81
82
    my $schema = Koha::Database->new_schema();
83
    foreach my $isbn (@$testGroupIdentifiers) {
84
        $schema->resultset('Biblio')->search({"biblioitems.isbn" => $isbn},{join => 'biblioitems'})->delete();
85
        $schema->resultset('Biblioitem')->search({isbn => $isbn})->delete();
86
    }
87
}
88
89
sub createTestGroup1 {
90
    return t::db_dependent::TestObjects::Biblios::ExampleBiblios::createTestGroup1(@_);
91
}
92
sub deleteTestGroup1 {
93
    return t::db_dependent::TestObjects::Biblios::ExampleBiblios::deleteTestGroup1(@_);
94
}
95
96
1;
(-)a/t/db_dependent/TestObjects/Biblios/ExampleBiblios.pm (+75 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Biblios::ExampleBiblios;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use t::db_dependent::TestObjects::Biblios::BiblioFactory;
25
26
=head createTestGroupX
27
28
    my $hash_of_records = TestObjects::C4::Biblio::ExampleBiblios::createTestGroup1();
29
30
    ##Do stuff with the test group##
31
32
    #Remember to delete them after use.
33
    TestObjects::C4::Biblio::ExampleBiblios::deleteTestGroup1($biblionumbers);
34
=cut
35
36
my @testGroup1Identifiers = ('9519671580', '9519671581', '9519671582', '9519671583',
37
                            ); #So we can later delete these Biblios
38
sub createTestGroup1 {
39
    my $records = [
40
        {
41
            "biblio.title"         => 'I wish I met your mother',
42
            "biblio.author"        => 'Pertti Kurikka',
43
            "biblio.copyrightdate" => '1960',
44
            "biblioitems.isbn"     => $testGroup1Identifiers[0],
45
            "biblioitems.itemtype" => 'BK',
46
        },
47
        {
48
            "biblio.title"         => 'Me and your mother',
49
            "biblio.author"        => 'Jaakko Kurikka',
50
            "biblio.copyrightdate" => '1961',
51
            "biblioitems.isbn"     => $testGroup1Identifiers[1],
52
            "biblioitems.itemtype" => 'BK',
53
        },
54
        {
55
            "biblio.title"         => 'How I met your mother',
56
            "biblio.author"        => 'Martti Kurikka',
57
            "biblio.copyrightdate" => '1962',
58
            "biblioitems.isbn"     => $testGroup1Identifiers[2],
59
            "biblioitems.itemtype" => 'DV',
60
        },
61
        {
62
            "biblio.title"         => 'How I wish I had met your mother',
63
            "biblio.author"        => 'Tapio Kurikka',
64
            "biblio.copyrightdate" => '1963',
65
            "biblioitems.isbn"     => $testGroup1Identifiers[3],
66
            "biblioitems.itemtype" => 'DV',
67
        },
68
    ];
69
    return t::db_dependent::TestObjects::Biblios::BiblioFactory::createTestGroup($records, 'biblioitems.isbn');
70
}
71
sub deleteTestGroup1 {
72
    t::db_dependent::TestObjects::Biblios::BiblioFactory::_deleteTestGroupFromIdentifiers(\@testGroup1Identifiers);
73
}
74
75
1;
(-)a/t/db_dependent/TestObjects/Borrowers/BorrowerFactory.pm (+151 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Borrowers::BorrowerFactory;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
use Scalar::Util qw(blessed);
24
25
use C4::Members;
26
27
use t::db_dependent::TestObjects::Borrowers::ExampleBorrowers;
28
29
use Koha::Exception::BadParameter;
30
31
use base qw(t::db_dependent::TestObjects::ObjectFactory);
32
33
sub new {
34
    my ($class) = @_;
35
36
    my $self = {};
37
    bless($self, $class);
38
    return $self;
39
}
40
41
=head createTestGroup( $data [, $hashKey] )
42
43
    my $borrowerFactory = t::db_dependent::TestObjects::Borrowers::BorrowerFactory->new();
44
    $borrowerFactory->createTestGroup([
45
            {firstname => 'Olli-Antti',
46
             surname   => 'Kivi',
47
             cardnumber => '11A001',
48
             branch     => 'CPL',
49
            },
50
        ], undef, $testContext);
51
52
The HASH is keyed with the given $hashKey or 'koha.borrowers.cardnumber'
53
See C4::Members::AddMember() for how the table columns need to be given.
54
55
@RETURNS HASHRef of $hashKey => $borrower-objects:
56
=cut
57
58
sub createTestGroup {
59
    my ($self, $objects, $hashKey, $featureStash, $scenarioStash, $stepStash) = @_;
60
    $self->_validateStashes($featureStash, $scenarioStash, $stepStash);
61
    $hashKey = 'cardnumber' unless $hashKey;
62
63
    my %objects;
64
    foreach my $object (@$objects) {
65
66
        $self->validateAndPopulateDefaultValues($object, $hashKey);
67
68
        #Try to add the Borrower, but it might fail because of the barcode or other UNIQUE constraint.
69
        #Catch the error and try looking for the Borrower if we suspect it is present in the DB.
70
        my $borrowernumber;
71
        eval {
72
            $borrowernumber = C4::Members::AddMember(%$object);
73
        };
74
        if ($@) {
75
            if (blessed($@) && $@->isa('DBIx::Class::Exception') &&
76
                $@->{msg} =~ /Duplicate entry '.+?' for key 'cardnumber'/) { #DBIx should throw other types of exceptions instead of this general type :(
77
                #This exception type is OK, we ignore this and try fetching the existing Object next.
78
            }
79
            else {
80
                die $@;
81
            }
82
        }
83
84
        #If adding failed, we still get some strange borrowernumber result.
85
        #Check for sure by finding the real borrower.
86
        my $borrower = C4::Members::GetMember(cardnumber => $object->{cardnumber});
87
        unless ($borrower) {
88
            carp "BorrowerFactory:> No borrower for cardnumber '".$object->{cardnumber}."'";
89
            next();
90
        }
91
92
        my $key = $self->getHashKey($borrower, $borrowernumber, $hashKey);
93
94
        $objects{$key} = $borrower;
95
    }
96
97
    $self->_persistToStashes(\%objects, 'borrowers', $featureStash, $scenarioStash, $stepStash);
98
99
    return \%objects;
100
}
101
102
=head validateAndPopulateDefaultValues
103
@OVERLOAD
104
105
Validates given Object parameters and makes sure that critical fields are given
106
and populates defaults for missing values.
107
=cut
108
109
sub validateAndPopulateDefaultValues {
110
    my ($self, $borrower, $hashKey) = @_;
111
    $self->SUPER::validateAndPopulateDefaultValues($borrower, $hashKey);
112
113
    $borrower->{categorycode} = 'PT' unless $borrower->{categorycode};
114
    $borrower->{branchcode}   = 'CPL' unless $borrower->{branchcode};
115
    $borrower->{dateofbirth}  = '1985-10-12' unless $borrower->{dateofbirth};
116
}
117
118
=head deleteTestGroup
119
120
    my $records = createTestGroup();
121
    ##Do funky stuff
122
    deleteTestGroup($records);
123
124
Removes the given test group from the DB.
125
126
=cut
127
128
sub deleteTestGroup {
129
    my ($self, $objects) = @_;
130
131
    my $schema = Koha::Database->new_schema();
132
    while( my ($key, $object) = each %$objects) {
133
        $schema->resultset('Borrower')->find($object->{borrowernumber})->delete();
134
    }
135
}
136
sub _deleteTestGroupFromIdentifiers {
137
    my $testGroupIdentifiers = shift;
138
139
    my $schema = Koha::Database->new_schema();
140
    foreach my $key (@$testGroupIdentifiers) {
141
        $schema->resultset('Borrower')->find({"cardnumber" => $key})->delete();
142
    }
143
}
144
145
sub createTestGroup1 {
146
    return t::db_dependent::TestObjects::Borrowers::ExampleBorrowers::createTestGroup1(@_);
147
}
148
sub deleteTestGroup1 {
149
    return t::db_dependent::TestObjects::Borrowers::ExampleBorrowers::deleteTestGroup1(@_);
150
}
151
1;
(-)a/t/db_dependent/TestObjects/Borrowers/ExampleBorrowers.pm (+64 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Borrowers::ExampleBorrowers;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use t::db_dependent::TestObjects::Borrowers::BorrowerFactory;
25
26
=head createTestGroupX
27
28
    You should use the appropriate Factory-class to create these test-objects.
29
30
=cut
31
32
my @testGroup1Identifiers = ('167Azel0001', '167Azel0002', '167Azel0003', '167Azel0004',
33
                             '167Azel0005', '167Azel0006', '167Azel0007', '167Azel0008',
34
                            );
35
36
=head createTestGroup1
37
@RETURNS Reference to Hash of Borrowers with hash-keys as borrowers.cardnumber
38
=cut
39
sub createTestGroup1 {
40
    my @borrowers = (
41
        {cardnumber => $testGroup1Identifiers[0], branchcode => 'CPL', categorycode => 'YA',
42
         surname => 'Costly', firstname => 'Colt', address => 'Street 11', zipcode => '10221'},
43
        {cardnumber => $testGroup1Identifiers[1], branchcode => 'CPL', categorycode => 'YA',
44
         surname => 'Dearly', firstname => 'Colt', address => 'Street 12', zipcode => '10222'},
45
        {cardnumber => $testGroup1Identifiers[2], branchcode => 'CPL', categorycode => 'YA',
46
         surname => 'Pricy', firstname => 'Colt', address => 'Street 13', zipcode => '10223'},
47
        {cardnumber => $testGroup1Identifiers[3], branchcode => 'CPL', categorycode => 'YA',
48
         surname => 'Expensive', firstname => 'Colt', address => 'Street 14', zipcode => '10224'},
49
        {cardnumber => $testGroup1Identifiers[4], branchcode => 'FPL', categorycode => 'YA',
50
         surname => 'Cheap', firstname => 'Colt', address => 'Street 15', zipcode => '10225'},
51
        {cardnumber => $testGroup1Identifiers[5], branchcode => 'FPL', categorycode => 'YA',
52
         surname => 'Poor', firstname => 'Colt', address => 'Street 16', zipcode => '10226'},
53
        {cardnumber => $testGroup1Identifiers[6], branchcode => 'FPL', categorycode => 'YA',
54
         surname => 'Stingy', firstname => 'Colt', address => 'Street 17', zipcode => '10227'},
55
        {cardnumber => $testGroup1Identifiers[7], branchcode => 'FPL', categorycode => 'YA',
56
         surname => 'Impoverished', firstname => 'Colt', address => 'Street 18', zipcode => '10228'},
57
    );
58
    return t::db_dependent::TestObjects::Borrowers::BorrowerFactory::createTestGroup(\@borrowers, 'cardnumber');
59
}
60
sub deleteTestGroup1 {
61
    t::db_dependent::TestObjects::Borrowers::BorrowerFactory::_deleteTestGroupFromIdentifiers(\@testGroup1Identifiers);
62
}
63
64
1;
(-)a/t/db_dependent/TestObjects/Issues/ExampleIssues.pm (+92 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Issues::ExampleIssues;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use t::db_dependent::TestObjects::Issues::IssueFactory;
25
26
=head createTestGroupX
27
28
    You should use the appropriate Factory-class to create these test-objects.
29
30
=cut
31
32
33
=head createTestGroup1
34
35
    my $biblios = t::db_dependent::TestObjects::Biblios::BiblioFactory::createTestGroup1();
36
    my $items = t::db_dependent::TestObjects::Items::ItemFactory::createTestGroup1($biblios);
37
    my $borrowers = t::db_dependent::TestObjects::Borrowers::BorrowerFactory::createTestGroup1();
38
    my $issues = t::db_dependent::TestObjects::Issues::IssueFactory::createTestGroup1();
39
40
You need to create the dependent test groups to use this Issues test group 1
41
42
=cut
43
sub createTestGroup1 {
44
    my $issuesDependencies = [ {
45
            cardnumber  => '167Azel0001',
46
            barcode     => '167Nxxx0001',
47
            daysAgoIssued  => 1,
48
            daysOverdue => -14,
49
        },{
50
            cardnumber  => '167Azel0002',
51
            barcode     => '167Nxxx0002',
52
            daysAgoIssued  => 1,
53
            daysOverdue => -14,
54
        },{
55
            cardnumber  => '167Azel0003',
56
            barcode     => '167Nxxx0003',
57
            daysAgoIssued  => 1,
58
            daysOverdue => -14,
59
        },{
60
            cardnumber  => '167Azel0004',
61
            barcode     => '167Nxxx0004',
62
            daysAgoIssued  => 1,
63
            daysOverdue => -14,
64
        },{
65
            cardnumber  => '167Azel0005',
66
            barcode     => '167Nxxx0005',
67
            daysAgoIssued  => 1,
68
            daysOverdue => -14,
69
        },{
70
            cardnumber  => '167Azel0006',
71
            barcode     => '167Nxxx0006',
72
            daysAgoIssued  => 1,
73
            daysOverdue => -14,
74
        },{
75
            cardnumber  => '167Azel0007',
76
            barcode     => '167Nxxx0007',
77
            daysAgoIssued  => 1,
78
            daysOverdue => -14,
79
        },{
80
            cardnumber  => '167Azel0008',
81
            barcode     => '167Nxxx0008',
82
            daysAgoIssued  => 1,
83
            daysOverdue => -14,
84
        },
85
    ];
86
    return t::db_dependent::TestObjects::Issues::IssueFactory::createTestGroup($issuesDependencies);
87
}
88
sub deleteTestGroup1 {
89
    t::db_dependent::TestObjects::Issues::IssueFactory::_deleteTestGroupFromIdentifiers();
90
}
91
92
1;
(-)a/t/db_dependent/TestObjects/Issues/IssueFactory.pm (+151 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Issues::IssueFactory;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use C4::Circulation;
25
use C4::Members;
26
use C4::Items;
27
28
use t::db_dependent::TestObjects::Issues::ExampleIssues;
29
use t::db_dependent::TestObjects::ObjectFactory;
30
31
=head t::db_dependent::TestObjects::Issues::IssueFactory::createTestGroup( $data [, $hashKey, $checkoutBranchRule] )
32
Returns a Issues-HASH.
33
The HASH is keyed with the PRIMARY KEY, or the given $hashKey.
34
35
@PARAM1, ARRAY of HASHes.
36
  [ {
37
        cardnumber  => '167Azava0001',
38
        barcode     => '167Nfafa0010',
39
        daysOverdue => 7,     #This issue's duedate was 7 days ago. If undef, then uses today as the checkout day.
40
        daysAgoIssued  => 28, #This Issue hapened 28 days ago. If undef, then uses today.
41
    },
42
    {
43
        ...
44
    }
45
  ]
46
@PARAM2, String, the HASH-element to use as the returning HASHes key.
47
@PARAM3, String, the rule on where to check these Issues out:
48
                 'homebranch', uses the Item's homebranch as the checkout branch
49
                 'holdingbranch', uses the Item's holdingbranch as the checkout branch
50
                 undef, uses the current Environment branch
51
                 '<branchCode>', checks out all Issues from the given branchCode
52
=cut
53
54
sub createTestGroup {
55
    my ($objects, $hashKey, $checkoutBranchRule) = @_;
56
57
    #If running this test factory from unit tests or bare script, the context might not have been initialized.
58
    unless (C4::Context->userenv()) {
59
        C4::Context->_new_userenv('testGroupsTest');
60
        C4::Context->set_userenv(undef, undef, undef,
61
                           undef, undef,
62
                           'CPL', undef, undef,
63
                           undef, undef, undef);
64
    }
65
    my $oldContextBranch = C4::Context->userenv()->{branch};
66
67
    my %objects;
68
    foreach my $issueParams (@$objects) {
69
        my $borrower = C4::Members::GetMember(cardnumber => $issueParams->{cardnumber});
70
        my $item = C4::Items::GetItem(undef, $issueParams->{barcode});
71
72
        my $duedate = DateTime->now(time_zone => C4::Context->tz());
73
        if ($issueParams->{daysOverdue}) {
74
            $duedate->subtract(days =>  $issueParams->{daysOverdue}  );
75
        }
76
77
        my $issuedate = DateTime->now(time_zone => C4::Context->tz());
78
        if ($issueParams->{daysAgoIssued}) {
79
            $issuedate->subtract(days =>  $issueParams->{daysAgoIssued}  );
80
        }
81
82
        #Set the checkout branch
83
        my $checkoutBranch;
84
        if (not($checkoutBranchRule)) {
85
            #Use the existing userenv()->{branch}
86
        }
87
        elsif ($checkoutBranchRule eq 'homebranch') {
88
            $checkoutBranch = $item->{homebranch};
89
        }
90
        elsif ($checkoutBranchRule eq 'holdingbranch') {
91
            $checkoutBranch = $item->{holdingbranch};
92
        }
93
        elsif ($checkoutBranchRule) {
94
            $checkoutBranch = $checkoutBranchRule;
95
        }
96
        C4::Context->userenv()->{branch} = $checkoutBranch if $checkoutBranch;
97
98
        my $datedue = C4::Circulation::AddIssue( $borrower, $issueParams->{barcode}, $duedate, undef, $issuedate );
99
        #We want the issue_id as well.
100
        my $issues = C4::Circulation::GetIssues({ borrowernumber => $borrower->{borrowernumber}, itemnumber => $item->{itemnumber} });
101
        my $issue = $issues->[0];
102
        unless ($issue) {
103
            carp "IssueFactory:> No issue for cardnumber '".$issueParams->{cardnumber}."' and barcode '".$issueParams->{barcode}."'";
104
            next();
105
        }
106
107
        my $key = t::db_dependent::TestObjects::ObjectFactory::getHashKey($issue, $issue->{issue_id}, $hashKey);
108
109
        $issue->{barcode} = $issueParams->{barcode}; #Save the barcode here as well for convenience.
110
        $objects{$key} = $issue;
111
    }
112
113
    C4::Context->userenv()->{branch} = $oldContextBranch;
114
    return \%objects;
115
}
116
117
=head
118
119
    my $objects = createTestGroup();
120
    ##Do funky stuff
121
    deleteTestGroup($records);
122
123
Removes the given test group from the DB.
124
125
=cut
126
127
sub deleteTestGroup {
128
    my $objects = shift;
129
130
    my $schema = Koha::Database->new_schema();
131
    while( my ($key, $object) = each %$objects) {
132
        $schema->resultset('Issue')->find($object->{issue_id})->delete();
133
    }
134
}
135
sub _deleteTestGroupFromIdentifiers {
136
    my $testGroupIdentifiers = shift;
137
138
    my $schema = Koha::Database->new_schema();
139
    foreach my $key (@$testGroupIdentifiers) {
140
        $schema->resultset('Issue')->find({"barcode" => $key})->delete();
141
    }
142
}
143
144
sub createTestGroup1 {
145
    return t::db_dependent::TestObjects::Issues::ExampleIssues::createTestGroup1(@_);
146
}
147
sub deleteTestGroup1 {
148
    return t::db_dependent::TestObjects::Issues::ExampleIssues::deleteTestGroup1(@_);
149
}
150
151
1;
(-)a/t/db_dependent/TestObjects/Items/ExampleItems.pm (+108 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Items::ExampleItems;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use t::db_dependent::TestObjects::Items::ItemFactory;
25
26
=head createTestGroupX
27
28
    You should use the appropriate Factory-class to create these test-objects.
29
30
=cut
31
32
my @testGroup1Identifiers = ('167Nxxx0001', '167Nxxx0002', '167Nxxx0003', '167Nxxx0004',
33
                             '167Nxxx0005', '167Nxxx0006', '167Nxxx0007', '167Nxxx0008',
34
                            );
35
36
sub shareItemsToBiblios {
37
    my ($items, $biblios) = @_;
38
    my @biblioKeys = keys %$biblios;
39
40
    for (my $i=0 ; $i<@$items ; $i++) {
41
        my $item = $items->[$i];
42
        my $biblioKey = $biblioKeys[ $i % scalar(@biblioKeys) ]; #Split these Items to each of the Biblios
43
        my $biblio = $biblios->{$biblioKey};
44
45
        unless ($biblio && $biblio->{biblionumber}) {
46
            carp "ExampleItems:> Item \$barcode '".$item->{barcode}."' doesn't have a biblionumber, skipping.";
47
            next();
48
        }
49
        $item->{biblionumber} = $biblio->{biblionumber};
50
    }
51
}
52
53
=head createTestGroupX
54
55
    my $items = t::db_dependent::TestObjects::Items::ItemFactory::createTestGroup1( $biblios );
56
57
Creates a group of Items for you, evenly shared amongst the given Biblios.
58
59
@PARAM1 Reference to ARRAY, of Biblio HASHes, with the biblionumber as the HASH-key.
60
@RETURNS Reference to ARRAY of Item-HASHes, with the 'barcode' as the HASH-key.
61
=cut
62
sub createTestGroup1 {
63
    my $biblios = shift;
64
65
    my $items = [
66
        {barcode => $testGroup1Identifiers[0],
67
         homebranch => 'CPL', holdingbranch => 'CPL',
68
         price => '0.5', replacementprice => '0.5', itype => 'BK'
69
        },
70
        {barcode => $testGroup1Identifiers[1],
71
         homebranch => 'CPL', holdingbranch => 'FFL',
72
         price => '1.5', replacementprice => '1.5', itype => 'BK'
73
        },
74
        {barcode => $testGroup1Identifiers[2],
75
         homebranch => 'CPL', holdingbranch => 'FFL',
76
         price => '2.5', replacementprice => '2.5', itype => 'BK'
77
        },
78
        {barcode => $testGroup1Identifiers[3],
79
         homebranch => 'FFL', holdingbranch => 'FFL',
80
         price => '3.5', replacementprice => '3.5', itype => 'BK'
81
        },
82
        {barcode => $testGroup1Identifiers[4],
83
         homebranch => 'FFL', holdingbranch => 'FFL',
84
         price => '4.5', replacementprice => '4.5', itype => 'VM'
85
        },
86
        {barcode => $testGroup1Identifiers[5],
87
         homebranch => 'FFL', holdingbranch => 'FFL',
88
         price => '5.5', replacementprice => '5.5', itype => 'VM'
89
        },
90
        {barcode => $testGroup1Identifiers[6],
91
         homebranch => 'FFL', holdingbranch => 'CPL',
92
         price => '6.5', replacementprice => '6.5', itype => 'VM'
93
        },
94
        {barcode => $testGroup1Identifiers[7],
95
         homebranch => 'CPL', holdingbranch => 'CPL',
96
         price => '7.5', replacementprice => '7.5', itype => 'VM'
97
        },
98
    ];
99
100
    shareItemsToBiblios($items, $biblios);
101
102
    return t::db_dependent::TestObjects::Items::ItemFactory::createTestGroup($items, 'barcode');
103
}
104
sub deleteTestGroup1 {
105
    t::db_dependent::TestObjects::Items::ItemFactory::_deleteTestGroupFromIdentifiers(\@testGroup1Identifiers);
106
}
107
108
1;
(-)a/t/db_dependent/TestObjects/Items/ItemFactory.pm (+104 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::Items::ItemFactory;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use C4::Items;
25
26
use t::db_dependent::TestObjects::Items::ExampleItems;
27
use t::db_dependent::TestObjects::ObjectFactory;
28
29
=head t::db_dependent::TestObjects::Items::ItemFactory::createTestGroup( $data [, $hashKey] )
30
Returns a HASH of objects.
31
Each Item is expected to contain the biblionumber of the Biblio they are added into.
32
    eg. $item->{biblionumber} = 550242;
33
34
The HASH is keyed with the PRIMARY KEY, or the given $hashKey.
35
36
See C4::Items::AddItem() for how the table columns need to be given.
37
=cut
38
39
sub createTestGroup {
40
    my ($objects, $hashKey) = @_;
41
42
    my %objects;
43
    foreach my $object (@$objects) {
44
        my ($biblionumber, $biblioitemnumber, $itemnumber);
45
        eval {
46
            ($biblionumber, $biblioitemnumber, $itemnumber) = C4::Items::AddItem($object, $object->{biblionumber});
47
        };
48
        if ($@) {
49
            if (blessed($@) && $@->isa('DBIx::Class::Exception') &&
50
                $@->{msg} =~ /Duplicate entry '.+?' for key 'itembarcodeidx'/) { #DBIx should throw other types of exceptions instead of this general type :(
51
                #This exception type is OK, we ignore this and try fetching the existing Object next.
52
            }
53
            else {
54
                die $@;
55
            }
56
        }
57
        my $item = C4::Items::GetItem(undef, $object->{barcode});
58
        unless ($item) {
59
            carp "ItemFactory:> No item for barcode '".$object->{barcode}."'";
60
            next();
61
        }
62
63
        my $key = t::db_dependent::TestObjects::ObjectFactory::getHashKey($item, $itemnumber, $hashKey);
64
65
        $objects{$key} = $item;
66
    }
67
    return \%objects;
68
}
69
70
=head
71
72
    my $objects = createTestGroup();
73
    ##Do funky stuff
74
    deleteTestGroup($records);
75
76
Removes the given test group from the DB.
77
78
=cut
79
80
sub deleteTestGroup {
81
    my $objects = shift;
82
83
    my $schema = Koha::Database->new_schema();
84
    while( my ($key, $object) = each %$objects) {
85
        $schema->resultset('Item')->find($object->{itemnumber})->delete();
86
    }
87
}
88
sub _deleteTestGroupFromIdentifiers {
89
    my $testGroupIdentifiers = shift;
90
91
    my $schema = Koha::Database->new_schema();
92
    foreach my $key (@$testGroupIdentifiers) {
93
        $schema->resultset('Item')->find({"barcode" => $key})->delete();
94
    }
95
}
96
97
sub createTestGroup1 {
98
    return t::db_dependent::TestObjects::Items::ExampleItems::createTestGroup1(@_);
99
}
100
sub deleteTestGroup1 {
101
    return t::db_dependent::TestObjects::Items::ExampleItems::deleteTestGroup1(@_);
102
}
103
104
1;
(-)a/t/db_dependent/TestObjects/LetterTemplates/ExampleLetterTemplates.pm (+92 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::LetterTemplates::ExampleLetterTemplates;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use t::db_dependent::TestObjects::LetterTemplates::LetterTemplateFactory;
25
26
=head createTestGroupX
27
28
    You should use the appropriate Factory-class to create these test-objects.
29
30
=cut
31
32
my @testGroup1Identifiers = ('circulation-ODUE1-CPL-print', 'circulation-ODUE2-CPL-print', 'circulation-ODUE3-CPL-print',
33
                             'circulation-ODUE1-CPL-email', 'circulation-ODUE2-CPL-email', 'circulation-ODUE3-CPL-email',
34
                             'circulation-ODUE1-CPL-sms', 'circulation-ODUE2-CPL-sms', 'circulation-ODUE3-CPL-sms',
35
                            );
36
37
sub createTestGroup1 {
38
    my @letterTemplates = (
39
        {letter_id => $testGroup1Identifiers[0],
40
         module => 'circulation', code => 'ODUE1', branchcode => 'CPL', name => 'Notice1',
41
         is_html => undef, title => 'Notice1', message_transport_type => 'print',
42
         content => '<item>Barcode: <<items.barcode>>, bring it back!</item>',
43
        },
44
        {letter_id => $testGroup1Identifiers[0],
45
         module => 'circulation', code => 'ODUE2', branchcode => 'CPL', name => 'Notice2',
46
         is_html => undef, title => 'Notice2', message_transport_type => 'print',
47
         content => '<item>Barcode: <<items.barcode>></item>',
48
        },
49
        {letter_id => $testGroup1Identifiers[0],
50
         module => 'circulation', code => 'ODUE3', branchcode => 'CPL', name => 'Notice3',
51
         is_html => undef, title => 'Notice3', message_transport_type => 'print',
52
         content => '<item>Barcode: <<items.barcode>>, bring back!</item>',
53
        },
54
        {letter_id => $testGroup1Identifiers[0],
55
         module => 'circulation', code => 'ODUE1', branchcode => 'CPL', name => 'Notice1',
56
         is_html => undef, title => 'Notice1', message_transport_type => 'email',
57
         content => '<item>Barcode: <<items.barcode>>, bring it back!</item>',
58
        },
59
        {letter_id => $testGroup1Identifiers[0],
60
         module => 'circulation', code => 'ODUE2', branchcode => 'CPL', name => 'Notice2',
61
         is_html => undef, title => 'Notice2', message_transport_type => 'email',
62
         content => '<item>Barcode: <<items.barcode>></item>',
63
        },
64
        {letter_id => $testGroup1Identifiers[0],
65
         module => 'circulation', code => 'ODUE3', branchcode => 'CPL', name => 'Notice3',
66
         is_html => undef, title => 'Notice3', message_transport_type => 'email',
67
         content => '<item>Barcode: <<items.barcode>>, bring back!</item>',
68
        },
69
        {letter_id => $testGroup1Identifiers[0],
70
         module => 'circulation', code => 'ODUE1', branchcode => 'CPL', name => 'Notice1',
71
         is_html => undef, title => 'Notice1', message_transport_type => 'sms',
72
         content => '<item>Barcode: <<items.barcode>>, bring it back!</item>',
73
        },
74
        {letter_id => $testGroup1Identifiers[0],
75
         module => 'circulation', code => 'ODUE2', branchcode => 'CPL', name => 'Notice2',
76
         is_html => undef, title => 'Notice2', message_transport_type => 'sms',
77
         content => '<item>Barcode: <<items.barcode>></item>',
78
        },
79
        {letter_id => $testGroup1Identifiers[0],
80
         module => 'circulation', code => 'ODUE3', branchcode => 'CPL', name => 'Notice3',
81
         is_html => undef, title => 'Notice3', message_transport_type => 'sms',
82
         content => '<item>Barcode: <<items.barcode>>, bring back!</item>',
83
        },
84
    );
85
86
    return t::db_dependent::TestObjects::LetterTemplates::LetterTemplateFactory::createTestGroup(\@letterTemplates);
87
}
88
sub deleteTestGroup1 {
89
    t::db_dependent::TestObjects::LetterTemplates::LetterTemplateFactory::_deleteTestGroupFromIdentifiers(\@testGroup1Identifiers);
90
}
91
92
1;
(-)a/t/db_dependent/TestObjects/LetterTemplates/LetterTemplateFactory.pm (+101 lines)
Line 0 Link Here
1
package t::db_dependent::TestObjects::LetterTemplates::LetterTemplateFactory;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use C4::Letters;
25
26
use t::db_dependent::TestObjects::LetterTemplates::ExampleLetterTemplates;
27
use t::db_dependent::TestObjects::ObjectFactory qw(getHashKey);
28
29
=head t::db_dependent::TestObjects::LetterTemplates::LetterTemplateFactory::createTestGroup( $data [, $hashKey] )
30
Returns a HASH of Koha::Schema::Result::Letter
31
The HASH is keyed with the PRIMARY KEYS eg. 'circulation-ODUE2-CPL-print', or the given $hashKey.
32
=cut
33
34
#Incredibly the Letters-module has absolutely no Create or Update-component to operate on Letter templates?
35
#Tests like these are brittttle. :(
36
sub createTestGroup {
37
    my ($objects, $hashKey) = @_;
38
39
    my %objects;
40
    my $schema = Koha::Database->new()->schema();
41
    foreach my $object (@$objects) {
42
        my $rs = $schema->resultset('Letter');
43
        my $result = $rs->update_or_create({
44
                module     => $object->{module},
45
                code       => $object->{code},
46
                branchcode => ($object->{branchcode}) ? $object->{branchcode} : '',
47
                name       => $object->{name},
48
                is_html    => $object->{is_html},
49
                title      => $object->{title},
50
                message_transport_type => $object->{message_transport_type},
51
                content    => $object->{content},
52
        });
53
54
        my @pks = $result->id();
55
        my $key = t::db_dependent::TestObjects::ObjectFactory::getHashKey($object, join('-',@pks), $hashKey);
56
57
        $objects{$key} = $result;
58
    }
59
    return \%objects;
60
}
61
62
=head
63
64
    my $objects = createTestGroup();
65
    ##Do funky stuff
66
    deleteTestGroup($records);
67
68
Removes the given test group from the DB.
69
70
=cut
71
72
sub deleteTestGroup {
73
    my $objects = shift;
74
75
    my $schema = Koha::Database->new_schema();
76
    while( my ($key, $object) = each %$objects) {
77
        $object->delete();
78
    }
79
}
80
sub _deleteTestGroupFromIdentifiers {
81
    my $testGroupIdentifiers = shift;
82
83
    my $schema = Koha::Database->new_schema();
84
    foreach my $key (@$testGroupIdentifiers) {
85
        my ($module, $code, $branchcode, $mtt) = split('-',$key);
86
        $schema->resultset('Letter')->find({module => $module,
87
                                                    code => $code,
88
                                                    branchcode => $branchcode,
89
                                                    message_transport_type => $mtt,
90
                                                })->delete();
91
    }
92
}
93
94
sub createTestGroup1 {
95
    return t::db_dependent::TestObjects::LetterTemplates::ExampleLetterTemplates::createTestGroup1();
96
}
97
sub deleteTestGroup1 {
98
    return t::db_dependent::TestObjects::LetterTemplates::ExampleLetterTemplates::deleteTestGroup1();
99
}
100
101
1;
(-)a/t/db_dependent/TestObjects/ObjectFactory.pm (-1 / +108 lines)
Line 0 Link Here
0
- 
1
package t::db_dependent::TestObjects::ObjectFactory;
2
3
# Copyright Vaara-kirjastot 2015
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#
20
21
use Modern::Perl;
22
use Carp;
23
24
use t::db_dependent::TestObjects::Borrowers::BorrowerFactory;
25
26
use Koha::Exception::BadParameter;
27
28
=head tearDownTestContext
29
30
Given a testContext stash populated using one of the TestObjectFactory implementations createTestGroup()-subroutines,
31
Removes all the persisted objects in the stash.
32
=cut
33
34
sub tearDownTestContext {
35
    my ($self, $stash) = @_;
36
37
    if ($stash->{borrowers}) {
38
        t::db_dependent::TestObjects::Borrowers::BorrowerFactory->deleteTestGroup($stash->{borrowers});
39
    }
40
}
41
42
sub getHashKey {
43
    my ($self, $object, $primaryKey, $hashKey) = @_;
44
45
    if ($hashKey && not($object->{$hashKey})) {
46
        carp ref($self)."::getHashKey($object, $primaryKey, $hashKey):> Given HASH has no \$hashKey '$hashKey'.";
47
    }
48
    return ($hashKey) ? $object->{$hashKey} : $primaryKey;
49
}
50
51
=head validateAndPopulateDefaultValues
52
@INTERFACE
53
54
Validates given Object parameters and makes sure that critical fields are given
55
and populates defaults for missing values.
56
You must overload this in the subclassing factory if you want to validate and check the given parameters
57
=cut
58
59
sub validateAndPopulateDefaultValues {
60
    my ($self, $object, $hashKey) = @_;
61
62
    unless ($object->{$hashKey}) {
63
        Koha::Exception::BadParameter->throw(error => ref($self)."():> You want to access test Objects using hashKey '$hashKey', but you haven't supplied it as a Object parameter. ObjectFactories need a unique identifier to function properly.");
64
    }
65
}
66
67
=head _validateStashes
68
69
    _validateStashes($featureStash, $scenarioStash, $stepStash);
70
71
Validates that the given stahses are what they are supposed to be... ,  HASHrefs.
72
@THROWS Koha::Exception::BadParameter, if validation failed.
73
=cut
74
75
sub _validateStashes {
76
    my ($self, $featureStash, $scenarioStash, $stepStash) = @_;
77
78
    if ($featureStash && not(ref($featureStash) eq 'HASH')) {
79
        Koha::Exception::BadParameter->throw(error => __PACKAGE__."->_validateStashes():> Stash '\$featureStash' is not a HASHRef! Leave it 'undef' if you don't want to use it.");
80
    }
81
    if ($scenarioStash && not(ref($scenarioStash) eq 'HASH')) {
82
        Koha::Exception::BadParameter->throw(error => __PACKAGE__."->_validateStashes():> Stash '\$scenarioStash' is not a HASHRef! Leave it 'undef' if you don't want to use it.");
83
    }
84
    if ($scenarioStash && not(ref($stepStash) eq 'HASH')) {
85
        Koha::Exception::BadParameter->throw(error => __PACKAGE__."->_validateStashes():> Stash '\$stepStash' is not a HASHRef! Leave it 'undef' if you don't want to use it.");
86
    }
87
}
88
89
=head _persistToStashes
90
91
    _persistToStashes($objects, $stashKey, $featureStash, $scenarioStash, $stepStash);
92
93
Saves the given HASH to the given stashes using the given stash key.
94
=cut
95
96
sub _persistToStashes {
97
    my ($self, $objects, $stashKey, $featureStash, $scenarioStash, $stepStash) = @_;
98
99
    if ($featureStash || $scenarioStash || $stepStash) {
100
        while( my ($key, $borrower) = each %$objects) {
101
            $featureStash->{$stashKey}->{ $key }  = $borrower if $featureStash;
102
            $scenarioStash->{$stashKey}->{ $key } = $borrower if $scenarioStash;
103
            $stepStash->{$stashKey}->{ $key }     = $borrower if $stepStash;
104
        }
105
    }
106
}
107
108
1;

Return to bug 13906