|
Lines 20-26
use utf8;
Link Here
|
| 20 |
|
20 |
|
| 21 |
use C4::Context; |
21 |
use C4::Context; |
| 22 |
|
22 |
|
| 23 |
use Test::More tests => 6; |
23 |
use Test::More tests => 7; |
| 24 |
use Test::MockModule; |
24 |
use Test::MockModule; |
| 25 |
|
25 |
|
| 26 |
use C4::Context; |
26 |
use C4::Context; |
|
Lines 299-304
subtest 'Encoding in session variables' => sub {
Link Here
|
| 299 |
|
299 |
|
| 300 |
}; |
300 |
}; |
| 301 |
|
301 |
|
|
|
302 |
subtest 'OPAC - Suggest for purchase' => sub { |
| 303 |
plan tests => 4; |
| 304 |
|
| 305 |
my $builder = t::lib::TestBuilder->new; |
| 306 |
|
| 307 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 1 } } ); |
| 308 |
my $password = Koha::AuthUtils::generate_password( $patron->category ); |
| 309 |
t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); |
| 310 |
$patron->set_password( { password => $password } ); |
| 311 |
$s->opac_auth( $patron->userid, $password ); |
| 312 |
|
| 313 |
my ( $biblionumber, $biblioitemnumber ) = add_biblio(); |
| 314 |
my $biblio = Koha::Biblios->find($biblionumber); |
| 315 |
$driver->get( $opac_base_url . "opac-detail.pl?biblionumber=$biblionumber" ); |
| 316 |
|
| 317 |
$s->click({ href => '/opac-suggestions.pl?op=add&biblionumber=' . $biblionumber }); |
| 318 |
is( $driver->find_element('//input[@id="title"]')->get_value(), |
| 319 |
$biblio->title, |
| 320 |
"Suggestion's title correctly filled in with biblio's title" ); |
| 321 |
|
| 322 |
$driver->find_element('//textarea[@id="note"]')->send_keys('some notes'); |
| 323 |
$s->submit_form; |
| 324 |
|
| 325 |
my $suggestions = Koha::Suggestions->search( { biblionumber => $biblio->biblionumber } ); |
| 326 |
is( $suggestions->count, 1, 'Suggestion created' ); |
| 327 |
my $suggestion = $suggestions->next; |
| 328 |
is( $suggestion->title, $biblio->title, q{suggestion's title has biblio's title} ); |
| 329 |
is( $suggestion->note, 'some notes', q{suggestion's note correctly saved} ); |
| 330 |
|
| 331 |
push @cleanup, $biblio, $suggestion; |
| 332 |
}; |
| 333 |
|
| 334 |
|
| 302 |
$driver->quit(); |
335 |
$driver->quit(); |
| 303 |
|
336 |
|
| 304 |
END { |
337 |
END { |
| 305 |
- |
|
|