Lines 40-46
my $builder = t::lib::TestBuilder->new;
Link Here
|
40 |
|
40 |
|
41 |
our @cleanup; |
41 |
our @cleanup; |
42 |
subtest 'Search patrons' => sub { |
42 |
subtest 'Search patrons' => sub { |
43 |
plan tests => 6; |
43 |
plan tests => 12; |
44 |
|
44 |
|
45 |
my @patrons; |
45 |
my @patrons; |
46 |
my $borrowernotes = q|<strong>just 'a" note</strong> \123 ❤|; |
46 |
my $borrowernotes = q|<strong>just 'a" note</strong> \123 ❤|; |
Lines 58-63
subtest 'Search patrons' => sub {
Link Here
|
58 |
my $library = $builder->build_object( |
58 |
my $library = $builder->build_object( |
59 |
{ class => 'Koha::Libraries', value => { branchname => $branchname } } |
59 |
{ class => 'Koha::Libraries', value => { branchname => $branchname } } |
60 |
); |
60 |
); |
|
|
61 |
my $default_patron_search_fields = C4::Context->preference('DefaultPatronSearchFields'); |
61 |
for my $i ( 1 .. 25 ) { |
62 |
for my $i ( 1 .. 25 ) { |
62 |
push @patrons, |
63 |
push @patrons, |
63 |
$builder->build_object( |
64 |
$builder->build_object( |
Lines 77-83
subtest 'Search patrons' => sub {
Link Here
|
77 |
} |
78 |
} |
78 |
|
79 |
|
79 |
$s->auth; |
80 |
$s->auth; |
|
|
81 |
C4::Context->set_preference('DefaultPatronSearchFields',""); |
80 |
$driver->get( $base_url . "/members/members-home.pl" ); |
82 |
$driver->get( $base_url . "/members/members-home.pl" ); |
|
|
83 |
my @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
84 |
my @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
85 |
is( scalar @adv_options, 11, 'All standard fields are searchable if DefaultPatronSearchFields not set'); |
86 |
is( scalar @filter_options, 11, 'All standard fields are searchable by filter if DefaultPatronSearchFields not set'); |
87 |
C4::Context->set_preference('DefaultPatronSearchFields',"initials"); |
88 |
$driver->get( $base_url . "/members/members-home.pl" ); |
89 |
@adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
90 |
@filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
91 |
is( scalar @adv_options, 12, 'New option added when DefaultPatronSearchFields is populated with a field'); |
92 |
is( scalar @filter_options, 12, 'New filter option added when DefaultPatronSearchFields is populated with a field'); |
93 |
C4::Context->set_preference('DefaultPatronSearchFields',"initials,horses"); |
94 |
$driver->get( $base_url . "/members/members-home.pl" ); |
95 |
@adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
96 |
@filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
97 |
is( scalar @adv_options, 12, 'Invalid option not added when DefaultPatronSearchFields is populated with an invalid field'); |
98 |
is( scalar @filter_options, 12, 'Invalid filter option not added when DefaultPatronSearchFields is populated with an invalid field'); |
99 |
C4::Context->set_preference('DefaultPatronSearchFields',""); |
81 |
$s->fill_form( { searchmember_filter => 'test_patron' } ); |
100 |
$s->fill_form( { searchmember_filter => 'test_patron' } ); |
82 |
$s->submit_form; |
101 |
$s->submit_form; |
83 |
my $first_patron = $patrons[0]; |
102 |
my $first_patron = $patrons[0]; |
Lines 114-119
subtest 'Search patrons' => sub {
Link Here
|
114 |
push @cleanup, $_ for @patrons; |
133 |
push @cleanup, $_ for @patrons; |
115 |
push @cleanup, $library; |
134 |
push @cleanup, $library; |
116 |
push @cleanup, $patron_category; |
135 |
push @cleanup, $patron_category; |
|
|
136 |
C4::Context->set_preference('DefaultPatronSearchFields',$default_patron_search_fields); |
117 |
}; |
137 |
}; |
118 |
|
138 |
|
119 |
END { |
139 |
END { |
120 |
- |
|
|