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

(-)a/t/db_dependent/UsageStats.t (-8 / +7 lines)
Lines 85-91 my $report = C4::UsageStats->BuildReport(); Link Here
85
85
86
isa_ok( $report,            'HASH', '$report is a HASH' );
86
isa_ok( $report,            'HASH', '$report is a HASH' );
87
isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' );
87
isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' );
88
is( scalar( keys( $report->{library} ) ), 5,  "There are 5 fields in $report->{library}" );
88
is( scalar( keys %{$report->{library}} ), 5,  "There are 5 fields in $report->{library}" );
89
is( $report->{library}->{id},             0,  "UsageStatsID           is good" );
89
is( $report->{library}->{id},             0,  "UsageStatsID           is good" );
90
is( $report->{library}->{name},           '', "UsageStatsLibraryName  is good" );
90
is( $report->{library}->{name},           '', "UsageStatsLibraryName  is good" );
91
is( $report->{library}->{url},            '', "UsageStatsLibraryUrl   is good" );
91
is( $report->{library}->{url},            '', "UsageStatsLibraryUrl   is good" );
Lines 103-109 $report = C4::UsageStats->BuildReport(); Link Here
103
103
104
isa_ok( $report,            'HASH', '$report is a HASH' );
104
isa_ok( $report,            'HASH', '$report is a HASH' );
105
isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' );
105
isa_ok( $report->{library}, 'HASH', '$report->{library} is a HASH' );
106
is( scalar( keys( $report->{library} ) ), 5,         "There are 5 fields in $report->{library}" );
106
is( scalar( keys %{$report->{library}} ), 5,         "There are 5 fields in $report->{library}" );
107
is( $report->{library}->{id},             1,         "UsageStatsID            is good" );
107
is( $report->{library}->{id},             1,         "UsageStatsID            is good" );
108
is( $report->{library}->{name},           'NAME',    "UsageStatsLibraryName   is good" );
108
is( $report->{library}->{name},           'NAME',    "UsageStatsLibraryName   is good" );
109
is( $report->{library}->{url},            'URL',     "UsageStatsLibraryUrl    is good" );
109
is( $report->{library}->{url},            'URL',     "UsageStatsLibraryUrl    is good" );
Lines 116-122 $report = C4::UsageStats->BuildReport(); Link Here
116
116
117
isa_ok( $report,              'HASH', '$report is a HASH' );
117
isa_ok( $report,              'HASH', '$report is a HASH' );
118
isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' );
118
isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' );
119
is( scalar( keys( $report->{volumetry} ) ), 8, "There are 8 fields in $report->{volumetry}" );
119
is( scalar( keys %{$report->{volumetry}} ), 8, "There are 8 fields in $report->{volumetry}" );
120
is( $report->{volumetry}->{biblio},         0, "There is no biblio" );
120
is( $report->{volumetry}->{biblio},         0, "There is no biblio" );
121
is( $report->{volumetry}->{items},          0, "There is no items" );
121
is( $report->{volumetry}->{items},          0, "There is no items" );
122
is( $report->{volumetry}->{auth_header},    0, "There is no auth_header" );
122
is( $report->{volumetry}->{auth_header},    0, "There is no auth_header" );
Lines 133-139 $report = C4::UsageStats->BuildReport(); Link Here
133
133
134
isa_ok( $report,              'HASH', '$report is a HASH' );
134
isa_ok( $report,              'HASH', '$report is a HASH' );
135
isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' );
135
isa_ok( $report->{volumetry}, 'HASH', '$report->{volumetry} is a HASH' );
136
is( scalar( keys( $report->{volumetry} ) ), 8, "There are 8 fields in $report->{volumetry}" );
136
is( scalar( keys %{$report->{volumetry}} ), 8, "There are 8 fields in $report->{volumetry}" );
137
is( $report->{volumetry}->{biblio},         3, "There are 3 biblio" );
137
is( $report->{volumetry}->{biblio},         3, "There are 3 biblio" );
138
is( $report->{volumetry}->{items},          3, "There are 3 items" );
138
is( $report->{volumetry}->{items},          3, "There are 3 items" );
139
is( $report->{volumetry}->{auth_header},    2, "There are 2 auth_header" );
139
is( $report->{volumetry}->{auth_header},    2, "There are 2 auth_header" );
Lines 150-156 mocking_systempreferences_to_a_set_value(0); Link Here
150
$report = C4::UsageStats->BuildReport();
150
$report = C4::UsageStats->BuildReport();
151
isa_ok( $report,                      'HASH', '$report is a HASH' );
151
isa_ok( $report,                      'HASH', '$report is a HASH' );
152
isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' );
152
isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' );
153
is( scalar( keys( $report->{systempreferences} ) ), 248, "There are 248 fields in $report->{systempreferences}" );
153
is( scalar( keys %{$report->{systempreferences}} ), 248, "There are 248 fields in $report->{systempreferences}" );
154
verif_systempreferences_values( $report, 0 );
154
verif_systempreferences_values( $report, 0 );
155
155
156
#mock with values
156
#mock with values
Lines 159-165 mocking_systempreferences_to_a_set_value(1); Link Here
159
$report = C4::UsageStats->BuildReport();
159
$report = C4::UsageStats->BuildReport();
160
isa_ok( $report,                      'HASH', '$report is a HASH' );
160
isa_ok( $report,                      'HASH', '$report is a HASH' );
161
isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' );
161
isa_ok( $report->{systempreferences}, 'HASH', '$report->{systempreferences} is a HASH' );
162
is( scalar( keys( $report->{systempreferences} ) ), 248, "There are 248 fields in $report->{systempreferences}" );
162
is( scalar( keys %{$report->{systempreferences}} ), 248, "There are 248 fields in $report->{systempreferences}" );
163
verif_systempreferences_values( $report, 1 );
163
verif_systempreferences_values( $report, 1 );
164
164
165
# ---------- Testing ReportToCommunity ----------
165
# ---------- Testing ReportToCommunity ----------
Lines 584-590 sub mocking_systempreferences_to_a_set_value { Link Here
584
sub verif_systempreferences_values {
584
sub verif_systempreferences_values {
585
    my ( $report, $value_to_test ) = @_;
585
    my ( $report, $value_to_test ) = @_;
586
586
587
    foreach my $key ( keys $report->{systempreferences} ) {
587
    foreach my $key ( keys %{$report->{systempreferences}} ) {
588
        is( $report->{systempreferences}->{$key}, $value_to_test, "\$report->{systempreferences}->{$key} = $value_to_test" );
588
        is( $report->{systempreferences}->{$key}, $value_to_test, "\$report->{systempreferences}->{$key} = $value_to_test" );
589
    }
589
    }
590
}
590
}
591
- 

Return to bug 14097