summaryrefslogtreecommitdiff
path: root/test/MailmanLibTest.php
blob: 05e475f18130047a5e9c49bd51661ef3d7ed0e76 (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
35
36
37
38
39
40
41
42
43
44
45
<?php

#
# $Id$
#
# forum-list bridge 
# Copyright (C) 2010 Joel Uckelman
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

require_once('PHPUnit/Framework.php');
require_once('src/MailmanLib.php');

class MailmanLibTest extends PHPUnit_Framework_TestCase {
  
  /**
   * @dataProvider provider_read_raw_message
   */
  public function test_read_raw_message($url, $expected, $ex) {
    if ($ex) $this->setExpectedException($ex);
    $this->assertEquals($expected, read_raw_message($url));
  }

  public function provider_read_raw_message() {
    return array(
      array(__DIR__ . '/empty', null, 'Exception'),
      array(__DIR__ . '/bougs', null, 'Exception'),
      array(__DIR__ . '/1',     file_get_contents(__DIR__ . '/1'), null),
    );
  }
}

?>