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

(-)a/t/db_dependent/Koha/SharedContent.t (-18 / +12 lines)
Lines 111-129 is($request->method, 'POST', 'Share report - Method is post'); Link Here
111
is($request->uri->path, '/report.json', 'Path is report.json');
111
is($request->uri->path, '/report.json', 'Path is report.json');
112
112
113
# prepare shared data
113
# prepare shared data
114
my $loggedinuser = $builder->build({
114
my $library = $builder->build_object({
115
    source => 'Borrower',
115
    class => 'Koha::Libraries',
116
});
117
118
my $loggedinuser = $builder->build_object({
119
    class => 'Koha::Patrons',
116
    value => {
120
    value => {
117
        email => '',
121
        email => '',
118
        emailpro => '',
122
        emailpro => '',
119
        B_email => ''
123
        B_email => '',
124
        branchcode => $library->branchcode,
120
    }
125
    }
121
});
126
});
122
127
123
my $library = $builder->build({
124
    source => 'Branch',
125
});
126
127
my $biblio = $builder->build({
128
my $biblio = $builder->build({
128
    source => 'Biblio',
129
    source => 'Biblio',
129
});
130
});
Lines 153-169 my $subscription = $builder->build({ Link Here
153
    }
154
    }
154
});
155
});
155
156
156
C4::Context->_new_userenv('xxx');
157
t::lib::Mocks::mock_userenv({ patron => $loggedinuser});
157
C4::Context->set_userenv(0,0,0,
158
    $loggedinuser->{firstname},
159
    $loggedinuser->{surname},
160
    $library->{branchcode},
161
    'Midway Public Library', '', '', '');
162
158
163
t::lib::Mocks::mock_preference('language', 'en');
159
t::lib::Mocks::mock_preference('language', 'en');
164
160
165
$post_request = 1;
161
$post_request = 1;
166
$result = Koha::SharedContent::send_entity('en', $loggedinuser->{borrowernumber}, $subscription->{subscriptionid}, 'subscription');
162
$result = Koha::SharedContent::send_entity('en', $loggedinuser->borrowernumber, $subscription->{subscriptionid}, 'subscription');
167
is($result->{code}, 200, 'send_entity success');
163
is($result->{code}, 200, 'send_entity success');
168
164
169
my $s = Koha::Subscriptions->find($subscription->{subscriptionid});
165
my $s = Koha::Subscriptions->find($subscription->{subscriptionid});
Lines 171-184 is($s->mana_id, 5, 'Mana id is set'); Link Here
171
167
172
my $data = Koha::SharedContent::prepare_entity_data(
168
my $data = Koha::SharedContent::prepare_entity_data(
173
    '',
169
    '',
174
    $loggedinuser->{borrowernumber},
170
    $loggedinuser->borrowernumber,
175
    $subscription->{subscriptionid},
171
    $subscription->{subscriptionid},
176
    'subscription'
172
    'subscription'
177
);
173
);
178
174
179
is($data->{language}, 'en', 'Language is set to default');
175
is($data->{language}, 'en', 'Language is set to default');
180
my $branch = Koha::Libraries->find($library->{branchcode});
176
is($data->{exportemail}, $library->branchemail, 'Email is set with the userenv branch one');
181
is($data->{exportemail}, $branch->branchemail, 'Email is set with the userenv branch one');
182
is($data->{title}, $biblio->{title}, 'Shared title');
177
is($data->{title}, $biblio->{title}, 'Shared title');
183
is($data->{sfdescription}, $subscriptionFrequency->{description}, 'Shared sfdescription');
178
is($data->{sfdescription}, $subscriptionFrequency->{description}, 'Shared sfdescription');
184
is($data->{unit}, $subscriptionFrequency->{unit}, 'Shared unit');
179
is($data->{unit}, $subscriptionFrequency->{unit}, 'Shared unit');
185
- 

Return to bug 22850