summaryrefslogtreecommitdiff
path: root/test/build_post_test.php
blob: cf172f61366cab9a1dd58e04dbc7bafa4e07ae59 (plain)
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
<?php

require_once('PHPUnit/Framework.php');

require_once(__DIR__ . '/../src/build_post.php');

class build_post_test extends PHPUnit_Framework_TestCase {
  
  /** @dataProvider buildPostSubjectProvider */
  public function testBuildPostSubject($ltag, $ftag, $subject, $expected) {
    $this->assertEquals(
      $expected,
      build_post_subject($ltag, $ftag, $subject)
    );
  }

  public function buildPostSubjectProvider() {
    return array(
      array('[l]', '[f]', '', '(no subject)'),
      array('[l]', '[f]', 'Re:', '(no subject)'),
      array('[l]', '[f]', 'Subject', 'Subject'),
      array('[l]', '[f]', 'Re: Subject', 'Subject'),
      array('[l]', '[f]', 'Re: Re: Re: Subject', 'Subject'),
      array('[l]', '[f]', '[f] Subject', 'Subject'),
      array('[l]', '[f]', '[f] [f] Subject', 'Subject'),
      array('[l]', '[f]', '[f] [f] Subject [f]', 'Subject'),
      array('[l]', '[f]', '[l] [f] Re: Subject', 'Subject'),
      array('[l]', '[f]', 'Re: [l] [f] Subject', 'Subject'),
      array('[l]', '[f]', 'Re: Subject [l][f] Subject', 'Subject Subject')
    );
  }
}

?>