1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
require_once(__DIR__ . '/../src/build_post.php');
class build_post_test extends PHPUnit_Framework_TestCase {
/** @dataProvider build_post_subject_data */
public function test_build_post_subject($ltag, $ftag, $subject, $reply, $expected) {
$this->assertEquals(
$expected,
build_post_subject($ltag, $ftag, $subject, $reply)
);
}
public function build_post_subject_data() {
return array(
array('[l]', '[f]', '', false, '(no subject)'),
array('[l]', '[f]', 'Re:', false, '(no subject)'),
array('[l]', '[f]', 'Subject', false, 'Subject'),
array('[l]', '[f]', 'Re: Subject', false, 'Subject'),
array('[l]', '[f]', 'Re: Re: Re: Subject', false, 'Subject'),
array('[l]', '[f]', '[f] Subject', false, 'Subject'),
array('[l]', '[f]', '[f] [f] Subject', false, 'Subject'),
array('[l]', '[f]', '[f] [f] Subject [f]', false, 'Subject'),
array('[l]', '[f]', '[l] [f] Re: Subject', false, 'Subject'),
array('[l]', '[f]', 'Re: [l] [f] Subject', false, 'Subject'),
array('[l]', '[f]', 'Re: Subject [l][f] Subject', false, 'Subject Subject'),
array('[l]', '[f]', 'Edit:', false, '(no subject)'),
array('[l]', '[f]', 'Edit: Re:', false, '(no subject)'),
array('[l]', '[f]', 'Edit: Subject', false, 'Subject'),
array('[l]', '[f]', 'Edit: Re: Subject', false, 'Subject'),
array('[l]', '[f]', 'Edit: Re: Re: Re: Subject', false, 'Subject'),
array('[l]', '[f]', 'Edit: [f] Subject', false, 'Subject'),
array('[l]', '[f]', 'Edit: [f] [f] Subject', false, 'Subject'),
array('[l]', '[f]', 'Edit: [f] [f] Subject [f]', false, 'Subject'),
array('[l]', '[f]', '[l] [f] Edit: Re: Subject', false, 'Subject'),
array('[l]', '[f]', 'Edit: Re: [l] [f] Subject', false, 'Subject'),
array('[l]', '[f]', 'Edit: Re: Subject [l][f] Subject', false, 'Subject Subject'),
array('[l]', '[f]', '', true, 'Re: (no subject)'),
array('[l]', '[f]', 'Re:', true, 'Re: (no subject)'),
array('[l]', '[f]', 'Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Re: Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Re: Re: Re: Subject', true, 'Re: Subject'),
array('[l]', '[f]', '[f] Subject', true, 'Re: Subject'),
array('[l]', '[f]', '[f] [f] Subject', true, 'Re: Subject'),
array('[l]', '[f]', '[f] [f] Subject [f]', true, 'Re: Subject'),
array('[l]', '[f]', '[l] [f] Re: Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Re: [l] [f] Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Re: Subject [l][f] Subject', true, 'Re: Subject Subject'),
array('[l]', '[f]', 'Edit:', true, 'Re: (no subject)'),
array('[l]', '[f]', 'Edit: Re:', true, 'Re: (no subject)'),
array('[l]', '[f]', 'Edit: Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Edit: Re: Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Edit: Re: Re: Re: Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Edit: [f] Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Edit: [f] [f] Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Edit: [f] [f] Subject [f]', true, 'Re: Subject'),
array('[l]', '[f]', '[l] [f] Edit: Re: Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Edit: Re: [l] [f] Subject', true, 'Re: Subject'),
array('[l]', '[f]', 'Edit: Re: Subject [l][f] Subject', true, 'Re: Subject Subject')
);
}
}
?>
|