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

(-)a/t/db_dependent/selenium/self_registration.t (-2 / +15 lines)
Lines 33-39 eval { require Selenium::Remote::Driver; }; Link Here
33
if ( $@ ) {
33
if ( $@ ) {
34
    plan skip_all => "Selenium::Remote::Driver is needed for selenium tests.";
34
    plan skip_all => "Selenium::Remote::Driver is needed for selenium tests.";
35
} else {
35
} else {
36
    plan tests => 1;
36
    plan tests => 2;
37
}
37
}
38
38
39
my $s = t::lib::Selenium->new;
39
my $s = t::lib::Selenium->new;
Lines 45-55 my $builder = t::lib::TestBuilder->new; Link Here
45
my $PatronSelfRegistration_value = C4::Context->preference('PatronSelfRegistration');
45
my $PatronSelfRegistration_value = C4::Context->preference('PatronSelfRegistration');
46
C4::Context->set_preference('PatronSelfRegistration', '1');
46
C4::Context->set_preference('PatronSelfRegistration', '1');
47
47
48
my $PatronSelfRegistrationDefaultCategory_value = C4::Context->preference('PatronSelfRegistrationDefaultCategory');
49
48
our @cleanup;
50
our @cleanup;
49
51
52
subtest 'Disable if no default category' => sub {
53
    plan tests => 1;
54
55
    $driver->get( $opac_base_url . 'opac-memberentry.pl' );
56
    like( $driver->get_title(), qr(Koha online catalog), );
57
};
58
50
subtest 'Set flags' => sub {
59
subtest 'Set flags' => sub {
51
    plan tests => 2;
60
    plan tests => 2;
52
61
62
    my $default_category = $builder->build_object( { class => 'Koha::Patron::Categories' } );
63
    C4::Context->set_preference( 'PatronSelfRegistrationDefaultCategory', $default_category->categorycode );
64
53
    $driver->get($opac_base_url . 'opac-memberentry.pl');
65
    $driver->get($opac_base_url . 'opac-memberentry.pl');
54
    like( $driver->get_title(), qr(Register a new account), );
66
    like( $driver->get_title(), qr(Register a new account), );
55
67
Lines 64-69 subtest 'Set flags' => sub { Link Here
64
    my $patron = Koha::Patrons->search({ surname => "a surname" })->next;
76
    my $patron = Koha::Patrons->search({ surname => "a surname" })->next;
65
    is( $patron->flags, undef, 'flags must be undef even if user tried to pass it' );
77
    is( $patron->flags, undef, 'flags must be undef even if user tried to pass it' );
66
    push @cleanup, $patron;
78
    push @cleanup, $patron;
79
    push @cleanup, $default_category;
67
};
80
};
68
81
69
82
Lines 71-75 $driver->quit(); Link Here
71
84
72
END {
85
END {
73
    C4::Context->set_preference('PatronSelfRegistration', $PatronSelfRegistration_value);
86
    C4::Context->set_preference('PatronSelfRegistration', $PatronSelfRegistration_value);
87
    C4::Context->set_preference('PatronSelfRegistration', $PatronSelfRegistrationDefaultCategory_value);
74
    $_->delete for @cleanup;
88
    $_->delete for @cleanup;
75
};
89
};
76
- 

Return to bug 27634