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

(-)a/t/db_dependent/selenium/patrons_search.t (-7 / +6 lines)
Lines 161-179 subtest 'Search patrons' => sub { Link Here
161
    $driver->get( $base_url . "/members/members-home.pl" );
161
    $driver->get( $base_url . "/members/members-home.pl" );
162
    my @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option');
162
    my @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option');
163
    is( scalar @adv_options, $nb_standard_fields + 1, 'All standard fields are searchable if DefaultPatronSearchFields not set. middle_name is there.');
163
    is( scalar @adv_options, $nb_standard_fields + 1, 'All standard fields are searchable if DefaultPatronSearchFields not set. middle_name is there.');
164
    is( $adv_options[0]->get_value(), 'firstname,middle_name,surname,othernames,cardnumber,userid', 'Standard search uses hard coded list when DefaultPatronSearchFields not set');
164
    is( $adv_options[0]->get_value(), 'firstname|middle_name|surname|othernames|cardnumber|userid', 'Standard search uses hard coded list when DefaultPatronSearchFields not set');
165
    my @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option');
165
    my @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option');
166
    is( scalar @filter_options, $nb_standard_fields + 1, 'All standard fields + middle_name are searchable by filter if DefaultPatronSearchFields not set');
166
    is( scalar @filter_options, $nb_standard_fields + 1, 'All standard fields + middle_name are searchable by filter if DefaultPatronSearchFields not set');
167
    is( $filter_options[0]->get_value(), 'firstname,middle_name,surname,othernames,cardnumber,userid', 'Standard filter uses hard coded list when DefaultPatronSearchFields not set');
167
    is( $filter_options[0]->get_value(), 'firstname|middle_name|surname|othernames|cardnumber|userid', 'Standard filter uses hard coded list when DefaultPatronSearchFields not set');
168
    C4::Context->set_preference('DefaultPatronSearchFields',"firstname,initials");
168
    C4::Context->set_preference('DefaultPatronSearchFields',"firstname|initials");
169
    $driver->get( $base_url . "/members/members-home.pl" );
169
    $driver->get( $base_url . "/members/members-home.pl" );
170
    @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option');
170
    @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option');
171
    is( scalar @adv_options, $nb_standard_fields, 'New option added when DefaultPatronSearchFields is populated with a field. Note that middle_name disappears, we do not want it if not part of DefaultPatronSearchFields');
171
    is( scalar @adv_options, $nb_standard_fields, 'New option added when DefaultPatronSearchFields is populated with a field. Note that middle_name disappears, we do not want it if not part of DefaultPatronSearchFields');
172
    is( $adv_options[0]->get_value(), 'firstname,initials', 'Standard search uses DefaultPatronSearchFields when populated');
172
    is( $adv_options[0]->get_value(), 'firstname|initials', 'Standard search uses DefaultPatronSearchFields when populated');
173
    @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option');
173
    @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option');
174
    is( scalar @filter_options, $nb_standard_fields, 'New filter option added when DefaultPatronSearchFields is populated with a field');
174
    is( scalar @filter_options, $nb_standard_fields, 'New filter option added when DefaultPatronSearchFields is populated with a field');
175
    is( $filter_options[0]->get_value(), 'firstname,initials', 'Standard filter uses DefaultPatronSearchFields when populated');
175
    is( $filter_options[0]->get_value(), 'firstname|initials', 'Standard filter uses DefaultPatronSearchFields when populated');
176
    C4::Context->set_preference('DefaultPatronSearchFields',"firstname,initials,horses");
176
    C4::Context->set_preference('DefaultPatronSearchFields',"firstname|initials|horses");
177
    $driver->get( $base_url . "/members/members-home.pl" );
177
    $driver->get( $base_url . "/members/members-home.pl" );
178
    @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option');
178
    @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option');
179
    @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option');
179
    @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option');
180
- 

Return to bug 29822