Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
Tests for _parseHeaderValue
3
--SKIPIF--
4
--FILE--
5
<?php
6
error_reporting(E_ALL); // suppress E_STRICT errors
7
 
8
require_once 'Mail/mime.php';
9
 
10
$Mime = new Mail_Mime();
11
$Mime->setTXTBody('Test message.');
12
$contentAppend = 'testparam1="test1;semicolon";testparam2=two; testparam3="three"; '
13
                .'testparam4="four\;4\;four"; testparam5=five\;5\;five; '
14
                ."testparam6='six'; testparam7='seven;7';testparam8='eight\;8'; "
15
                .'testparam9="nine;9";testparam10="ten\;10"; '
16
                .'testparam11=\'a "double" quote\'; testparam12="a \'simple\' quote"; '
17
                .'testparam13=\'another " quote\'; testparam14="another \' quote";'
18
                .'testparam15=last';
19
 
20
$Mime->addAttachment('test file contents', "text/plain; $contentAppend", 'test.txt', FALSE);
21
 
22
$body = $Mime->get();
23
 
24
$hdrs = '';
25
foreach ($Mime->headers() AS $name => $val) {
26
    $hdrs .= "$name: $val\n";
27
}
28
$hdrs .= "To: Receiver <receiver@example.com>\n";
29
$hdrs .= "From: Sender <sender@example.com>\n";
30
$hdrs .= "Subject: PEAR::Mail_Mime test mail\n";
31
 
32
require_once 'Mail/mimeDecode.php';
33
 
34
$mime_message = "$hdrs\n$body";
35
$Decoder = new Mail_mimeDecode($mime_message);
36
$params = array(
37
    'include_bodies' => TRUE,
38
    'decode_bodies'  => TRUE,
39
    'decode_headers' => TRUE
40
);
41
$Decoded = $Decoder->decode($params);
42
$decodedParts = $Decoded->parts[1]->ctype_parameters;
43
//Bug #4057: Content-type params now have a name attribute.
44
unset($decodedParts['name']);
45
print_r($decodedParts);
46
?>
47
--EXPECT--
48
Array
49
(
50
    [testparam1] => test1;semicolon
51
    [testparam2] => two
52
    [testparam3] => three
53
    [testparam4] => four;4;four
54
    [testparam5] => five;5;five
55
    [testparam6] => six
56
    [testparam7] => seven;7
57
    [testparam8] => eight;8
58
    [testparam9] => nine;9
59
    [testparam10] => ten;10
60
    [testparam11] => a "double" quote
61
    [testparam12] => a 'simple' quote
62
    [testparam13] => another " quote
63
    [testparam14] => another ' quote
64
    [testparam15] => last
65
)