芝麻web文件管理V1.00
';
$icsText = 'BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//icalcreator//NONSGML iCalcreator 2.22//
METHOD:REQUEST
BEGIN:VEVENT
UID:77@localhost
DTSTAMP:20160208T170811Z
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
TRUE;CN=Jacob Alvarez:MAILTO:fake1@mailinator.com
CREATED:20160208T170810Z
DTSTART:20160215T180000Z
DTEND:20160215T190000Z
ORGANIZER;CN=-:MAILTO:fake2@mailinator.com
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:Prueba 69
TRANSP:OPAQUE
URL:http://localhost/event/77
END:VEVENT
END:VCALENDAR';
function printPartsStartAndEnd($body) {
$matches = array();
preg_match_all('/--(=_[a-z0-9]+)--|Content-Type: ([^;\r\n]+)/', $body, $matches);
$tab = " ";
foreach ($matches[0] as $match){
if (strpos($match, '--') === false) {
printf("%s%s\n", $tab, $match);
if (stripos($match, "multipart")) {
$tab .= " ";
}
} else {
$tab = substr($tab, 0, -4);
printf("%sEnd part\n", $tab);
}
}
}
function printHeaderContentType($headers) {
$headerContentType = array();
preg_match('/([^;\r\n]+)/', $headers['Content-Type'], $headerContentType);
printf("Content-Type: %s\n", $headerContentType[0]);
}
print "TEST: text\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: html\n";
$mime = new Mail_mime();
$mime->setHTMLBody($htmlBody);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: attachments\n";
$mime = new Mail_mime();
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: text + attachments\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: html + attachments\n";
$mime = new Mail_mime();
$mime->setHTMLBody($htmlBody);
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: html + inline images\n";
$mime = new Mail_mime();
$mime->setHTMLBody($htmlBody);
$mime->addHTMLImage("aaaaaaaaaa", 'image/gif', 'image.gif', false, 'contentid');
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print("TEST: txt, html and attachment\n");
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->addAttachment("test", 'application/octet-stream', 'attachment', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: calendar\n";
$mime = new Mail_mime();
$mime->setCalendarBody($icsText);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt + calendar\n";
$mime->setTXTBody($txtBody);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt, html, calendar\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->setCalendarBody($icsText);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt, html + html images, and calendar\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->addHTMLImage('testimage', 'image/gif', "bus.gif", false);
$mime->setCalendarBody($icsText);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print("TEST: txt, html, calendar and attachment\n");
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->setCalendarBody($icsText);
$mime->addAttachment("test", 'application/octet-stream', 'attachment', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt, html + html images, calendar, and attachment\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->addHTMLImage('testimage', 'image/gif', "bus.gif", false);
$mime->setCalendarBody($icsText);
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
?>
--EXPECT--
TEST: text
Content-Type: text/plain
TEST: html
Content-Type: text/html
TEST: attachments
Content-Type: multipart/mixed
Content-Type: application/ics
End part
TEST: text + attachments
Content-Type: multipart/mixed
Content-Type: text/plain
Content-Type: application/ics
End part
TEST: html + attachments
Content-Type: multipart/mixed
Content-Type: text/html
Content-Type: application/ics
End part
TEST: html + inline images
Content-Type: multipart/related
Content-Type: text/html
Content-Type: image/gif
End part
TEST: txt, html and attachment
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/html
End part
Content-Type: application/octet-stream
End part
TEST: calendar
Content-Type: text/calendar
TEST: txt + calendar
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/calendar
End part
TEST: txt, html, calendar
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/html
Content-Type: text/calendar
End part
TEST: txt, html + html images, and calendar
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: multipart/related
Content-Type: text/html
Content-Type: image/gif
End part
Content-Type: text/calendar
End part
TEST: txt, html, calendar and attachment
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/html
Content-Type: text/calendar
End part
Content-Type: application/octet-stream
End part
TEST: txt, html + html images, calendar, and attachment
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: multipart/related
Content-Type: text/html
Content-Type: image/gif
End part
Content-Type: text/calendar
End part
Content-Type: application/ics
End part
Mail_Mime/tests/test_Bug_7561_1.phpt 0000644 00000001205 14716355766 0013134 0 ustar 00 --TEST--
Bug #7561 Mail_mimePart::quotedPrintableEncode() misbehavior with mbstring overload
--INI--
mbstring.language=Neutral
mbstring.func_overload=6
mbstring.internal_encoding=UTF-8
mbstring.http_output=UTF-8
--SKIPIF--
';
$mime->setHTMLBody($body);
$mime->setFrom($from);
$mime->addHTMLImage('','image/gif', 'test.gif', false);
$msg=$mime->get();
$header = preg_match('|Content-ID: <[0-9a-fA-F]+@from.example.com>|', $msg);
if (!$header){
print("FAIL:\n");
print($msg);
}else{
print("OK");
}
--EXPECT--
OK
Mail_Mime/tests/test_Bug_11381.phpt 0000644 00000001055 14716355766 0012772 0 ustar 00 --TEST--
Bug #11381 Domain name is attached to content-id, trailing greater-than sign is not removed
--SKIPIF--
--FILE--
';
require_once('Mail/mime.php');
$mime=new Mail_mime();
$body='';
$mime->setHTMLBody($body);
$mime->setFrom($from);
$mime->addHTMLImage('','image/gif', 'test.gif', false);
$msg=$mime->get();
$header = preg_match('|Content-ID: <[0-9a-fA-F]+@from.example.com>|', $msg);
if (!$header){
print("FAIL:\n");
print($msg);
}else{
print("OK");
}
--EXPECT--
OK
Mail_Mime/tests/test_Bug_8386_1.phpt 0000644 00000001047 14716355766 0013146 0 ustar 00 --TEST--
Bug #8386 HTML body not correctly encoded if attachments present
--SKIPIF--
--FILE--
$eol));
$encoder->setTXTBody('test');
$encoder->setHTMLBody('test');
$encoder->addAttachment('Just a test', 'application/octet-stream', 'test.txt', false);
$body = $encoder->get();
if (strpos($body, '--' . $eol . '--=')){
print("FAILED\n");
print("Single delimiter() between 2 parts found.\n");
print($body);
}else{
print("OK");
}
?>
--EXPECT--
OK
Mail_Mime/tests/test_Bug_21205.phpt 0000644 00000002436 14716355766 0012772 0 ustar 00 --TEST--
Bug #21205 Handling ISO-2022-JP headers
--SKIPIF--
';
$charset = 'ISO-2022-JP';
$encoding = 'base64';
foreach ($tests as $test) {
$test = mb_convert_encoding($test, $charset, 'UTF-8');
print Mail_mimePart::encodeHeader("subject", $test, $charset, $encoding) . PHP_EOL;
print Mail_mimePart::encodeHeader("to", $test.$addr, $charset, $encoding) . PHP_EOL;
$test = '"' . $test . '"';
print Mail_mimePart::encodeHeader("subject", $test, $charset, $encoding) . PHP_EOL;
print Mail_mimePart::encodeHeader("to", $test.$addr, $charset, $encoding) . PHP_EOL;
}
?>
--EXPECT--
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
Mail_Mime/tests/test_Bug_17175.phpt 0000644 00000001267 14716355766 0013006 0 ustar 00 --TEST--
Bug #17175 Content-Description support+ecoding
--SKIPIF--
--FILE--
setTXTBody('Test message.');
$Mime->addAttachment('test file contents', "text/plain",
'test.txt', FALSE, 'base64', NULL, 'UTF-8', NULL, NULL, NULL, NULL,
'desc');
$Mime->addAttachment('test file contents', "text/plain",
'test2.txt', FALSE, 'base64', NULL, 'UTF-8', NULL, NULL, NULL, NULL,
'test unicode żąśź');
$body = $Mime->getMessage();
preg_match_all('/Content-Description: (.*)/', $body, $matches);
foreach ($matches[1] as $value)
echo $value."\n";
?>
--EXPECT--
desc
=?UTF-8?Q?test_unicode_=C5=BC=C4=85=C5=9B=C5=BA?=
Mail_Mime/tests/content_transfer_encoding.phpt 0000644 00000001634 14716355766 0015710 0 ustar 00 --TEST--
Test empty Content-Transfer-Encoding on multipart messages
--SKIPIF--
--FILE--
setParam('text_encoding', 'quoted-printable');
$mime->setParam('html_encoding', 'quoted-printable');
$mime->setParam('head_encoding', 'quoted-printable');
// This specific order used to set Content-Transfer-Encoding: quoted-printable
// which is invalid according to RFC 2045 on multipart messages
$mime->setTXTBody('text');
$mime->headers(array('From' => 'from@domain.tld'));
$mime->addAttachment('file.pdf', 'application/pdf', 'file.pdf', false, 'base64', 'inline');
echo $mime->txtHeaders();
list ($header, $body) = explode("\r\n\r\n", $mime->getMessage());
echo $header;
?>
--EXPECTF--
MIME-Version: 1.0
From: from@domain.tld
Content-Type: multipart/mixed;
boundary="=_%x"
MIME-Version: 1.0
From: from@domain.tld
Content-Type: multipart/mixed;
boundary="=_%x"
Mail_Mime/tests/qp_encoding_test.phpt 0000644 00000006745 14716355766 0014021 0 ustar 00 --TEST--
qp comprehensive test
--SKIPIF--
--FILE--
setFrom('user@from.example.com');
$r = $mime->txtHeaders(array('Received' => array('Received 1', 'Received 2')));
print_r($r);
?>
--EXPECT--
Received: Received 1
Received: Received 2
MIME-Version: 1.0
From: user@from.example.com
Mail_Mime/tests/test_Bug_20226.phpt 0000644 00000000525 14716355766 0012771 0 ustar 00 --TEST--
Bug #20226 Mail_mimePart::encodeHeader() and ISO-2022-JP encoding
--SKIPIF--
--FILE--
encodeHeader('subject', $subject, 'ISO-2022-JP', 'base64');
?>
--EXPECT--
=?ISO-2022-JP?B?GyRCJT8lJCVIJWsbKEI=?=
Mail_Mime/tests/test_Bug_16539.phpt 0000644 00000016531 14716355766 0013011 0 ustar 00 --TEST--
Bug #16539 Headers longer than 998 characters
--SKIPIF--
--FILE--
'jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com',
'Subject' => 'jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com',
);
echo $mime->txtHeaders($headers, true, true);
?>
--EXPECT--
MIME-Version: 1.0
To: jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com
Subject: jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.co
m,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com
Mail_Mime/tests/test_Bug_14529.phpt 0000644 00000001011 14716355766 0012771 0 ustar 00 --TEST--
Bug #14529 basename() workaround
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain", $filename, FALSE, 'base64', 'attachment', 'ISO-8859-1');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match('/filename([^\s]+)/i', $content, $matches)) {
echo $matches[1];
}
?>
--EXPECT--
*=ISO-8859-1''%C5%9Bciema;
Mail_Mime/tests/test_Bug_10816_1.phpt 0000644 00000001072 14716355766 0013213 0 ustar 00 --TEST--
Bug #10816 Unwanted linebreak at the end of output
--SKIPIF--
--FILE--
$eol));
$encoder->setTXTBody('test');
$encoder->setHTMLBody('test');
$encoder->addAttachment('Just a test', 'application/octet-stream', 'test.txt', false);
$body = $encoder->get();
$taillength = -1 * strlen($eol) * 2;
if (substr($body, $taillength) == ($eol.$eol)){
print("FAILED\n");
print("Body:\n");
print("..." . substr($body, -10) . "\n");
}else{
print("OK\n");
}
--EXPECT--
OK
Mail_Mime/tests/test_Bug_9722_1.phpt 0000644 00000000550 14716355766 0013137 0 ustar 00 --TEST--
Bug #9722 quotedPrintableEncode does not encode dot at start of line on Windows platform
--SKIPIF--
--FILE--
isMultipart() ? 'TRUE' : 'FALSE') . "\n";
$mime->setTXTBody('test');
echo ($mime->isMultipart() ? 'TRUE' : 'FALSE') . "\n";
$mime->setHTMLBody('test');
echo ($mime->isMultipart() ? 'TRUE' : 'FALSE') . "\n";
--EXPECT--
FALSE
FALSE
TRUE
Mail_Mime/tests/sleep_wakeup_EOL-bug3488-part1.phpt 0000644 00000001041 14716355766 0015766 0 ustar 00 --TEST--
Bug #3488 Sleep/Wakeup EOL Consistency - Part 1
--SKIPIF--
--FILE--
setHTMLBody('');
$mm->setTxtBody('Blah blah');
if (version_compare(phpversion(), "5.0.0", '<')) {
$mmCopy = $mm;
} else {
$mmCopy = clone($mm);
}
$mm->get();
$x = $mm->headers();
$smm = serialize(array('mm' => $mmCopy, 'header' => $x['Content-Type']));
$fp = fopen('sleep_wakeup_data', 'w');
fwrite($fp, $smm);
fclose($fp);
echo "Data written";
?>
--EXPECT--
Data written
Mail_Mime/tests/test_Bug_11731.phpt 0000644 00000001254 14716355766 0012772 0 ustar 00 --TEST--
Bug #11731 Full stops after soft line breaks are not encoded
--SKIPIF--
--FILE--
'text/plain',
'encoding' => 'quoted-printable',
);
$mimePart = new Mail_mimePart($text, $params);
$encoded = $mimePart->encode();
echo $encoded['body'];
--EXPECT--
=2E123456789012345678901234567890123456789012345678901234567890123456789012=
=2E3456
Mail_Mime/tests/test_Bug_GH26.phpt 0000644 00000001363 14716355766 0012765 0 ustar 00 --TEST--
Bug GH-26 Backward slash is getting added in headers
--SKIPIF--
--FILE--
';
$to = <<,,t@mail.com
EOT;
$subject = "Test mime";
$mailbody = "hello world";
$mail_mime->setTxtBody($mailbody);
$mail_mime->setHTMLBody($mailbody);
$mail_mime->setSubject($subject);
$mail_mime->setFrom($from);
$body = $mail_mime->get();
$extra_headers = array();
$extra_headers["To"] = $to;
$arr_hdrs = $mail_mime->headers($extra_headers);
echo $arr_hdrs['From'] . "\n" . $arr_hdrs['To'];
--EXPECT--
"George B@@Z"
"austin test" , , t@mail.com Mail_Mime/tests/test_Bug_GH16.phpt 0000644 00000003102 14716355766 0012755 0 ustar 00 --TEST--
Bug GH-16 Test methods that write to a file
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$mime->setContentType('multipart/alternative', array('boundary' => 'something'));
$temp_filename = dirname(__FILE__) . "/output1.tmp";
touch($temp_filename);
$msg = $mime->saveMessageBody($temp_filename);
echo file_get_contents($temp_filename);
$temp_filename = dirname(__FILE__) . "/output2.tmp";
touch($temp_filename);
$msg = $mime->saveMessage($temp_filename);
echo file_get_contents($temp_filename);
$temp_filename = dirname(__FILE__) . "/output3.tmp";
$mimePart = new Mail_mimePart('abc', array(
'content_type' => 'text/plain',
'encoding' => 'quoted-printable',
));
$mimePart->encodeToFile($temp_filename);
echo file_get_contents($temp_filename);
?>
--CLEAN--
--EXPECT--
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
text
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
html
--something--
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="something"
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
text
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
html
--something--
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain
abc
Mail_Mime/tests/test_Bug_13032.phpt 0000644 00000001033 14716355766 0012761 0 ustar 00 --TEST--
Bug #13032 Proper (different) boundary for nested parts
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$mime->addAttachment('file.pdf', 'application/pdf', 'file.pdf', false, 'base64', 'inline');
$msg = $mime->getMessage();
if (preg_match_all('/boundary="([^"]+)"/', $msg, $matches)) {
if (count($matches) == 2 && count($matches[1]) == 2 &&
$matches[1][0] != $matches[1][1]) {
print('OK');
}
}
?>
--EXPECT--
OK
Mail_Mime/tests/test_Bug_3513_2.phpt 0000644 00000001067 14716355766 0013134 0 ustar 00 --TEST--
Bug #3513 Support of RFC2231 in header fields. (UTF-8)
--SKIPIF--
--FILE--
addAttachment('testfile',"text/plain", $test, FALSE, 'base64', 'attachment', 'UTF-8', 'de');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/filename([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[1]);
}
--EXPECT--
*0*=UTF-8'de'S%C3%BCper%20gr%C3%B6se%20tolle%20tolle%20gr%C3%BC;
*1*=%C3%9Fe.txt;
Mail_Mime/tests/test_Bug_GH19.phpt 0000644 00000001745 14716355766 0012773 0 ustar 00 --TEST--
Bug GH-19 Test boundary value with different headers()/get() call order
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$body = $mime->get();
$hdrs = $mime->headers(array(
'From' => 'test@domain.tld',
'Subject' => 'Subject',
'To' => 'to@domain.tld'
));
preg_match('/boundary="([^"]+)/', $hdrs['Content-Type'], $matches);
$boundary = $matches[1];
echo substr_count($body, "--$boundary") . "\n";
// Test headers() before get()
$mime = new Mail_mime("\r\n");
$mime->setHTMLBody('html');
$mime->setTXTBody('text');
$hdrs = $mime->headers(array(
'From' => 'test@domain.tld',
'Subject' => 'Subject',
'To' => 'to@domain.tld'
));
$body = $mime->get();
preg_match('/boundary="([^"]+)/', $hdrs['Content-Type'], $matches);
$boundary = $matches[1];
echo substr_count($body, "--$boundary");
--EXPECT--
3
3
Mail_Mime/tests/test_Bug_10596_1.phpt 0000644 00000000450 14716355766 0013217 0 ustar 00 --TEST--
Bug #10596 Incorrect handling of text and html '0' bodies
--SKIPIF--
--FILE--
setTxtBody('0');
$mime->setHTMLBody('0');
$body = $mime->get();
if ($body){
print("OK");
}else{
print("NO BODY FOUND");
}
--EXPECT--
OK
Mail_Mime/tests/class-filename.phpt 0000644 00000000362 14716355766 0013344 0 ustar 00 --TEST--
Test class filename (bug #24)
--SKIPIF--
--FILE--
--EXPECT--
Include OK
Mail_Mime/tests/encoding_case.phpt 0000644 00000000364 14716355766 0013244 0 ustar 00 --TEST--
Bug #2364 Tabs in Mail_mimePart::quotedPrintableEncode()
--SKIPIF--
--FILE--
--EXPECT--
Here's=
=09
a tab
Mail_Mime/tests/test_Bug_12165.phpt 0000644 00000000575 14716355766 0013001 0 ustar 00 --TEST--
Bug #12165 Dot at the end of the line disappeared
--SKIPIF--
--FILE--
setHTMLBody($string);
print_r($mime->get());
--EXPECT--
http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
=2Ecom
Mail_Mime/tests/test_Bug_12466.phpt 0000644 00000000675 14716355766 0013006 0 ustar 00 --TEST--
Bug #12466 Content-Transfer-Encoding checking
--SKIPIF--
--FILE--
'7bit',
'html_encoding' => '7bit',
);
$mime = new Mail_mime($params);
$mime->setTXTBody("ż");
$mime->setHTMLBody("z");
$body = $mime->getMessage();
preg_match_all('/Content-Transfer-Encoding: (.*)/', $body, $m);
echo trim($m[1][0])."\n".trim($m[1][1]);
?>
--EXPECT--
quoted-printable
7bit
Mail_Mime/tests/test_Bug_18772.phpt 0000644 00000001560 14716355766 0013006 0 ustar 00 --TEST--
Bug #18772 Text/calendar message
--SKIPIF--
--FILE--
setSubject('test');
// A message with text/calendar only
$mime->setCalendarBody('VCALENDAR');
echo $mime->getMessage();
echo "\n---\n";
// A message with alternative text
$mime->setTXTBody('vcalendar');
$msg = $mime->getMessage();
echo preg_replace('/=_[0-9a-z]+/', '*', $msg);
--EXPECT--
MIME-Version: 1.0
Subject: test
Content-Type: text/calendar; charset=UTF-8; method=request
Content-Transfer-Encoding: quoted-printable
VCALENDAR
---
MIME-Version: 1.0
Subject: test
Content-Type: multipart/alternative;
boundary="*"
--*
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
vcalendar
--*
Content-Transfer-Encoding: quoted-printable
Content-Type: text/calendar; method=request; charset=UTF-8
VCALENDAR
--*--
Mail_Mime/tests/test_Bug_18083.phpt 0000644 00000001120 14716355766 0012771 0 ustar 00 --TEST--
Bug #18083 Separate charset for attachment's content and headers
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain",
base64_decode("xZtjaWVtYQ=="), FALSE,
'base64', 'attachment', 'ISO-8859-1', 'pl', '',
'quoted-printable', 'base64', '', 'UTF-8');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/(name|filename)=([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[2]);
}
?>
--EXPECT--
"=?UTF-8?Q?=C5=9Bciema?="
"=?UTF-8?B?xZtjaWVtYQ==?=";
Mail_Mime/tests/test_Bug_8541_1.phpt 0000644 00000000763 14716355766 0013143 0 ustar 00 --TEST--
Bug #8541 mimePart.php line delimiter is \r
--SKIPIF--
--FILE--
--FILE--
'),
array('From', 'adresse@adresse.de'),
array('From', 'Frank Do '),
array('To', 'Frank Do , James Clark '),
array('From', '"Frank Do" '),
array('Cc', '"Frank Do" , "James Clark" '),
array('Cc', ' , "Kuśmiderski Jan Krzysztof Janusz Długa nazwa" '),
array('From', '"adresse@adresse.de" '),
array('From', 'adresse@adresse.de '),
array('From', '"German Umlauts öäü" '),
array('Subject', 'German Umlauts öäü '),
array('Subject', 'Short ASCII subject'),
array('Subject', 'Long ASCII subject - multiline space separated words - too long for one line'),
array('Subject', 'Short Unicode ż subject'),
array('Subject', 'Long Unicode subject - zażółć gęślą jaźń - too long for one line'),
array('References', ' <4b2e87ac$1@news.home.net.pl> '),
array('To', '"Frank Do" ,, "James Clark" '),
array('To', '"Frank \\" \\\\Do" '),
array('To', 'Frank " \\Do '),
array('Subject', "A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test"),
array('Subject', "TEST Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir!!!?"),
array('Subject', "Update: Microsoft Windows-Tool zum Entfernen bösartiger Software 3.6"),
array('From', "test@nàme "),
array('From', "Test <\"test test\"@domain.com>"),
array('From', "\"test test\"@domain.com"),
array('From', "<\"test test\"@domain.com>"),
array('From', "Doe"),
array('From', "\"John Doe\""),
array('Mail-Reply-To', 'adresse@adresse.de '),
array('Mail-Reply-To', '"öäü" '),
array('Subject', mb_convert_encoding('㈱山﨑工業', 'ISO-2022-JP-MS', 'UTF-8'), 'ISO-2022-JP'),
);
$i = 1;
foreach ($headers as $header) {
$charset = isset($header[2]) ? $header[2] : 'UTF-8';
$hdr = $mime->encodeHeader($header[0], $header[1], $charset, 'base64');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$hdr = $mime->encodeHeader($header[0], $header[1], $charset, 'quoted-printable');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$i++;
}
?>
--EXPECT--
[01] From:
[01] From:
[02] From: adresse@adresse.de
[02] From: adresse@adresse.de
[03] From: Frank Do
[03] From: Frank Do
[04] To: Frank Do , James Clark
[04] To: Frank Do , James Clark
[05] From: "Frank Do"
[05] From: "Frank Do"
[06] Cc: "Frank Do" , "James Clark"
[06] Cc: "Frank Do" , "James Clark"
[07] Cc: , =?UTF-8?B?S3XFm21pZGVyc2tpIEphbiBLcnp5c3p0b2Yg?=
=?UTF-8?B?SmFudXN6IETFgnVnYSBuYXp3YQ==?=
[07] Cc: , =?UTF-8?Q?Ku=C5=9Bmiderski_Jan_Krzysztof_Janusz?=
=?UTF-8?Q?_D=C5=82uga_nazwa?=
[08] From: "adresse@adresse.de"
[08] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[10] From: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8?=
[10] From: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC?=
[11] Subject: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8IDxhZHJlc3NlQGFkcmVzc2Uu?=
=?UTF-8?B?ZGU+?=
[11] Subject: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC_=3Cadresse=40adresse?=
=?UTF-8?Q?=2Ede=3E?=
[12] Subject: Short ASCII subject
[12] Subject: Short ASCII subject
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[14] Subject: =?UTF-8?B?U2hvcnQgVW5pY29kZSDFvCBzdWJqZWN0?=
[14] Subject: =?UTF-8?Q?Short_Unicode_=C5=BC_subject?=
[15] Subject: =?UTF-8?B?TG9uZyBVbmljb2RlIHN1YmplY3QgLSB6YcW8w7PFgsSHIGfEmcWb?=
=?UTF-8?B?bMSFIGphxbrFhCAtIHRvbyBsb25nIGZvciBvbmUgbGluZQ==?=
[15] Subject: =?UTF-8?Q?Long_Unicode_subject_-_za=C5=BC=C3=B3=C5=82=C4=87_g?=
=?UTF-8?Q?=C4=99=C5=9Bl=C4=85_ja=C5=BA=C5=84_-_too_long_for_one_line?=
[16] References:
<4b2e87ac$1@news.home.net.pl>
[16] References:
<4b2e87ac$1@news.home.net.pl>
[17] To: "Frank Do" , "James Clark"
[17] To: "Frank Do" , "James Clark"
[18] To: "Frank \" \\Do"
[18] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[21] Subject: =?UTF-8?B?VEVTVCBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1p?=
=?UTF-8?B?ciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIg?=
=?UTF-8?B?Z3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRv?=
=?UTF-8?B?bGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7w=?=
=?UTF-8?B?w59lIHZvbiBtaXIgU8O8cGVyIGdyw7ZzZSB0b2xsZSBncsO8w59lIHZvbiBt?=
=?UTF-8?B?aXIgU8O8cGVyIGdyw7ZzZSB0b2xsZSBncsO8w59lIHZvbiBtaXIgU8O8cGVy?=
=?UTF-8?B?IGdyw7ZzZSB0b2xsZSBncsO8w59lIHZvbiBtaXIgU8O8cGVyIGdyw7ZzZSB0?=
=?UTF-8?B?b2xsZSBncsO8w59lIHZvbiBtaXIhISE/?=
[21] Subject: =?UTF-8?Q?TEST_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_m?=
=?UTF-8?Q?ir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCp?=
=?UTF-8?Q?er_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6?=
=?UTF-8?Q?se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr?=
=?UTF-8?Q?=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC?=
=?UTF-8?Q?=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von?=
=?UTF-8?Q?_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S?=
=?UTF-8?Q?=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir!!!=3F?=
[22] Subject: =?UTF-8?B?VXBkYXRlOiBNaWNyb3NvZnQgV2luZG93cy1Ub29sIHp1bSBFbnRm?=
=?UTF-8?B?ZXJuZW4gYsO2c2FydGlnZXIgU29mdHdhcmUgMy42?=
[22] Subject: =?UTF-8?Q?Update=3A_Microsoft_Windows-Tool_zum_Entfernen_b=C3=B6?=
=?UTF-8?Q?sartiger_Software_3=2E6?=
[23] From: =?UTF-8?B?dGVzdEBuw6BtZQ==?=
[23] From: =?UTF-8?Q?test=40n=C3=A0me?=
[24] From: Test <"test test"@domain.com>
[24] From: Test <"test test"@domain.com>
[25] From: "test test"@domain.com
[25] From: "test test"@domain.com
[26] From: <"test test"@domain.com>
[26] From: <"test test"@domain.com>
[27] From: Doe
[27] From: Doe
[28] From: "John Doe"
[28] From: "John Doe"
[29] Mail-Reply-To: "adresse@adresse.de"
[29] Mail-Reply-To: "adresse@adresse.de"
[30] Mail-Reply-To: =?UTF-8?B?w7bDpMO8?=
[30] Mail-Reply-To: =?UTF-8?Q?=C3=B6=C3=A4=C3=BC?=
[31] Subject: =?ISO-2022-JP?B?GyRCLWo7M3l1OSk2SBsoQg==?=
[31] Subject: =?ISO-2022-JP?Q?=24B-j=28B=24B=3B3=28B=24Byu=28B?=
=?ISO-2022-JP?Q?=24B9=29=28B=24B6H=28B?=
Mail_Mime/tests/test_Bug_20564.phpt 0000644 00000000416 14716355766 0012775 0 ustar 00 --TEST--
Bug #20564 Unsetting headers
--SKIPIF--
--FILE--
setSubject('test');
$headers = $mime->headers(array('Subject' => null), true);
echo array_key_exists('Subject', $headers) ? '1' : '0';
--EXPECT--
0 Mail_Mime/tests/test_Bug_21098.phpt 0000644 00000000606 14716355766 0013001 0 ustar 00 --TEST--
Bug #21098 Handling of empty plain text parts
--SKIPIF--
--FILE--
setTxtBody('');
$mime->setHTMLBody('');
$headers1 = $mime->txtHeaders();
$body = $mime->get();
$headers2 = $mime->txtHeaders();
print strpos($headers1, 'text/html') && strpos($headers2, 'text/html') ? 'OK' : 'NOT OK';
--EXPECT--
OK
Mail_Mime/tests/test_Bug_3513_1.phpt 0000644 00000000733 14716355766 0013132 0 ustar 00 --TEST--
Bug #3513 Support of RFC2231 in header fields. (ISO-8859-1)
--SKIPIF--
--FILE--
addAttachment('testfile',"text/plain", $test, FALSE, 'base64', 'attachment', 'ISO-8859-1');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match('/filename([^\s]+)/i', $content, $matches)) {
echo $matches[1];
}
--EXPECT--
*=ISO-8859-1''F%F3%F3b%E6r.txt;
Mail_Mime/tests/test_Bug_19497.phpt 0000644 00000001043 14716355766 0013007 0 ustar 00 --TEST--
Bug #19497 Attachment filenames with a slash character
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain", $filename, FALSE,
'base64', 'attachment', 'ISO-8859-1', '', '', 'quoted-printable', 'base64');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/(name|filename)=([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[2]);
}
?>
--EXPECT--
"test/file.txt"
"test/file.txt";
Mail_Mime/tests/test_Bug_21206.phpt 0000644 00000001116 14716355766 0012765 0 ustar 00 --TEST--
Bug #21206 Handling quoted strings
--SKIPIF--
--FILE--
, b ',
'"c\\\\" , d ',
);
foreach ($tests as $test) {
$addrs = X::explodeQuotedString('[\t,]', $test);
foreach ($addrs as $addr) {
print trim($addr) . PHP_EOL;
}
}
?>
--EXPECT--
"a"
b
"c\\"
d
Mail_Mime/tests/test_Bug_13444.phpt 0000644 00000001236 14716355766 0012775 0 ustar 00 --TEST--
Bug #9725 multipart/related & alternative wrong order
--SKIPIF--
--FILE--
setTXTBody("test");
$mime->setHTMLBody("test");
$mime->addHTMLImage("test", 'application/octet-stream', '', false);
$body = $mime->get();
$head = $mime->headers();
$headCT = $head['Content-Type'];
$headCT = explode(";", $headCT);
$headCT = $headCT[0];
$ct = preg_match_all('|Content-Type: ([^;\r\n]+)|', $body, $matches);
print($headCT);
print("\n");
foreach ($matches[1] as $match){
print($match);
print("\n");
}
--EXPECT--
multipart/alternative
text/plain
multipart/related
text/html
application/octet-stream
Mail_Mime/tests/sleep_wakeup_EOL-bug3488-part2.phpt 0000644 00000001112 14716355766 0015766 0 ustar 00 --TEST--
Bug #3488 Sleep/Wakeup EOL Consistency - Part 2
--SKIPIF--
if (!is_readable('sleep_wakeup_data')) {
echo "skip No data. Part 1 must run first.\n";
}
--FILE--
get();
$x = $mmData['mm']->headers();
list($h1) = explode("\n", $mmData['header']);
list($h2) = explode("\n", $x['Content-Type']);
echo ($h1 == $h2) ? "Match" : "No Match";
?>
--EXPECT--
Match
Mail_Mime/tests/test_Bug_20273.phpt 0000644 00000000456 14716355766 0012776 0 ustar 00 --TEST--
Bug #20273 Mail_mimePart::encodeHeader() and TAB character
--SKIPIF--
--FILE--
\t";
$mime = new Mail_mimePart();
echo $mime->encodeHeader('References', $refs);
?>
--EXPECT--
Mail_Mime/tests/test_linebreak_dot.phpt 0000644 00000003230 14716355766 0014317 0 ustar 00 --TEST--
Test for correct "." encoding when doing linebreaks
--SKIPIF--
--FILE--
'text/plain',
'encoding' => 'quoted-printable',
);
for ($i=74; $i <= strlen($text); $i++) {
$input = substr($text, 0, $i);
$mimePart = new Mail_mimePart($input, $params);
$encoded = $mimePart->encode();
$output = $encoded['body'];
printf("input: %02d: %s\n", strlen($input), $input);
$lines = explode("\r\n", $output);
for($j=0; $j < count($lines); $j++) {
$line = $lines[$j];
if ($j + 1 < count($lines)) {
$line_vis = $line.'\r\n';
} else {
$line_vis = $line;
}
printf("output:%02d: %s\n", strlen($line), $line_vis);
}
print("---\n");
}
--EXPECT--
input: 74: 0123456789012345678901234567890123456789012345678901234567890123456789012.
output:74: 0123456789012345678901234567890123456789012345678901234567890123456789012.
---
input: 75: 0123456789012345678901234567890123456789012345678901234567890123456789012..
output:75: 0123456789012345678901234567890123456789012345678901234567890123456789012..
---
input: 76: 0123456789012345678901234567890123456789012345678901234567890123456789012...
output:76: 0123456789012345678901234567890123456789012345678901234567890123456789012...
---
input: 77: 0123456789012345678901234567890123456789012345678901234567890123456789012...6
output:76: 0123456789012345678901234567890123456789012345678901234567890123456789012..=\r\n
output:04: =2E6
---
Mail_Mime/tests/test_Bug_14779.phpt 0000644 00000000751 14716355766 0013012 0 ustar 00 --TEST--
Bug #14779 Proper header-body separator for empty attachment
--SKIPIF--
--FILE--
addAttachment('', "text/plain", 'file.txt', FALSE, 'base64', 'attachment');
$result = $m->get();
if (preg_match('/(Content.*)--=.*/s', $result, $matches)) {
print_r($matches[1]."END");
}
?>
--EXPECT--
Content-Transfer-Encoding: base64
Content-Type: text/plain;
name=file.txt
Content-Disposition: attachment;
filename=file.txt
END
Mail_Mime/tests/test_Bug_12385_1.phpt 0000644 00000001033 14716355766 0013213 0 ustar 00 --TEST--
Bug #12385 Bad regex when replacing css style attachments
--SKIPIF--
--FILE--
className {
background-image: url('test.gif');
}
";
$mime->setHTMLBody($body);
$mime->setFrom($from);
$mime->addHTMLImage('','image/gif', 'test.gif', false);
$msg = $mime->get();
$cidtag = preg_match("|url\('cid:[^']*'\);|", $msg);
if (!$cidtag){
print("FAIL:\n");
print($msg);
}else{
print("OK");
}
--EXPECT--
OK
Mail_Mime/tests/test_linebreak_larger_76.phpt 0000644 00000004403 14716355766 0015324 0 ustar 00 --TEST--
Test for correct linebreaks for lines _longer_ than 76 chars.
--SKIPIF--
--FILE--
'text/plain',
'encoding' => 'quoted-printable',
);
for ($i=74; $i <= strlen($text); $i++) {
$input = substr($text, 0, $i);
$mimePart = new Mail_mimePart($input, $params);
$encoded = $mimePart->encode();
$output = $encoded['body'];
printf("input: %02d: %s\n", strlen($input), $input);
$lines = explode("\r\n", $output);
for($j=0; $j < count($lines); $j++) {
$line = $lines[$j];
if ($j + 1 < count($lines)) {
$line_vis = $line.'\r\n';
} else {
$line_vis = $line;
}
printf("output:%02d: %s\n", strlen($line), $line_vis);
}
print("---\n");
}
--EXPECT--
input: 74: 12345678901234567890123456789012345678901234567890123456789012345678901234
output:74: 12345678901234567890123456789012345678901234567890123456789012345678901234
---
input: 75: 123456789012345678901234567890123456789012345678901234567890123456789012345
output:75: 123456789012345678901234567890123456789012345678901234567890123456789012345
---
input: 76: 1234567890123456789012345678901234567890123456789012345678901234567890123456
output:76: 1234567890123456789012345678901234567890123456789012345678901234567890123456
---
input: 77: 12345678901234567890123456789012345678901234567890123456789012345678901234567
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:02: 67
---
input: 78: 123456789012345678901234567890123456789012345678901234567890123456789012345678
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:03: 678
---
input: 79: 1234567890123456789012345678901234567890123456789012345678901234567890123456789
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:04: 6789
---
input: 80: 12345678901234567890123456789012345678901234567890123456789012345678901234567890
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:05: 67890
---
Mail_Mime/tests/test_Bug_21255.phpt 0000644 00000000540 14716355766 0012771 0 ustar 00 --TEST--
Bug #21255 Boundary gets added twice
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$mime->setContentType('multipart/alternative', array('boundary' => 'something'));
$msg = $mime->getMessage();
echo substr_count($msg, 'boundary=');
?>
--EXPECT--
1
Mail_Mime/tests/headers_without_mbstring.phpt 0000644 00000020505 14716355766 0015565 0 ustar 00 --TEST--
Multi-test for headers encoding using base64 and quoted-printable
--SKIPIF--
--FILE--
'),
array('From', 'adresse@adresse.de'),
array('From', 'Frank Do '),
array('To', 'Frank Do , James Clark '),
array('From', '"Frank Do" '),
array('Cc', '"Frank Do" , "James Clark" '),
array('Cc', ' , "Kuśmiderski Jan Krzysztof Janusz Długa nazwa" '),
array('From', '"adresse@adresse.de" '),
array('From', 'adresse@adresse.de '),
array('From', '"German Umlauts öäü" '),
array('Subject', 'German Umlauts öäü '),
array('Subject', 'Short ASCII subject'),
array('Subject', 'Long ASCII subject - multiline space separated words - too long for one line'),
array('Subject', 'Short Unicode ż subject'),
array('Subject', 'Long Unicode subject - zażółć gęślą jaźń - too long for one line'),
array('References', ' <4b2e87ac$1@news.home.net.pl> '),
array('To', '"Frank Do" ,, "James Clark" '),
array('To', '"Frank \\" \\\\Do" '),
array('To', 'Frank " \\Do '),
array('Subject', "A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test"),
array('Subject', "TEST Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir!!!?"),
array('Subject', "Update: Microsoft Windows-Tool zum Entfernen bösartiger Software 3.6"),
array('From', "test@nàme "),
array('From', "Test <\"test test\"@domain.com>"),
array('From', "\"test test\"@domain.com"),
array('From', "<\"test test\"@domain.com>"),
array('From', "Doe"),
array('From', "\"John Doe\""),
array('Mail-Reply-To', 'adresse@adresse.de '),
array('Mail-Reply-To', '"öäü" '),
);
$i = 1;
foreach ($headers as $header) {
$hdr = $mime->encodeHeader($header[0], $header[1], 'UTF-8', 'base64');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$hdr = $mime->encodeHeader($header[0], $header[1], 'UTF-8', 'quoted-printable');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$i++;
}
?>
--EXPECT--
[01] From:
[01] From:
[02] From: adresse@adresse.de
[02] From: adresse@adresse.de
[03] From: Frank Do
[03] From: Frank Do
[04] To: Frank Do , James Clark
[04] To: Frank Do , James Clark
[05] From: "Frank Do"
[05] From: "Frank Do"
[06] Cc: "Frank Do" , "James Clark"
[06] Cc: "Frank Do" , "James Clark"
[07] Cc: , =?UTF-8?B?S3XFm21pZGVyc2tpIEphbiBLcnp5c3p0b2Yg?=
=?UTF-8?B?SmFudXN6IETFgnVnYSBuYXp3YQ==?=
[07] Cc: ,
=?UTF-8?Q?Ku=C5=9Bmiderski_Jan_Krzysztof_Janusz_D?=
=?UTF-8?Q?=C5=82uga_nazwa?=
[08] From: "adresse@adresse.de"
[08] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[10] From: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8?=
[10] From: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC?=
[11] Subject: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8IDxhZHJlc3NlQGFkcmVzc2Uu?=
=?UTF-8?B?ZGU+?=
[11] Subject: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC_=3Cadresse=40adresse?=
=?UTF-8?Q?=2Ede=3E?=
[12] Subject: Short ASCII subject
[12] Subject: Short ASCII subject
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[14] Subject: =?UTF-8?B?U2hvcnQgVW5pY29kZSDFvCBzdWJqZWN0?=
[14] Subject: =?UTF-8?Q?Short_Unicode_=C5=BC_subject?=
[15] Subject: =?UTF-8?B?TG9uZyBVbmljb2RlIHN1YmplY3QgLSB6YcW8w7PFgsSHIGfEmcWb?=
=?UTF-8?B?bMSFIGphxbrFhCAtIHRvbyBsb25nIGZvciBvbmUgbGluZQ==?=
[15] Subject: =?UTF-8?Q?Long_Unicode_subject_-_za=C5=BC=C3=B3=C5=82=C4=87_g=C4?=
=?UTF-8?Q?=99=C5=9Bl=C4=85_ja=C5=BA=C5=84_-_too_long_for_one_line?=
[16] References:
<4b2e87ac$1@news.home.net.pl>
[16] References:
<4b2e87ac$1@news.home.net.pl>
[17] To: "Frank Do" , "James Clark"
[17] To: "Frank Do" , "James Clark"
[18] To: "Frank \" \\Do"
[18] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[21] Subject: =?UTF-8?B?VEVTVCBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1p?=
=?UTF-8?B?ciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIg?=
=?UTF-8?B?Z3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRv?=
=?UTF-8?B?bGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zD?=
=?UTF-8?B?n2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1p?=
=?UTF-8?B?ciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIg?=
=?UTF-8?B?Z3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRv?=
=?UTF-8?B?bGxlIGdyw7zDn2Ugdm9uIG1pciEhIT8=?=
[21] Subject: =?UTF-8?Q?TEST_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir?=
=?UTF-8?Q?_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_g?=
=?UTF-8?Q?r=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tol?=
=?UTF-8?Q?le_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC?=
=?UTF-8?Q?=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_m?=
=?UTF-8?Q?ir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper?=
=?UTF-8?Q?_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_t?=
=?UTF-8?Q?olle_gr=C3=BC=C3=9Fe_von_mir!!!=3F?=
[22] Subject: =?UTF-8?B?VXBkYXRlOiBNaWNyb3NvZnQgV2luZG93cy1Ub29sIHp1bSBFbnRm?=
=?UTF-8?B?ZXJuZW4gYsO2c2FydGlnZXIgU29mdHdhcmUgMy42?=
[22] Subject: =?UTF-8?Q?Update=3A_Microsoft_Windows-Tool_zum_Entfernen_b=C3=B6sa?=
=?UTF-8?Q?rtiger_Software_3=2E6?=
[23] From: =?UTF-8?B?dGVzdEBuw6BtZQ==?=
[23] From: =?UTF-8?Q?test=40n=C3=A0me?=
[24] From: Test <"test test"@domain.com>
[24] From: Test <"test test"@domain.com>
[25] From: "test test"@domain.com
[25] From: "test test"@domain.com
[26] From: <"test test"@domain.com>
[26] From: <"test test"@domain.com>
[27] From: Doe
[27] From: Doe
[28] From: "John Doe"
[28] From: "John Doe"
[29] Mail-Reply-To: "adresse@adresse.de"
[29] Mail-Reply-To: "adresse@adresse.de"
[30] Mail-Reply-To: =?UTF-8?B?w7bDpMO8?=
[30] Mail-Reply-To: =?UTF-8?Q?=C3=B6=C3=A4=C3=BC?=
Mail_Mime/tests/test_Bug_12411.phpt 0000644 00000001211 14716355766 0012757 0 ustar 00 --TEST--
Bug #12411 RFC2047 encoded attachment filenames
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain", $filename, FALSE,
'base64', 'attachment', 'ISO-8859-1', 'pl', '',
'quoted-printable', 'base64');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/(name|filename)=([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[2]);
}
?>
--EXPECT--
"=?ISO-8859-1?Q?=C5=9Bciema?="
"=?ISO-8859-1?B?xZtjaWVtYQ==?=";
Mail_Mime/tests/test_Bug_17025.phpt 0000644 00000000634 14716355766 0012775 0 ustar 00 --TEST--
Bug #16539 Headers longer than 998 characters
--SKIPIF--
--FILE--
headers($headers);
print_r($hdrs['From']);
?>
--EXPECT--
aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhh
Mail_Mime/tests/test_Bug_14780.phpt 0000644 00000000537 14716355766 0013004 0 ustar 00 --TEST--
Bug #14780 Invalid Content-Type when headers() is called before get()
--SKIPIF--
--FILE--
setTXTBody("test");
$mime->setHTMLBody("test");
$head1 = $mime->headers();
$body = $mime->get();
$head2 = $mime->headers();
if ($head1 === $head2) {
echo "OK";
}
?>
--EXPECT--
OK
Mail_Mime/tests/test_Bug_3513_3.phpt 0000644 00000001167 14716355766 0013136 0 ustar 00 --TEST--
Bug #3513 Support of RFC2231 in header fields. (ISO-2022-JP)
--SKIPIF--
--FILE--
addAttachment('testfile',"text/plain", $test, FALSE, 'base64', 'attachment', 'iso-2022-jp', '');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match('/filename([^\s]+)/i', $content, $matches)) {
echo $matches[1];
}
?>
--EXPECT--
*=iso-2022-jp''%1B$BF|K%5C8l%1B%28B.txt;
Structures_Graph/tests/AllTests.php 0000644 00000000674 14716355766 0013511 0 ustar 00 addTestFiles($dir);
return $suite;
}
}
Structures_Graph/tests/AcyclicTestTest.php 0000644 00000002434 14716355766 0015021 0 ustar 00 addNode($node1);
$node2 = new Structures_Graph_Node();
$graph->addNode($node2);
$node1->connectTo($node2);
$node3 = new Structures_Graph_Node();
$graph->addNode($node3);
$node2->connectTo($node3);
$node3->connectTo($node1);
$this->assertFalse(
Structures_Graph_Manipulator_AcyclicTest::isAcyclic($graph),
'Graph is cyclic'
);
}
public function testIsAcyclicTrue()
{
$graph = new Structures_Graph();
$node1 = new Structures_Graph_Node();
$graph->addNode($node1);
$node2 = new Structures_Graph_Node();
$graph->addNode($node2);
$node1->connectTo($node2);
$node3 = new Structures_Graph_Node();
$graph->addNode($node3);
$node2->connectTo($node3);
$this->assertTrue(
Structures_Graph_Manipulator_AcyclicTest::isAcyclic($graph),
'Graph is acyclic'
);
}
}
?>
Structures_Graph/tests/TopologicalSorterTest.php 0000644 00000003525 14716355766 0016267 0 ustar 00 setData($name1);
$graph->addNode($node1);
$name11 = 'node11';
$node11 = new Structures_Graph_Node();
$node11->setData($name11);
$graph->addNode($node11);
$node1->connectTo($node11);
$name12 = 'node12';
$node12 = new Structures_Graph_Node();
$node12->setData($name12);
$graph->addNode($node12);
$node1->connectTo($node12);
$name121 = 'node121';
$node121 = new Structures_Graph_Node();
$node121->setData($name121);
$graph->addNode($node121);
$node12->connectTo($node121);
$name2 = 'node2';
$node2 = new Structures_Graph_Node();
$node2->setData($name2);
$graph->addNode($node2);
$name21 = 'node21';
$node21 = new Structures_Graph_Node();
$node21->setData($name21);
$graph->addNode($node21);
$node2->connectTo($node21);
$nodes = Structures_Graph_Manipulator_TopologicalSorter::sort($graph);
$this->assertCount(2, $nodes[0]);
$this->assertEquals('node1', $nodes[0][0]->getData());
$this->assertEquals('node2', $nodes[0][1]->getData());
$this->assertCount(3, $nodes[1]);
$this->assertEquals('node11', $nodes[1][0]->getData());
$this->assertEquals('node12', $nodes[1][1]->getData());
$this->assertEquals('node21', $nodes[1][2]->getData());
$this->assertCount(1, $nodes[2]);
$this->assertEquals('node121', $nodes[2][0]->getData());
}
}
?>
Structures_Graph/tests/helper.inc 0000644 00000000536 14716355766 0013214 0 ustar 00 |
// +-----------------------------------------------------------------------------+
//
require_once dirname(__FILE__) . '/helper.inc';
/**
* @access private
*/
class BasicGraph extends PHPUnit_Framework_TestCase
{
var $_graph = null;
function test_create_graph() {
$this->_graph = new Structures_Graph();
$this->assertTrue(is_a($this->_graph, 'Structures_Graph'));
}
function test_add_node() {
$this->_graph = new Structures_Graph();
$data = 1;
$node = new Structures_Graph_Node($data);
$this->_graph->addNode($node);
$node = new Structures_Graph_Node($data);
$this->_graph->addNode($node);
$node = new Structures_Graph_Node($data);
$this->_graph->addNode($node);
}
function test_connect_node() {
$this->_graph = new Structures_Graph();
$data = 1;
$node1 = new Structures_Graph_Node($data);
$node2 = new Structures_Graph_Node($data);
$this->_graph->addNode($node1);
$this->_graph->addNode($node2);
$node1->connectTo($node2);
$node =& $this->_graph->getNodes();
$node =& $node[0];
$node = $node->getNeighbours();
$node =& $node[0];
/*
ZE1 == and === operators fail on $node,$node2 because of the recursion introduced
by the _graph field in the Node object. So, we'll use the stupid method for reference
testing
*/
$node = true;
$this->assertTrue($node2);
$node = false;
$this->assertFalse($node2);
}
function test_data_references() {
$this->_graph = new Structures_Graph();
$data = 1;
$node = new Structures_Graph_Node();
$node->setData($data);
$this->_graph->addNode($node);
$data = 2;
$dataInNode =& $this->_graph->getNodes();
$dataInNode =& $dataInNode[0];
$dataInNode =& $dataInNode->getData();
$this->assertEquals($data, $dataInNode);
}
function test_metadata_references() {
$this->_graph = new Structures_Graph();
$data = 1;
$node = new Structures_Graph_Node();
$node->setMetadata('5', $data);
$data = 2;
$dataInNode =& $node->getMetadata('5');
$this->assertEquals($data, $dataInNode);
}
function test_metadata_key_exists() {
$this->_graph = new Structures_Graph();
$data = 1;
$node = new Structures_Graph_Node();
$node->setMetadata('5', $data);
$this->assertTrue($node->metadataKeyExists('5'));
$this->assertFalse($node->metadataKeyExists('1'));
}
function test_directed_degree() {
$this->_graph = new Structures_Graph(true);
$node = array();
$node[] = new Structures_Graph_Node();
$node[] = new Structures_Graph_Node();
$node[] = new Structures_Graph_Node();
$this->_graph->addNode($node[0]);
$this->_graph->addNode($node[1]);
$this->_graph->addNode($node[2]);
$this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 0 arcs');
$this->assertEquals(0, $node[1]->inDegree(), 'inDegree test failed for node 1 with 0 arcs');
$this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 0 arcs');
$this->assertEquals(0, $node[0]->outDegree(), 'outDegree test failed for node 0 with 0 arcs');
$this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 0 arcs');
$this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 0 arcs');
$node[0]->connectTo($node[1]);
$this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 1 arc');
$this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 1 arc');
$this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 1 arc');
$this->assertEquals(1, $node[0]->outDegree(), 'outDegree test failed for node 0 with 1 arc');
$this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 1 arc');
$this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 1 arc');
$node[0]->connectTo($node[2]);
$this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 2 arcs');
$this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 2 arcs');
$this->assertEquals(1, $node[2]->inDegree(), 'inDegree test failed for node 2 with 2 arcs');
$this->assertEquals(2, $node[0]->outDegree(), 'outDegree test failed for node 0 with 2 arcs');
$this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 2 arcs');
$this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 2 arcs');
}
function test_undirected_degree() {
$this->_graph = new Structures_Graph(false);
$node = array();
$node[] = new Structures_Graph_Node();
$node[] = new Structures_Graph_Node();
$node[] = new Structures_Graph_Node();
$this->_graph->addNode($node[0]);
$this->_graph->addNode($node[1]);
$this->_graph->addNode($node[2]);
$this->assertEquals(0, $node[0]->inDegree(), 'inDegree test failed for node 0 with 0 arcs');
$this->assertEquals(0, $node[1]->inDegree(), 'inDegree test failed for node 1 with 0 arcs');
$this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 0 arcs');
$this->assertEquals(0, $node[0]->outDegree(), 'outDegree test failed for node 0 with 0 arcs');
$this->assertEquals(0, $node[1]->outDegree(), 'outDegree test failed for node 1 with 0 arcs');
$this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 0 arcs');
$node[0]->connectTo($node[1]);
$this->assertEquals(1, $node[0]->inDegree(), 'inDegree test failed for node 0 with 1 arc');
$this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 1 arc');
$this->assertEquals(0, $node[2]->inDegree(), 'inDegree test failed for node 2 with 1 arc');
$this->assertEquals(1, $node[0]->outDegree(), 'outDegree test failed for node 0 with 1 arc');
$this->assertEquals(1, $node[1]->outDegree(), 'outDegree test failed for node 1 with 1 arc');
$this->assertEquals(0, $node[2]->outDegree(), 'outDegree test failed for node 2 with 1 arc');
$node[0]->connectTo($node[2]);
$this->assertEquals(2, $node[0]->inDegree(), 'inDegree test failed for node 0 with 2 arcs');
$this->assertEquals(1, $node[1]->inDegree(), 'inDegree test failed for node 1 with 2 arcs');
$this->assertEquals(1, $node[2]->inDegree(), 'inDegree test failed for node 2 with 2 arcs');
$this->assertEquals(2, $node[0]->outDegree(), 'outDegree test failed for node 0 with 2 arcs');
$this->assertEquals(1, $node[1]->outDegree(), 'outDegree test failed for node 1 with 2 arcs');
$this->assertEquals(1, $node[2]->outDegree(), 'outDegree test failed for node 2 with 2 arcs');
}
}
?>
XML_Util/tests/ApiVersionTests.php 0000644 00000000335 14716355766 0013203 0 ustar 00 assertEquals('1.4', XML_Util::apiVersion());
}
} XML_Util/tests/CreateEndElementTests.php 0000644 00000001145 14716355766 0014270 0 ustar 00 ";
$this->assertEquals($expected, XML_Util::createEndElement($original));
}
/**
* @covers XML_Util::createEndElement()
*/
public function testCreateEndElementWithNamespacedTag()
{
$original = "myNs:myTag";
$expected = "";
$this->assertEquals($expected, XML_Util::createEndElement($original));
}
}
XML_Util/tests/GetXmlDeclarationTests.php 0000644 00000002214 14716355766 0014470 0 ustar 00 ";
$this->assertEquals($expected, XML_Util::getXMLDeclaration($version));
}
/**
* @covers XML_Util::getXMLDeclaration()
*/
public function testGetXMLDeclarationUsingVersionAndEncodingAndStandalone()
{
$version = "1.0";
$encoding = "UTF-8";
$standalone = true;
$expected = "";
$this->assertEquals($expected, XML_Util::getXMLDeclaration($version, $encoding, $standalone));
}
/**
* @covers XML_Util::getXMLDeclaration()
*/
public function testGetXMLDeclarationUsingVersionAndStandalone()
{
$version = "1.0";
$encoding = null;
$standalone = true;
$expected = "";
$this->assertEquals($expected, XML_Util::getXMLDeclaration($version, $encoding, $standalone));
}
}
XML_Util/tests/CreateCommentTests.php 0000644 00000000524 14716355766 0013652 0 ustar 00 ";
$this->assertEquals($expected, XML_Util::createComment($original));
}
}
XML_Util/tests/Bug21177Tests.php 0000644 00000002036 14716355766 0012243 0 ustar 00 ';
return array(
array('', ''),
array('', ''),
array('', ''),
array('', ''),
);
}
/**
* @dataProvider getTestCandidate()
*/
public function testCollapseEmptyTagsForBug21177($original, $expected)
{
$this->assertEquals($expected, XML_Util::collapseEmptyTags($original, XML_UTIL_COLLAPSE_ALL), "Failed bugcheck.");
}
}
XML_Util/tests/Bug21184Tests.php 0000644 00000000702 14716355766 0012237 0 ustar 00 one';
$this->assertEquals($xml, XML_Util::collapseEmptyTags($xml, XML_UTIL_COLLAPSE_ALL));
}
}
XML_Util/tests/CollapseEmptyTagsTests.php 0000644 00000010401 14716355766 0014517 0 ustar 00 ";
$expected = "";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsBasicUsageAlongsideNonemptyTag()
{
$emptyTag = "";
$otherTag = "baz";
$expected = "baz";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag . $otherTag));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyTagWithCollapseAll()
{
$emptyTag = "";
$expected = "";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag, XML_UTIL_COLLAPSE_ALL));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyTagAlongsideNonemptyTagWithCollapseAll()
{
$emptyTag = "";
$otherTag = "baz";
$expected = "baz";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag . $otherTag, XML_UTIL_COLLAPSE_ALL));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyTagAlongsideNonemptyTagAlongsideEmptyTagWithCollapseAll()
{
$emptyTag = "";
$otherTag = "baz";
$expected = "baz";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag . $otherTag . $emptyTag, XML_UTIL_COLLAPSE_ALL));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyPrefixedTagAlongsideNonemptyTagAlongsideEmptyPrefixedTagWithCollapseAll()
{
$emptyTag = "";
$otherTag = "baz";
$expected = "baz";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag . $otherTag . $emptyTag, XML_UTIL_COLLAPSE_ALL));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyNsPrefixedTagAlongsideNonemptyTagAlongsideEmptyNsPrefixedTagWithCollapseAll()
{
$emptyTag = "";
$otherTag = "baz";
$expected = "baz";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag . $otherTag . $emptyTag, XML_UTIL_COLLAPSE_ALL));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyTagWithCollapseXhtml()
{
$emptyTag = "";
$expected = "";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag, XML_UTIL_COLLAPSE_XHTML_ONLY));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyTagAlongsideNonemptyTagWithCollapseXhtml()
{
$emptyTag = "";
$otherTag = "baz";
$xhtmlTag = "
";
$expected = "
baz";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag . $xhtmlTag . $otherTag, XML_UTIL_COLLAPSE_XHTML_ONLY));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyTagWithCollapseNone()
{
$emptyTag = "";
$expected = "";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag, XML_UTIL_COLLAPSE_NONE));
}
/**
* @covers XML_Util::collapseEmptyTags()
*/
public function testCollapseEmptyTagsOnOneEmptyTagAlongsideNonemptyTagWithCollapseNone()
{
$emptyTag = "";
$otherTag = "baz";
$expected = "baz";
$this->assertEquals($expected, XML_Util::collapseEmptyTags($emptyTag . $otherTag, XML_UTIL_COLLAPSE_NONE));
}
}
XML_Util/tests/SplitQualifiedNameTests.php 0000644 00000001507 14716355766 0014646 0 ustar 00 'xslt',
'localPart' => 'stylesheet',
);
$this->assertEquals($expected, XML_Util::splitQualifiedName($original));
}
/**
* @covers XML_Util::splitQualifiedName()
*/
public function testSplitQualifiedNameWithNamespace()
{
$original = "stylesheet";
$namespace = "myNs";
$expected = array(
'namespace' => 'myNs',
'localPart' => 'stylesheet',
);
$this->assertEquals($expected, XML_Util::splitQualifiedName($original, $namespace));
}
}
XML_Util/tests/ReverseEntitiesTests.php 0000644 00000010326 14716355766 0014245 0 ustar 00 .";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData()));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForSimpleDataWithInvalidOptionReturnsOriginalData()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData(), 'INVALID_OPTION'));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForSimpleDataWithEntitiesXml()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForSimpleDataWithEntitiesXmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML), $encoding);
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForUtf8DataWithEntitiesXmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This data contains special chars like <, >, & and \" as well as ä, ö, ß, à and ê";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getUtf8Data(), XML_UTIL_ENTITIES_XML), $encoding);
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForSimpleDataWithEntitiesXmlRequired()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML_REQUIRED));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForSimpleDataWithEntitiesXmlRequiredAndEncoding()
{
$encoding = "UTF-8";
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML_REQUIRED, $encoding));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForUtf8DataWithEntitiesXmlRequiredAndEncoding()
{
$encoding = "UTF-8";
$expected = "This data contains special chars like <, >, & and \" as well as ä, ö, ß, à and ê";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getUtf8Data(), XML_UTIL_ENTITIES_XML_REQUIRED, $encoding));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForSimpleDataWithEntitiesHtml()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData(), XML_UTIL_ENTITIES_HTML));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForSimpleDataWithEntitiesHtmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getSimpleData(), XML_UTIL_ENTITIES_HTML, $encoding));
}
/**
* @covers XML_Util::reverseEntities()
*/
public function testReverseEntitiesForUtf8DataWithEntitiesHtmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This data contains special chars like <, >, & and \" as well as ä, ö, ß, à and ê";
$this->assertEquals($expected, XML_Util::reverseEntities($this->getUtf8Data(), XML_UTIL_ENTITIES_HTML, $encoding));
}
}
XML_Util/tests/GetDocTypeDeclarationTests.php 0000644 00000003363 14716355766 0015305 0 ustar 00 ";
$this->assertEquals($expected, XML_Util::getDocTypeDeclaration("rootTag"));
}
/**
* @covers XML_Util::getDocTypeDeclaration()
*/
public function testGetDocTypeDeclarationUsingRootAndStringUri()
{
$expected = "";
$this->assertEquals($expected, XML_Util::getDocTypeDeclaration("rootTag", "myDocType.dtd"));
}
/**
* @covers XML_Util::getDocTypeDeclaration()
*/
public function testGetDocTypeDeclarationUsingRootAndArrayUri()
{
$uri = array(
'uri' => 'http://pear.php.net/dtd/package-1.0',
'id' => '-//PHP//PEAR/DTD PACKAGE 0.1'
);
$expected = "";
$this->assertEquals($expected, XML_Util::getDocTypeDeclaration("rootTag", $uri));
}
/**
* @covers XML_Util::getDocTypeDeclaration()
*/
public function testGetDocTypeDeclarationUsingRootAndArrayUriAndInternalDtd()
{
$uri = array(
'uri' => 'http://pear.php.net/dtd/package-1.0',
'id' => '-//PHP//PEAR/DTD PACKAGE 0.1'
);
$dtdEntry = '';
$expected =
<<< EOF
]>
EOF;
$this->assertEquals($expected, XML_Util::getDocTypeDeclaration("rootTag", $uri, $dtdEntry));
}
}
XML_Util/tests/Bug18343Tests.php 0000644 00000003316 14716355766 0012246 0 ustar 00 "install",
"attributes" => array(
"as" => "Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek",
"name" => "test/Horde/Feed/fixtures/lexicon/http-p.moreover.com-cgi-local-page%2Fo=rss&s=Newsweek",
)
);
public function getFlagsToTest()
{
new XML_Util(); // for constants to be declared
return array(
array('no flag', null),
array('false', false),
array('ENTITIES_NONE', XML_UTIL_ENTITIES_NONE),
array('ENTITIES_XML', XML_UTIL_ENTITIES_XML),
array('ENTITIES_XML_REQUIRED', XML_UTIL_ENTITIES_XML_REQUIRED),
array('ENTITIES_HTML', XML_UTIL_ENTITIES_HTML),
array('REPLACE_ENTITIES', XML_UTIL_REPLACE_ENTITIES),
);
}
/**
* @dataProvider getFlagsToTest()
*/
public function testCreateTagFromArrayForBug18343($key, $flag)
{
// all flags for the candidate input should return the same result
$expected =
<<< EOF
EOF;
$this->assertEquals($expected, XML_Util::createTagFromArray($this->tagArray, $flag), "Failed bugcheck for $key.");
}
}
XML_Util/tests/Bug4950Tests.php 0000644 00000001331 14716355766 0012160 0 ustar 00 here!";
$namespaceUrl = null;
$expected = " here!]]>";
$result = XML_Util::createTag($qname, $attributes, $content, $namespaceUrl, XML_UTIL_CDATA_SECTION);
$this->assertEquals($expected, $result, "Failed bugcheck.");
}
}
XML_Util/tests/RaiseErrorTests.php 0000644 00000000700 14716355766 0013175 0 ustar 00 assertInstanceOf('PEAR_Error', $error);
$this->assertEquals($message, $error->getMessage());
$this->assertEquals($code, $error->getCode());
}
}
XML_Util/tests/ReplaceEntitiesTests.php 0000644 00000010341 14716355766 0014202 0 ustar 00 .';
}
protected function getUtf8Data()
{
return 'This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê';
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleData()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData()));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleDataWithInvalidOptionReturnsOriginalData()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData(), 'INVALID_OPTION'));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleDataWithEntitiesXml()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleDataWithEntitiesXmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML, $encoding));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForUtf8DataWithEntitiesXmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getUtf8Data(), XML_UTIL_ENTITIES_XML, $encoding));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleDataWithEntitiesXmlRequired()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML_REQUIRED));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleDataWithEntitiesXmlRequiredAndEncoding()
{
$encoding = "UTF-8";
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData(), XML_UTIL_ENTITIES_XML_REQUIRED, $encoding));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForUtf8DataWithEntitiesXmlRequiredAndEncoding()
{
$encoding = "UTF-8";
$expected = "This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getUtf8Data(), XML_UTIL_ENTITIES_XML_REQUIRED, $encoding));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleDataWithEntitiesHtml()
{
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData(), XML_UTIL_ENTITIES_HTML));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForSimpleDataWithEntitiesHtmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This string contains < & >.";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getSimpleData(), XML_UTIL_ENTITIES_HTML, $encoding));
}
/**
* @covers XML_Util::replaceEntities()
*/
public function testReplaceEntitiesForUtf8DataWithEntitiesHtmlAndEncoding()
{
$encoding = "UTF-8";
$expected = "This data contains special chars like <, >, & and " as well as ä, ö, ß, à and ê";
$this->assertEquals($expected, XML_Util::replaceEntities($this->getUtf8Data(), XML_UTIL_ENTITIES_HTML, $encoding));
}
}
XML_Util/tests/CreateCDataSectionTests.php 0000644 00000000552 14716355766 0014552 0 ustar 00 ";
$this->assertEquals($expected, XML_Util::createCDataSection($original));
}
}
XML_Util/tests/CreateTagFromArrayTests.php 0000644 00000032264 14716355766 0014614 0 ustar 00 "foo:bar",
);
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespace()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
);
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributes()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
);
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContent()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndAttributesAndContent()
{
$original = array(
"qname" => "foo:bar",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndContent()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"content" => "I'm inside the tag",
);
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithEntitiesNone()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_ENTITIES_NONE));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithReplaceEntities()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_REPLACE_ENTITIES));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithReplaceEntitiesAndMultilineFalse()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$multiline = false;
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_REPLACE_ENTITIES, $multiline));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithReplaceEntitiesAndMultilineTrue()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$multiline = true;
$expected =
<<< EOF
I'm inside the tag
EOF;
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_REPLACE_ENTITIES, $multiline));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithReplaceEntitiesAndMultilineTrueAndIndent()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$multiline = true;
$indent = " ";
$expected =
<<< EOF
I'm inside the tag
EOF;
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithReplaceEntitiesAndMultilineTrueAndIndentAndLinebreak()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$multiline = true;
$indent = " ";
$linebreak = "^";
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent, $linebreak));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithReplaceEntitiesAndMultilineTrueAndIndentAndLinebreakAndSortAttributesTrue()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$multiline = true;
$indent = " ";
$linebreak = "^";
$sortAttributes = true;
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent, $linebreak, $sortAttributes));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameAndNamespaceAndAttributesAndContentWithReplaceEntitiesAndMultilineTrueAndIndentAndLinebreakAndSortAttributesFalse()
{
$original = array(
"qname" => "foo:bar",
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$multiline = true;
$indent = " ";
$linebreak = "^";
$sortAttributes = false;
$expected = "I'm inside the tag";
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent, $linebreak, $sortAttributes));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithInvalidArray()
{
$badArray = array(
"foo" => "bar",
);
$expectedError = "You must either supply a qualified name (qname) or local tag name (localPart).";
$this->assertEquals($expectedError, XML_Util::createTagFromArray($badArray));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithNamespaceAndAttributesAndContentButWithoutQname()
{
$original = array(
"namespaceUri" => "http://foo.com",
"attributes" => array( "key" => "value", "argh" => "fruit&vegetable" ),
"content" => "I'm inside the tag",
);
$expectedError = "You must either supply a qualified name (qname) or local tag name (localPart).";
$this->assertEquals($expectedError, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithNonScalarContent()
{
$badArray = array(
'content' => array('foo', 'bar'),
);
$expectedError = "Supplied non-scalar value as tag content";
$this->assertEquals($expectedError, XML_Util::createTagFromArray($badArray));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithArrayOfNamespaces()
{
$original = array(
'qname' => 'foo:bar',
'namespaces' => array('ns1' => 'uri1', 'ns2' => 'uri2'),
);
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameDerivedFromNamespaceUriAndLocalPart()
{
$original = array(
'namespaceUri' => 'http://bar.org',
'localPart' => 'foo'
);
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameDerivedFromNamespaceAndLocalPart()
{
$original = array(
'namespace' => 'http://foo.org',
'localPart' => 'bar'
);
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithQnameDerivedFromLocalPart()
{
$original = array(
'namespace' => '',
'localPart' => 'bar'
);
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original));
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayWithImplicitlyEmptyContentAndCollapseNoneDoesNotCollapseTag()
{
$original = array('qname' => 'tag1');
$expected = "";
$actual = XML_Util::createTagFromArray(
$original,
XML_UTIL_REPLACE_ENTITIES, // default $replaceEntities
false, // default $multiline
'_auto', // default $indent
"\n", // default $linebreak
true, // default $sortAttributes
XML_UTIL_COLLAPSE_NONE
);
$this->assertEquals($expected, $actual);
}
/**
* @covers XML_Util::createTagFromArray()
*/
public function testCreateTagFromArrayForCdataWithExplicitlyEmptyContentDoesNotCollapseTag()
{
$original = array('qname' => 'tag1', 'content' => '');
$expected = "";
$this->assertEquals($expected, XML_Util::createTagFromArray($original, XML_UTIL_CDATA_SECTION));
}
}
XML_Util/tests/CreateStartElementTests.php 0000644 00000012442 14716355766 0014661 0 ustar 00 ";
$this->assertEquals($expected, XML_Util::createStartElement($original));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithAttributes()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$expected = "";
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithEmptyAttributes()
{
$originalTag = "myNs:myTag";
$originalAttributes = "";
$expected = "";
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithAttributesAndNamespace()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalNamespace = "http://www.w3c.org/myNs#";
$expected = "";
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes, $originalNamespace));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithEmptyAttributesAndNonUriNamespace()
{
$originalTag = "myTag";
$originalAttributes = "";
$originalNamespace = "foo";
$expected = "";
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes, $originalNamespace));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithAttributesAndNamespaceWithMultiline()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalNamespace = "http://www.w3c.org/myNs#";
$expected =
<<< EOF
EOF;
$multiline = true;
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes, $originalNamespace, $multiline));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithAttributesAndNamespaceWithMultilineAndIndent()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalNamespace = "http://www.w3c.org/myNs#";
$expected =
<<< EOF
EOF;
$multiline = true;
$indent = " ";
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes, $originalNamespace, $multiline, $indent));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithAttributesAndNamespaceWithMultilineAndIndentAndLinebreak()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalNamespace = "http://www.w3c.org/myNs#";
$expected = "";
$multiline = true;
$indent = " ";
$linebreak = "^";
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes, $originalNamespace, $multiline, $indent, $linebreak));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithAttributesAndNamespaceWithMultilineAndIndentAndLinebreakAndSortAttributesIsTrue()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar", "boo" => "baz");
$originalNamespace = "http://www.w3c.org/myNs#";
$expected = "";
$multiline = true;
$indent = " ";
$linebreak = "^";
$sortAttributes = true;
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes, $originalNamespace, $multiline, $indent, $linebreak, $sortAttributes));
}
/**
* @covers XML_Util::createStartElement()
*/
public function testCreateStartElementForTagWithAttributesAndNamespaceWithMultilineAndIndentAndLinebreakAndSortAttributesIsFalse()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar", "boo" => "baz");
$originalNamespace = "http://www.w3c.org/myNs#";
$expected = "";
$multiline = true;
$indent = " ";
$linebreak = "^";
$sortAttributes = false;
$this->assertEquals($expected, XML_Util::createStartElement($originalTag, $originalAttributes, $originalNamespace, $multiline, $indent, $linebreak, $sortAttributes));
}
}
XML_Util/tests/AbstractUnitTests.php 0000644 00000000650 14716355766 0013527 0 ustar 00 "bar");
$expected = "";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContent()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag";
$expected = "This is inside the tag";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespace()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag";
$originalNamespace = "http://www.w3c.org/myNs#";
$expected = "This is inside the tag";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithCDataSection()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$expected = " in it]]>";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_CDATA_SECTION));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithReplaceEntities()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$expected = "This is inside the tag and has < & @ > in it";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_REPLACE_ENTITIES));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithReplaceEntitiesAndMultilineFalse()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$multiline = false;
$expected = "This is inside the tag and has < & @ > in it";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_REPLACE_ENTITIES, $multiline));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithReplaceEntitiesAndMultilineTrue()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$multiline = true;
$expected =
<<< EOF
This is inside the tag and has < & @ > in it
EOF;
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_REPLACE_ENTITIES, $multiline));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithReplaceEntitiesAndMultilineTrueAndIndent()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$multiline = true;
$indent = " ";
$expected =
<<< EOF
This is inside the tag and has < & @ > in it
EOF;
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithReplaceEntitiesAndMultilineTrueAndIndentAndLinebreak()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$multiline = true;
$indent = " ";
$linebreak = "^";
$expected = "This is inside the tag and has < & @ > in it";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent, $linebreak));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithReplaceEntitiesAndMultilineTrueAndIndentAndLinebreakAndSortAttributesTrue()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar", "boo" => "baz");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$multiline = true;
$indent = " ";
$linebreak = "^";
$sortAttributes = true;
$expected = "This is inside the tag and has < & @ > in it";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent, $linebreak, $sortAttributes));
}
/**
* @covers XML_Util::createTag()
*/
public function testCreateTagForTagWithAttributesAndContentAndNamespaceWithReplaceEntitiesAndMultilineTrueAndIndentAndLinebreakAndSortAttributesFalse()
{
$originalTag = "myNs:myTag";
$originalAttributes = array("foo" => "bar", "boo" => "baz");
$originalContent = "This is inside the tag and has < & @ > in it";
$originalNamespace = "http://www.w3c.org/myNs#";
$multiline = true;
$indent = " ";
$linebreak = "^";
$sortAttributes = false;
$expected = "This is inside the tag and has < & @ > in it";
$this->assertEquals($expected, XML_Util::createTag($originalTag, $originalAttributes, $originalContent, $originalNamespace, XML_UTIL_REPLACE_ENTITIES, $multiline, $indent, $linebreak, $sortAttributes));
}
}
XML_Util/tests/Bug5392Tests.php 0000644 00000001377 14716355766 0012173 0 ustar 00 , & and " as well as ä, ö, ß, à and ê';
$replacedResult = XML_Util::replaceEntities($original, XML_UTIL_ENTITIES_HTML, "UTF-8");
$reversedResult = XML_Util::reverseEntities($replacedResult, XML_UTIL_ENTITIES_HTML, "UTF-8");
$this->assertEquals($original, $reversedResult, "Failed bugcheck.");
}
}
XML_Util/tests/AttributesToStringTests.php 0000644 00000017026 14716355766 0014751 0 ustar 00 'bar','boo' => 'baz',);
$expected = " boo=\"baz\" foo=\"bar\"";
$this->assertEquals($expected, XML_Util::attributesToString($original));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithExplicitSortTrue()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$expected = " boo=\"baz\" foo=\"bar\"";
$sort = true;
$this->assertEquals($expected, XML_Util::attributesToString($original, $sort));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithExplicitSortFalse()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$expected = " foo=\"bar\" boo=\"baz\"";
$sort = false;
$this->assertEquals($expected, XML_Util::attributesToString($original, $sort));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithMultilineFalse()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$expected = " boo=\"baz\" foo=\"bar\"";
$sort = true;
$multiline = false;
$this->assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithMultilineTrue()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$expected =
<<< EOF
boo="baz"
foo="bar"
EOF;
$sort = true;
$multiline = true;
$this->assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithExplicitIndent()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$expected = " boo=\"baz\"\n foo=\"bar\"";
$sort = true;
$multiline = true;
$indent = ' '; // 8 spaces
$this->assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline, $indent));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithExplicitLinebreak()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$expected = " boo=\"baz\"\n^foo=\"bar\"";
$sort = true;
$multiline = true;
$linebreak = '^'; // some dummy character
$this->assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline, $linebreak));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithOptionsThatIncludesSort()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$options = array(
'multiline' => true,
'indent' => '----',
'linebreak' => "^",
'entities' => XML_UTIL_ENTITIES_XML,
'sort' => true,
);
$expected = " boo=\"baz\"\n----foo=\"bar\"";
$this->assertEquals($expected, XML_Util::attributesToString($original, $options));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithOptionsThatExcludesSort()
{
$original = array('foo' => 'bar','boo' => 'baz',);
$options = array(
'multiline' => true,
'indent' => '----',
'linebreak' => "^",
'entities' => XML_UTIL_ENTITIES_XML,
);
$expected = " boo=\"baz\"\n----foo=\"bar\"";
$this->assertEquals($expected, XML_Util::attributesToString($original, $options));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithEntitiesNone()
{
$original = array("foo" => "b@&r", "boo" => "b>assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline, $linebreak, PHP_EOL, XML_UTIL_ENTITIES_NONE));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithEntitiesXml()
{
$original = array("foo" => "b@&r", "boo" => "b>assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline, $linebreak, PHP_EOL, XML_UTIL_ENTITIES_XML));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithEntitiesXmlRequired()
{
$original = array("foo" => "b@&r", "boo" => "b><z\" foo=\"b@&r\"";
$sort = true;
$multiline = false;
$linebreak = ' ';
$this->assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline, $linebreak, PHP_EOL, XML_UTIL_ENTITIES_XML_REQUIRED));
}
/**
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithEntitiesHtml()
{
$original = array("foo" => "b@&r", "boo" => "b>assertEquals($expected, XML_Util::attributesToString($original, $sort, $multiline, $linebreak, PHP_EOL, XML_UTIL_ENTITIES_HTML));
}
/**
* Tag attributes should not be treated as CDATA,
* so the operation will instead quietly use XML_UTIL_ENTITIES_XML.
*
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithCDataSectionForSingleAttribute()
{
$original = array('foo' => 'bar'); // need exactly one attribute here
$options = array(
'sort' => true, // doesn't matter for this testcase
'multiline' => false, // doesn't matter for this testcase
'indent' => null, // doesn't matter for this testcase
'linebreak' => null, // doesn't matter for this testcase
'entities' => XML_UTIL_CDATA_SECTION, // DOES matter for this testcase
);
$expected = " foo=\"bar\"";
$this->assertEquals($expected, XML_Util::attributesToString($original, $options));
}
/**
* Tag attributes should not be treated as CDATA,
* so the operation will instead quietly use XML_UTIL_ENTITIES_XML.
*
* @covers XML_Util::attributesToString()
*/
public function testAttributesToStringWithCDataSectionForMultipleAttributesAndMultilineFalse()
{
$original = array('foo' => 'bar', 'boo' => 'baz'); // need more than one attribute here
$options = array(
'sort' => true, // doesn't matter for this testcase
'multiline' => false, // DOES matter for this testcase, must be false
'indent' => null, // doesn't matter for this testcase
'linebreak' => null, // doesn't matter for this testcase
'entities' => XML_UTIL_CDATA_SECTION, // DOES matter for this testcase
);
$expected = " boo=\"baz\" foo=\"bar\"";
$this->assertEquals($expected, XML_Util::attributesToString($original, $options));
}
}
XML_Util/tests/IsValidNameTests.php 0000644 00000003677 14716355766 0013274 0 ustar 00 assertTrue($result);
}
/**
* @covers XML_Util::isValidName()
*/
public function testIsValidNameForTagNameWithInvalidCharacter()
{
$tagName = "invalidTag?";
$result = XML_Util::isValidName($tagName);
$this->assertInstanceOf('PEAR_Error', $result);
$expectedError = "XML names may only contain alphanumeric chars, period, hyphen, colon and underscores";
$this->assertEquals($expectedError, $result->getMessage());
}
/**
* @covers XML_Util::isValidName()
*/
public function testIsValidNameForTagNameWithInvalidStartingCharacter()
{
$tagName = "1234five";
$result = XML_Util::isValidName($tagName);
$this->assertInstanceOf('PEAR_Error', $result);
$expectedError = "XML names may only start with letter or underscore";
$this->assertEquals($expectedError, $result->getMessage());
}
/**
* @covers XML_Util::isValidName()
*/
public function testIsValidNameForInt()
{
$tagName = 1;
$result = XML_Util::isValidName($tagName);
$this->assertInstanceOf('PEAR_Error', $result);
$expectedError = "XML names may only start with letter or underscore";
$this->assertEquals($expectedError, $result->getMessage());
}
/**
* @covers XML_Util::isValidName()
*/
public function testIsValidNameForEmptyString()
{
$tagName = '';
$result = XML_Util::isValidName($tagName);
$this->assertInstanceOf('PEAR_Error', $result);
$expectedError = "XML names may only start with letter or underscore";
$this->assertEquals($expectedError, $result->getMessage());
}
}
Net_SMTP/tests/basic.phpt 0000644 00000001730 14716355766 0011302 0 ustar 00 --TEST--
Net_SMTP: Basic Functionality
--SKIPIF--
connect())) {
die($e->getMessage() . "\n");
}
if (PEAR::isError($e = $smtp->auth(TEST_AUTH_USER, TEST_AUTH_PASS))) {
die("Authentication failure\n");
}
if (PEAR::isError($smtp->mailFrom(TEST_FROM))) {
die('Unable to set sender to <' . TEST_FROM . ">\n");
}
if (PEAR::isError($res = $smtp->rcptTo(TEST_TO))) {
die('Unable to add recipient <' . TEST_TO . '>: ' .
$res->getMessage() . "\n");
}
$headers = 'Subject: ' . TEST_SUBJECT;
if (PEAR::isError($smtp->data(TEST_BODY, $headers))) {
die("Unable to send data\n");
}
$smtp->disconnect();
echo 'Success!';
--EXPECT--
Success!
Net_SMTP/tests/config.php.dist 0000644 00000000767 14716355766 0012255 0 ustar 00 connect())) {
die($e->getMessage() . "\n");
}
if (PEAR::isError($e = $smtp->auth(TEST_AUTH_USER, TEST_AUTH_PASS))) {
die("Authentication failure\n");
}
$smtp->disconnect();
echo 'Success!';
--EXPECT--
Success!
Net_SMTP/tests/quotedata.phpt 0000644 00000003733 14716355766 0012215 0 ustar 00 --TEST--
Net_SMTP: quotedata()
--FILE--
"\r\n",
"\r\n" => "\r\n",
"\nxx" => "\r\nxx",
"xx\n" => "xx\r\n",
"xx\nxx" => "xx\r\nxx",
"\n\nxx" => "\r\n\r\nxx",
"xx\n\nxx" => "xx\r\n\r\nxx",
"xx\n\n" => "xx\r\n\r\n",
"\r\nxx" => "\r\nxx",
"xx\r\n" => "xx\r\n",
"xx\r\nxx" => "xx\r\nxx",
"\r\n\r\nxx" => "\r\n\r\nxx",
"xx\r\n\r\nxx" => "xx\r\n\r\nxx",
"xx\r\n\r\n" => "xx\r\n\r\n",
"\r\n\nxx" => "\r\n\r\nxx",
"\n\r\nxx" => "\r\n\r\nxx",
"xx\r\n\nxx" => "xx\r\n\r\nxx",
"xx\n\r\nxx" => "xx\r\n\r\nxx",
"xx\r\n\n" => "xx\r\n\r\n",
"xx\n\r\n" => "xx\r\n\r\n",
"\r" => "\r\n",
"\rxx" => "\r\nxx",
"xx\rxx" => "xx\r\nxx",
"xx\r" => "xx\r\n",
"\r\r" => "\r\n\r\n",
"\r\rxx" => "\r\n\r\nxx",
"xx\r\rxx" => "xx\r\n\r\nxx",
"xx\r\r" => "xx\r\n\r\n",
"xx\rxx\nxx\r\nxx" => "xx\r\nxx\r\nxx\r\nxx",
"\r\r\n\n" => "\r\n\r\n\r\n",
/* Dots */
"." => "..",
"xxx\n." => "xxx\r\n..",
"xxx\n.\nxxx" => "xxx\r\n..\r\nxxx",
"xxx.\n.xxx" => "xxx.\r\n..xxx",
);
function literal($x)
{
return str_replace(array("\r", "\n"), array('\r', '\n'), $x);
}
$smtp = new Net_SMTP();
$error = false;
foreach ($tests as $input => $expected) {
$output = $input;
$smtp->quotedata($output);
if ($output != $expected) {
printf("Error: '%s' => '%s' (expected: '%s')",
literal($input), literal($output), literal($expected));
$error = true;
}
}
if (!$error) {
echo "success\n";
}
--EXPECT--
success
Net_DIME/test/dime_record_test.php 0000644 00000003604 14716355766 0013122 0 ustar 00
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
';
$dime = new Net_DIME_Record();
$dime->generateID();
$dime->setType('text/plain');
$dime->setData($test);
print_r($dime->Elements);
$enc = $dime->encode();
echo bin2hex(substr($enc, 0, 8)) . "\n";
echo chunk_split(bin2hex(substr($enc, 8)), 72) . "\n";
$dime->decode($enc);
print_r($dime->Elements);
Net_DIME/test/dime_message_test.php 0000644 00000061527 14716355766 0013300 0 ustar 00
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e----=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Type: text/xml; charset="UTF-8"
--=_a2cbb051424cc43e72d3c8c8d0b8f70e
Content-Disposition: attachment.php
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-ID:
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2UoIlNP
QVAvdGVzdC90ZXN0LnV0aWxpdHkucGhwIik7DQpyZXF1aXJlX29uY2UoIlNPQVAvVmFsdWUucGhw
Iik7DQokc29hcF9iYXNlID0gbmV3IFNPQVBfQmFzZSgpOw0KDQokdiA9ICBuZXcgU09BUF9BdHRh
Y2htZW50KCd0ZXN0JywndGV4dC9wbGFpbicsJ2F0dGFjaG1lbnQucGhwJyk7DQokbWV0aG9kVmFs
dWUgPSBuZXcgU09BUF9WYWx1ZSgndGVzdGF0dGFjaCcsICdTdHJ1Y3QnLCBhcnJheSgkdikpOw0K
DQovLyBzZWUgdGhlIG1pbWUgYXJyYXkNCi8vJHZhbCA9ICRzb2FwX2Jhc2UtPl9tYWtlRW52ZWxv
cGUoJG1ldGhvZFZhbHVlKTsNCi8vcHJpbnRfcigkdmFsKTsNCg0KJGNsaWVudCA9IG5ldyBTT0FQ
X0NsaWVudCgnaHR0cDovL2xvY2FsaG9zdC9zb2FwX2ludGVyb3Avc2VydmVyX3JvdW5kMi5waHAn
KTsNCiRyZXNwID0gJGNsaWVudC0+Y2FsbCgnZWNob01pbWVBdHRhY2htZW50JyxhcnJheSgkdikp
Ow0KI3ByaW50X3IoJHJlc3ApOw0KcHJpbnQgJGNsaWVudC0+d2lyZTsNCj8+
--=_a2cbb051424cc43e72d3c8c8d0b8f70e--
';
$f = fopen('/tmp/dime.data', 'wb+');
$dime = new Net_DIME_Message($f);
$dime->sendData($test);
$dime->sendEndMessage();
$size = ftell($f);
print "filesize: $size, datasize: " . strlen($test) . "\n";
rewind($f);
$dime = new Net_DIME_Message($f);
$err = $dime->read();
if (PEAR::isError($err)) {
echo $err->getMessage() . "\n";
} else {
if (strcmp($dime->parts[0]['data'], $test) == 0) {
echo "encode/decode success\n";
} else {
echo "encode/decode failure\n";
}
}
Mail/tests/bug17317.phpt 0000644 00000000670 14716355766 0010674 0 ustar 00 --TEST--
Mail_RFC822::parseAddressList invalid periods in mail address
--FILE--
'John Doe', 'email' => 'test@example.com'),
array('name' => 'John Doe\\', 'email' => 'test@example.com'),
array('name' => 'John "Doe', 'email' => 'test@example.com'),
array('name' => 'John "Doe\\', 'email' => 'test@example.com'),
);
for ($i = 0; $i < count($addresses); $i++) {
// construct the address
$address = "\"" . addslashes($addresses[$i]['name']) . "\" ".
"<".$addresses[$i]['email'].">";
$parsedAddresses = Mail_RFC822::parseAddressList($address);
if (is_a($parsedAddresses, 'PEAR_Error')) {
echo $address." :: Failed to validate\n";
} else {
echo $address." :: Parsed\n";
}
}
--EXPECT--
"John Doe" :: Parsed
"John Doe\\" :: Parsed
"John \"Doe" :: Parsed
"John \"Doe\\" :: Parsed
Mail/tests/9137_2.phpt 0000644 00000002355 14716355766 0010342 0 ustar 00 --TEST--
Mail: Test for bug #9137, take 2
--FILE--
'"John Doe" '),
array('raw' => '"John Doe' . chr(92) . '" '),
array('raw' => '"John Doe' . chr(92) . chr(92) . '" '),
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . '" '),
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . chr(92) . '" '),
array('raw' => '"John Doe '),
);
for ($i = 0; $i < count($addresses); $i++) {
// construct the address
$address = $addresses[$i]['raw'];
$parsedAddresses = Mail_RFC822::parseAddressList($address);
if (PEAR::isError($parsedAddresses)) {
echo $address." :: Failed to validate\n";
} else {
echo $address." :: Parsed\n";
}
}
--EXPECT--
"John Doe" :: Parsed
"John Doe\" :: Failed to validate
"John Doe\\" :: Parsed
"John Doe\\\" :: Failed to validate
"John Doe\\\\" :: Parsed
"John Doe :: Failed to validate
Mail/tests/bug17178.phpt 0000644 00000000357 14716355766 0010703 0 ustar 00 --TEST--
Mail_RFC822::parseAddressList does not accept RFC-valid group syntax
--FILE--
packageExists('Net_SMTP')) die("skip\n");
--FILE--
'bogus.host.tld');
/* Create our SMTP-based mailer object. */
$mailer = Mail::factory('smtp', $params);
/* Attempt to send an empty message in order to trigger an error. */
$e = $mailer->send(array(), array(), '');
if (is_a($e, 'PEAR_Error')) {
$err = $e->getMessage();
if (preg_match('/Failed to connect to bogus.host.tld:25 \[SMTP: Failed to connect socket:.*/i', $err)) {
echo "OK";
}
}
--EXPECT--
OK Mail/tests/validateQuotedString.phpt 0000644 00000001230 14716355766 0013647 0 ustar 00 --TEST--
Mail_RFC822::parseAddressList simple tests
--FILE--
, postmaster@example.com, root';
$address_array = Mail_RFC822::parseAddressList($address_string, "example.com");
foreach ($address_array as $val) {
echo "mailbox : " . $val->mailbox . "\n";
echo "host : " . $val->host . "\n";
echo "personal: " . $val->personal . "\n";
}
--EXPECT--
mailbox : doe
host : example.com
personal: "Joe Doe \(from Somewhere\)"
mailbox : postmaster
host : example.com
personal:
mailbox : root
host : example.com
personal:
Mail/tests/13659.phpt 0000644 00000001242 14716355766 0010177 0 ustar 00 --TEST--
Mail: Test for bug #13659
--FILE--
(test)';
$parser = new Mail_RFC822();
$result = $parser->parseAddressList($address, 'anydomain.com', TRUE);
if (!PEAR::isError($result) && is_array($result) && is_object($result[0]))
if ($result[0]->personal == '"Test Student"' &&
$result[0]->mailbox == "test" &&
$result[0]->host == "mydomain.com" &&
is_array($result[0]->comment) && $result[0]->comment[0] == 'test')
{
print("OK");
}
?>
--EXPECT--
OK
Mail/tests/rfc822.phpt 0000644 00000005614 14716355766 0010525 0 ustar 00 --TEST--
Mail_RFC822: Address Parsing
--FILE--
parseAddressList($address, null, true, true));
/* Address groups. */
$address = 'My Group: "Richard" (A comment), ted@example.com (Ted Bloggs), Barney;';
print_r($parser->parseAddressList($address, null, true, true));
/* A valid address with spaces in the local part. */
$address = '<"Jon Parise"@php.net>';
print_r($parser->parseAddressList($address, null, true, true));
/* An invalid address with spaces in the local part. */
$address = '';
$result = $parser->parseAddressList($address, null, true, true);
if (is_a($result, 'PEAR_Error')) echo $result->getMessage() . "\n";
/* A valid address with an uncommon TLD. */
$address = 'jon@host.longtld';
$result = $parser->parseAddressList($address, null, true, true);
if (is_a($result, 'PEAR_Error')) echo $result->getMessage() . "\n";
--EXPECT--
Array
(
[0] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => user
[host] => example.com
)
)
Array
(
[0] => stdClass Object
(
[groupname] => My Group
[addresses] => Array
(
[0] => stdClass Object
(
[personal] => "Richard"
[comment] => Array
(
[0] => A comment
)
[mailbox] => richard
[host] => localhost
)
[1] => stdClass Object
(
[personal] =>
[comment] => Array
(
[0] => Ted Bloggs
)
[mailbox] => ted
[host] => example.com
)
[2] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => Barney
[host] => localhost
)
)
)
)
Array
(
[0] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => "Jon Parise"
[host] => php.net
)
)
Validation failed for:
bug17317.phpt 0000644 00000000670 14716372706 0006641 0 ustar 00 --TEST--
Mail_RFC822::parseAddressList invalid periods in mail address
--FILE--
'John Doe', 'email' => 'test@example.com'),
array('name' => 'John Doe\\', 'email' => 'test@example.com'),
array('name' => 'John "Doe', 'email' => 'test@example.com'),
array('name' => 'John "Doe\\', 'email' => 'test@example.com'),
);
for ($i = 0; $i < count($addresses); $i++) {
// construct the address
$address = "\"" . addslashes($addresses[$i]['name']) . "\" ".
"<".$addresses[$i]['email'].">";
$parsedAddresses = Mail_RFC822::parseAddressList($address);
if (is_a($parsedAddresses, 'PEAR_Error')) {
echo $address." :: Failed to validate\n";
} else {
echo $address." :: Parsed\n";
}
}
--EXPECT--
"John Doe" :: Parsed
"John Doe\\" :: Parsed
"John \"Doe" :: Parsed
"John \"Doe\\" :: Parsed
9137_2.phpt 0000644 00000002355 14716372706 0006307 0 ustar 00 --TEST--
Mail: Test for bug #9137, take 2
--FILE--
'"John Doe" '),
array('raw' => '"John Doe' . chr(92) . '" '),
array('raw' => '"John Doe' . chr(92) . chr(92) . '" '),
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . '" '),
array('raw' => '"John Doe' . chr(92) . chr(92) . chr(92) . chr(92) . '" '),
array('raw' => '"John Doe '),
);
for ($i = 0; $i < count($addresses); $i++) {
// construct the address
$address = $addresses[$i]['raw'];
$parsedAddresses = Mail_RFC822::parseAddressList($address);
if (PEAR::isError($parsedAddresses)) {
echo $address." :: Failed to validate\n";
} else {
echo $address." :: Parsed\n";
}
}
--EXPECT--
"John Doe" :: Parsed
"John Doe\" :: Failed to validate
"John Doe\\" :: Parsed
"John Doe\\\" :: Failed to validate
"John Doe\\\\" :: Parsed
"John Doe :: Failed to validate
bug17178.phpt 0000644 00000000357 14716372706 0006650 0 ustar 00 --TEST--
Mail_RFC822::parseAddressList does not accept RFC-valid group syntax
--FILE--
packageExists('Net_SMTP')) die("skip\n");
--FILE--
'bogus.host.tld');
/* Create our SMTP-based mailer object. */
$mailer = Mail::factory('smtp', $params);
/* Attempt to send an empty message in order to trigger an error. */
$e = $mailer->send(array(), array(), '');
if (is_a($e, 'PEAR_Error')) {
$err = $e->getMessage();
if (preg_match('/Failed to connect to bogus.host.tld:25 \[SMTP: Failed to connect socket:.*/i', $err)) {
echo "OK";
}
}
--EXPECT--
OK validateQuotedString.phpt 0000644 00000001230 14716372706 0011614 0 ustar 00 --TEST--
Mail_RFC822::parseAddressList simple tests
--FILE--
, postmaster@example.com, root';
$address_array = Mail_RFC822::parseAddressList($address_string, "example.com");
foreach ($address_array as $val) {
echo "mailbox : " . $val->mailbox . "\n";
echo "host : " . $val->host . "\n";
echo "personal: " . $val->personal . "\n";
}
--EXPECT--
mailbox : doe
host : example.com
personal: "Joe Doe \(from Somewhere\)"
mailbox : postmaster
host : example.com
personal:
mailbox : root
host : example.com
personal:
13659.phpt 0000644 00000001242 14716372706 0006144 0 ustar 00 --TEST--
Mail: Test for bug #13659
--FILE--
(test)';
$parser = new Mail_RFC822();
$result = $parser->parseAddressList($address, 'anydomain.com', TRUE);
if (!PEAR::isError($result) && is_array($result) && is_object($result[0]))
if ($result[0]->personal == '"Test Student"' &&
$result[0]->mailbox == "test" &&
$result[0]->host == "mydomain.com" &&
is_array($result[0]->comment) && $result[0]->comment[0] == 'test')
{
print("OK");
}
?>
--EXPECT--
OK
rfc822.phpt 0000644 00000005614 14716372706 0006472 0 ustar 00 --TEST--
Mail_RFC822: Address Parsing
--FILE--
parseAddressList($address, null, true, true));
/* Address groups. */
$address = 'My Group: "Richard" (A comment), ted@example.com (Ted Bloggs), Barney;';
print_r($parser->parseAddressList($address, null, true, true));
/* A valid address with spaces in the local part. */
$address = '<"Jon Parise"@php.net>';
print_r($parser->parseAddressList($address, null, true, true));
/* An invalid address with spaces in the local part. */
$address = '';
$result = $parser->parseAddressList($address, null, true, true);
if (is_a($result, 'PEAR_Error')) echo $result->getMessage() . "\n";
/* A valid address with an uncommon TLD. */
$address = 'jon@host.longtld';
$result = $parser->parseAddressList($address, null, true, true);
if (is_a($result, 'PEAR_Error')) echo $result->getMessage() . "\n";
--EXPECT--
Array
(
[0] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => user
[host] => example.com
)
)
Array
(
[0] => stdClass Object
(
[groupname] => My Group
[addresses] => Array
(
[0] => stdClass Object
(
[personal] => "Richard"
[comment] => Array
(
[0] => A comment
)
[mailbox] => richard
[host] => localhost
)
[1] => stdClass Object
(
[personal] =>
[comment] => Array
(
[0] => Ted Bloggs
)
[mailbox] => ted
[host] => example.com
)
[2] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => Barney
[host] => localhost
)
)
)
)
Array
(
[0] => stdClass Object
(
[personal] =>
[comment] => Array
(
)
[mailbox] => "Jon Parise"
[host] => php.net
)
)
Validation failed for: