1<?php
2/**
3 * Copyright 2015-2017 Horde LLC (http://www.horde.org/)
4 *
5 * @category   Horde
6 * @copyright  2015-2016 Horde LLC
7 * @license    http://www.horde.org/licenses/lgpl21 LGPL 2.1
8 * @package    Mime
9 * @subpackage UnitTests
10 */
11
12/**
13 * Tests for the Horde_Mime_Headers_ContentTransferEncoding class.
14 *
15 * @author     Michael Slusarz <slusarz@horde.org>
16 * @category   Horde
17 * @copyright  2015-2016 Horde LLC
18 * @internal
19 * @license    http://www.horde.org/licenses/lgpl21 LGPL 2.1
20 * @package    Mime
21 * @subpackage UnitTests
22 */
23class Horde_Mime_Headers_ContentTransferEncodingTest
24extends PHPUnit_Framework_TestCase
25{
26    /**
27     * @dataProvider valuesProvider
28     */
29    public function testValues($input, $expected_val, $is_default)
30    {
31        $ob = new Horde_Mime_Headers_ContentTransferEncoding(null, $input);
32
33        $this->assertEquals(
34            $expected_val,
35            $ob->value
36        );
37
38        if ($is_default) {
39            $this->assertTrue($ob->isDefault());
40        } else {
41            $this->assertFalse($ob->isDefault());
42        }
43    }
44
45    public function valuesProvider()
46    {
47        return array(
48            array(
49                '7bit',
50                '7bit',
51                true
52            ),
53            array(
54                ' 8BIT',
55                '8bit',
56                false
57            ),
58            array(
59                ' quoted-pRiNtAbLe   ',
60                'quoted-printable',
61                false
62            ),
63            array(
64                'BINARY',
65                'binary',
66                false
67            ),
68            array(
69                'base64',
70                'base64',
71                false
72            ),
73            array(
74                "7\0bit",
75                '7bit',
76                true
77            ),
78            array(
79                ' X-foo',
80                'x-foo',
81                false
82            ),
83            array(
84                'foo',
85                Horde_Mime_Headers_ContentTransferEncoding::UNKNOWN_ENCODING,
86                false
87            )
88        );
89    }
90
91}
92