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

(-)a/t/db_dependent/www/auth_values_input_www.t (-12 / +28 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use utf8;
20
use utf8;
21
use Test::More tests => 28;
21
use Test::More tests => 33;
22
use Test::WWW::Mechanize;
22
use Test::WWW::Mechanize;
23
use XML::Simple;
23
use XML::Simple;
24
use JSON;
24
use JSON;
Lines 71-88 $agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'load main page' ); Link Here
71
71
72
$category = '学協会μμ';
72
$category = '学協会μμ';
73
$dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category);
73
$dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category);
74
$dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name = ?|, undef, $category);
74
75
76
$expected_base = q|authorised_values.pl|;
75
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
77
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
76
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
78
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
77
$agent->form_name('Aform');
79
$agent->form_name('Aform');
80
$agent->field('category', $category);
81
$agent->click_ok( '', "Create new AV category " );
82
83
$agent->base_like(qr|$expected_base|, "check base");
84
$add_form_link_exists = 0;
85
for my $link ( $agent->links() ) {
86
    if ( $link->url =~ m|authorised_values.pl\?op=add_form&category=$category| ) {
87
        $add_form_link_exists = 1;
88
    }
89
}
90
is( $add_form_link_exists, 1, 'Add a new category button should be displayed');
91
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=$category", 'Open to create a new AV for this category' );
92
93
$agent->form_name('Aform');
78
$agent->field('authorised_value', 'επιμεq');
94
$agent->field('authorised_value', 'επιμεq');
79
$agent->field('lib_opac', 'autdesc2');
95
$agent->field('lib_opac', 'autdesc2');
80
$agent->field('lib', 'desc1');
96
$agent->field('lib', 'desc1');
81
$agent->field('category', $category);
82
$agent->field('branches', '');
97
$agent->field('branches', '');
83
$agent->click_ok( '', "Create new auth category and value" );
98
$agent->click_ok( '', "Create a new value for the category" );
84
99
85
$expected_base = q|authorised_values.pl|;
86
$agent->base_like(qr|$expected_base|, "check base");
100
$agent->base_like(qr|$expected_base|, "check base");
87
$add_form_link_exists = 0;
101
$add_form_link_exists = 0;
88
$delete_form_link_exists = 0;
102
$delete_form_link_exists = 0;
Lines 93-100 for my $link ( $agent->links() ) { Link Here
93
        $delete_form_link_exists = 1;
107
        $delete_form_link_exists = 1;
94
    }
108
    }
95
}
109
}
96
is( $add_form_link_exists, 1, );
110
is( $add_form_link_exists, 1, 'Add a new category button should be displayed');
97
is( $delete_form_link_exists, 1, );
111
is( $delete_form_link_exists, 1, '');
98
112
99
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Return to Authorized values page' );
113
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Return to Authorized values page' );
100
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=学協会μμ&offset=0", 'Search the values inserted' );
114
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=学協会μμ&offset=0", 'Search the values inserted' );
Lines 122-141 if ($id_to_del) { Link Here
122
136
123
$category = 'tòmas';
137
$category = 'tòmas';
124
$dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category);
138
$dbh->do(q|DELETE FROM authorised_values WHERE category = ?|, undef, $category);
139
$dbh->do(q|DELETE FROM authorised_value_categories WHERE category_name = ?|, undef, $category);
125
140
126
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
141
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl", 'Connect to Authorized values page' );
127
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
142
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form", 'Open to create a new category' );
128
$agent->form_name('Aform');
143
$agent->form_name('Aform');
144
$agent->field('category', $category);
145
$agent->click_ok( '', "Create new AV category" );
146
147
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?op=add_form&category=$category", 'Open to create a new AV for this category' );
148
$agent->form_name('Aform');
129
$agent->field('authorised_value', 'ràmen');
149
$agent->field('authorised_value', 'ràmen');
130
$agent->field('lib_opac', 'autdesc2');
150
$agent->field('lib_opac', 'autdesc2');
131
$agent->field('lib', 'desc1');
151
$agent->field('lib', 'desc1');
132
$agent->field('category', $category);
133
$agent->field('branches', '');
152
$agent->field('branches', '');
134
$agent->click_ok( '', "Create new auth category and value" );
153
$agent->click_ok( '', "Create a new value for the category" );
135
$agent->get_ok( "$intranet/cgi-bin/koha/admin/authorised_values.pl?searchfield=tòmas&offset=0", 'Search the values inserted' );
136
154
137
$expected_base = q|authorised_values.pl\?searchfield=| . uri_escape_utf8( $category );
155
$expected_base = q|authorised_values.pl|;
138
#$expected_base = q|authorised_values.pl\?searchfield=| . $category;
139
$agent->base_like(qr|$expected_base|, "check base");
156
$agent->base_like(qr|$expected_base|, "check base");
140
$add_form_link_exists = 0;
157
$add_form_link_exists = 0;
141
$delete_form_link_exists = 0;
158
$delete_form_link_exists = 0;
142
- 

Return to bug 17540