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

(-)a/t/Scrubber.t (-4 / +21 lines)
Lines 3-9 Link Here
3
use strict;
3
use strict;
4
use warnings;
4
use warnings;
5
5
6
use Test::More tests => 11;
6
use Test::More tests => 19;
7
BEGIN {
7
BEGIN {
8
	use FindBin;
8
	use FindBin;
9
	use lib $FindBin::Bin;
9
	use lib $FindBin::Bin;
Lines 20-26 sub pretty_line { Link Here
20
20
21
my ($scrubber,$html,$result,@types,$collapse);
21
my ($scrubber,$html,$result,@types,$collapse);
22
$collapse = 1;
22
$collapse = 1;
23
@types = qw(comment tag);
23
@types = qw(default comment tag staff);
24
$html = q|
24
$html = q|
25
<![CDATA[selfdestruct]]&#x5d;>
25
<![CDATA[selfdestruct]]&#x5d;>
26
<?php  echo(" EVIL EVIL EVIL "); ?>    <!-- COMMENT -->
26
<?php  echo(" EVIL EVIL EVIL "); ?>    <!-- COMMENT -->
Lines 58-64 $collapse and $result =~ s/\s*\n\s*/\n/g; Link Here
58
print pretty_line('default'), $result, "\n", pretty_line();
58
print pretty_line('default'), $result, "\n", pretty_line();
59
59
60
foreach(@types) {
60
foreach(@types) {
61
	ok($scrubber = C4::Scrubber->new($_), "Constructor: C4::Scrubber->new($_)");
61
	ok($scrubber = C4::Scrubber->new($_), "testing Constructor: C4::Scrubber->new($_)");
62
	ok(printf("# scrubber settings: default %s, comment %s, process %s\n",
62
	ok(printf("# scrubber settings: default %s, comment %s, process %s\n",
63
		$scrubber->default(),$scrubber->comment(),$scrubber->process()),
63
		$scrubber->default(),$scrubber->comment(),$scrubber->process()),
64
		"Outputting settings from scrubber object (type: $_)"
64
		"Outputting settings from scrubber object (type: $_)"
Lines 67-70 foreach(@types) { Link Here
67
	$collapse and $result =~ s/\s*\n\s*/\n/g;
67
	$collapse and $result =~ s/\s*\n\s*/\n/g;
68
	print pretty_line($_), $result, "\n", pretty_line();
68
	print pretty_line($_), $result, "\n", pretty_line();
69
}
69
}
70
71
print "\n\n######################################################\nStart of invalid tests\n";
72
73
#Test for invalid new entry
74
eval{
75
	C4::Scrubber->new("");
76
	fail("test should fail on entry of ''\n");
77
};
78
pass("Test should have failed on entry of '' (empty string) and it did. YAY!\n");
79
80
eval{
81
	C4::Scrubber->new("Client");
82
	fail("test should fail on entry of 'Client'\n");
83
};
84
pass("Test should have failed on entry of 'Client' and it did. YAY!\n");
85
86
print "######################################################\n";
87
70
diag "done.\n";
88
diag "done.\n";
71
- 

Return to bug 5327