芝麻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
PK HqYi; $ Mail_Mime/tests/test_Bug_7561_1.phptnu [ --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
PK HqYQi"- - # Mail_Mime/tests/test_Bug_11381.phptnu [ --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
PK HqY'' ' $ Mail_Mime/tests/test_Bug_8386_1.phptnu [ --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
PK HqYe;I # Mail_Mime/tests/test_Bug_21205.phptnu [ --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=?=
PK HqYM-\ # Mail_Mime/tests/test_Bug_17175.phptnu [ --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?=
PK HqY[b . Mail_Mime/tests/content_transfer_encoding.phptnu [ --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"
PK HqYّ B
% Mail_Mime/tests/qp_encoding_test.phptnu [ --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
PK HqYRoU U # Mail_Mime/tests/test_Bug_20226.phptnu [ --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=?=
PK HqYYcLY Y # Mail_Mime/tests/test_Bug_16539.phptnu [ --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
PK HqYo # Mail_Mime/tests/test_Bug_14529.phptnu [ --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;
PK HqY9: : % Mail_Mime/tests/test_Bug_10816_1.phptnu [ --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
PK HqYܶgh h $ Mail_Mime/tests/test_Bug_9722_1.phptnu [ --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
PK HqYYak! ! 3 Mail_Mime/tests/sleep_wakeup_EOL-bug3488-part1.phptnu [ --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
PK HqYzŬ # Mail_Mime/tests/test_Bug_11731.phptnu [ --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
PK HqYY " Mail_Mime/tests/test_Bug_GH26.phptnu [ --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.comPK HqY%B B " Mail_Mime/tests/test_Bug_GH16.phptnu [ --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
PK HqY-b2 # Mail_Mime/tests/test_Bug_13032.phptnu [ --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
PK HqY-7c7 7 $ Mail_Mime/tests/test_Bug_3513_2.phptnu [ --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;
PK HqY;{ " Mail_Mime/tests/test_Bug_GH19.phptnu [ --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
PK HqY( ( % Mail_Mime/tests/test_Bug_10596_1.phptnu [ --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
PK HqYa[ # Mail_Mime/tests/class-filename.phptnu [ --TEST--
Test class filename (bug #24)
--SKIPIF--
--FILE--
--EXPECT--
Include OK
PK HqY29r " Mail_Mime/tests/encoding_case.phptnu [ --TEST--
Bug #2364 Tabs in Mail_mimePart::quotedPrintableEncode()
--SKIPIF--
--FILE--
--EXPECT--
Here's=
=09
a tab
PK HqYCz2} } # Mail_Mime/tests/test_Bug_12165.phptnu [ --TEST--
Bug #12165 Dot at the end of the line disappeared
--SKIPIF--
--FILE--
setHTMLBody($string);
print_r($mime->get());
--EXPECT--
http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
=2Ecom
PK HqYB& # Mail_Mime/tests/test_Bug_12466.phptnu [ --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
PK HqY)#p p # Mail_Mime/tests/test_Bug_18772.phptnu [ --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
--*--
PK HqY%+2P P # Mail_Mime/tests/test_Bug_18083.phptnu [ --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==?=";
PK HqYv $ Mail_Mime/tests/test_Bug_8541_1.phptnu [ --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?=
PK HqYk0 # Mail_Mime/tests/test_Bug_20564.phptnu [ --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--
0PK HqY5 # Mail_Mime/tests/test_Bug_21098.phptnu [ --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
PK HqY8 $ Mail_Mime/tests/test_Bug_3513_1.phptnu [ --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;
PK HqYX# # # Mail_Mime/tests/test_Bug_19497.phptnu [ --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";
PK HqY@/N N # Mail_Mime/tests/test_Bug_21206.phptnu [ --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
PK HqYg+ # Mail_Mime/tests/test_Bug_13444.phptnu [ --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
PK HqY|J J 3 Mail_Mime/tests/sleep_wakeup_EOL-bug3488-part2.phptnu [ --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
PK HqYMU. . # Mail_Mime/tests/test_Bug_20273.phptnu [ --TEST--
Bug #20273 Mail_mimePart::encodeHeader() and TAB character
--SKIPIF--
--FILE--
\t";
$mime = new Mail_mimePart();
echo $mime->encodeHeader('References', $refs);
?>
--EXPECT--
PK HqY2!B ' Mail_Mime/tests/test_linebreak_dot.phptnu [ --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
---
PK HqYXb # Mail_Mime/tests/test_Bug_14779.phptnu [ --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
PK HqY`~@ % Mail_Mime/tests/test_Bug_12385_1.phptnu [ --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
PK HqY
Ǟ - Mail_Mime/tests/test_linebreak_larger_76.phptnu [ --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
---
PK HqYԢ` ` # Mail_Mime/tests/test_Bug_21255.phptnu [ --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
PK HqYUiE! E! - Mail_Mime/tests/headers_without_mbstring.phptnu [ --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?=
PK HqY(V, # Mail_Mime/tests/test_Bug_12411.phptnu [ --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==?=";
PK HqY1d # Mail_Mime/tests/test_Bug_17025.phptnu [ --TEST--
Bug #16539 Headers longer than 998 characters
--SKIPIF--
--FILE--
headers($headers);
print_r($hdrs['From']);
?>
--EXPECT--
aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhh
PK HqYe@Q_ _ # Mail_Mime/tests/test_Bug_14780.phptnu [ --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
PK HqYZXHw w $ Mail_Mime/tests/test_Bug_3513_3.phptnu [ --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;
PK HqYV # Structures_Graph/tests/AllTests.phpnu [ addTestFiles($dir);
return $suite;
}
}
PK HqY * Structures_Graph/tests/AcyclicTestTest.phpnu [ 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'
);
}
}
?>
PK HqY6:U U 0 Structures_Graph/tests/TopologicalSorterTest.phpnu [ 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());
}
}
?>
PK HqYfw(^ ^ ! Structures_Graph/tests/helper.incnu [ |
// +-----------------------------------------------------------------------------+
//
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');
}
}
?>
PK HqYیu " XML_Util/tests/ApiVersionTests.phpnu [ assertEquals('1.4', XML_Util::apiVersion());
}
}PK HqY~$[e e ( XML_Util/tests/CreateEndElementTests.phpnu [ ";
$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));
}
}
PK HqYDf: ) XML_Util/tests/GetXmlDeclarationTests.phpnu [ ";
$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));
}
}
PK HqYT T % XML_Util/tests/CreateCommentTests.phpnu [ ";
$this->assertEquals($expected, XML_Util::createComment($original));
}
}
PK HqYG XML_Util/tests/Bug21177Tests.phpnu [ ';
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.");
}
}
PK HqYYq XML_Util/tests/Bug21184Tests.phpnu [ one';
$this->assertEquals($xml, XML_Util::collapseEmptyTags($xml, XML_UTIL_COLLAPSE_ALL));
}
}
PK HqY|\5 ) XML_Util/tests/CollapseEmptyTagsTests.phpnu [ ";
$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));
}
}
PK HqYG G * XML_Util/tests/SplitQualifiedNameTests.phpnu [ '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));
}
}
PK HqYzt ' XML_Util/tests/ReverseEntitiesTests.phpnu [ .";
$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));
}
}
PK HqYܬ$ - XML_Util/tests/GetDocTypeDeclarationTests.phpnu [ ";
$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));
}
}
PK HqY۩ XML_Util/tests/Bug18343Tests.phpnu [ "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.");
}
}
PK HqY>M XML_Util/tests/Bug4950Tests.phpnu [ here!";
$namespaceUrl = null;
$expected = " here!]]>";
$result = XML_Util::createTag($qname, $attributes, $content, $namespaceUrl, XML_UTIL_CDATA_SECTION);
$this->assertEquals($expected, $result, "Failed bugcheck.");
}
}
PK HqYrv " XML_Util/tests/RaiseErrorTests.phpnu [ assertInstanceOf('PEAR_Error', $error);
$this->assertEquals($message, $error->getMessage());
$this->assertEquals($code, $error->getCode());
}
}
PK HqYC ' XML_Util/tests/ReplaceEntitiesTests.phpnu [ .';
}
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));
}
}
PK HqY4ej j * XML_Util/tests/CreateCDataSectionTests.phpnu [ ";
$this->assertEquals($expected, XML_Util::createCDataSection($original));
}
}
PK HqYe>4 4 * XML_Util/tests/CreateTagFromArrayTests.phpnu [ "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));
}
}
PK HqYYR" " * XML_Util/tests/CreateStartElementTests.phpnu [ ";
$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));
}
}
PK HqY! $ XML_Util/tests/AbstractUnitTests.phpnu [ "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));
}
}
PK HqYGs XML_Util/tests/Bug5392Tests.phpnu [ , & 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.");
}
}
PK HqYZt * XML_Util/tests/AttributesToStringTests.phpnu [ '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));
}
}
PK HqYݑh # XML_Util/tests/IsValidNameTests.phpnu [ 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());
}
}
PK HqYt隄 Net_SMTP/tests/basic.phptnu [ --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!
PK HqY_xT Net_SMTP/tests/config.php.distnu [ 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!
PK HqY$Lp Net_SMTP/tests/quotedata.phptnu [ --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
PK HqY " Net_DIME/test/dime_record_test.phpnu [
--=_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);
PK HqY$6Wc Wc # Net_DIME/test/dime_message_test.phpnu [
--=_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";
}
}
PK HqY Mail/tests/bug17317.phptnu [ --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
PK HqYrF* Mail/tests/9137_2.phptnu [ --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
PK HqY4P7 Mail/tests/bug17178.phptnu [ --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--
OKPK HqYD $ Mail/tests/validateQuotedString.phptnu [ --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:
PK HqYl;^| Mail/tests/13659.phptnu [ --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
PK HqYE Mail/tests/rfc822.phptnu [ --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:
PK VqY
bug17317.phptnu [ --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
PK VqYrF* 9137_2.phptnu [ --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
PK VqY4P7
bug17178.phptnu [ --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--
OKPK VqYD validateQuotedString.phptnu [ --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:
PK VqYl;^|
13659.phptnu [ --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
PK VqYE rfc822.phptnu [ --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:
PK HqY|E E " Console_Getopt/tests/bug13140.phptnu [ PK HqY " Console_Getopt/tests/bug10557.phptnu [ PK HqY " Console_Getopt/tests/bug11068.phptnu [ PK HqY $ B Console_Getopt/tests/001-getopt.phptnu [ PK HqY # d Mail_Mime/tests/test_Bug_15320.phptnu [ PK HqY # Mail_Mime/tests/test_Bug_21027.phptnu [ PK HqYi; $ W/ Mail_Mime/tests/test_Bug_7561_1.phptnu [ PK HqYqS % 02 Mail_Mime/tests/test_Bug_10999_1.phptnu [ PK HqYQi"- - # p4 Mail_Mime/tests/test_Bug_11381.phptnu [ PK HqY'' ' $ 6 Mail_Mime/tests/test_Bug_8386_1.phptnu [ PK HqYe;I # k9 Mail_Mime/tests/test_Bug_21205.phptnu [ PK HqYM-\ # > Mail_Mime/tests/test_Bug_17175.phptnu [ PK HqY[b . A Mail_Mime/tests/content_transfer_encoding.phptnu [ PK HqYّ B
% E Mail_Mime/tests/qp_encoding_test.phptnu [ PK HqYEo o # T Mail_Mime/tests/test_Bug_13962.phptnu [ PK HqYRoU U # U Mail_Mime/tests/test_Bug_20226.phptnu [ PK HqYYcLY Y # W Mail_Mime/tests/test_Bug_16539.phptnu [ PK HqYo # 0u Mail_Mime/tests/test_Bug_14529.phptnu [ PK HqY9: : % w Mail_Mime/tests/test_Bug_10816_1.phptnu [ PK HqYܶgh h $ z Mail_Mime/tests/test_Bug_9722_1.phptnu [ PK HqYIz z # { Mail_Mime/tests/test_Bug_20563.phptnu [ PK HqYYak! ! 3 } Mail_Mime/tests/sleep_wakeup_EOL-bug3488-part1.phptnu [ PK HqYzŬ # ( Mail_Mime/tests/test_Bug_11731.phptnu [ PK HqYY " ' Mail_Mime/tests/test_Bug_GH26.phptnu [ PK HqY%B B " l Mail_Mime/tests/test_Bug_GH16.phptnu [ PK HqY-b2 # Mail_Mime/tests/test_Bug_13032.phptnu [ PK HqY-7c7 7 $ n Mail_Mime/tests/test_Bug_3513_2.phptnu [ PK HqY;{ " Mail_Mime/tests/test_Bug_GH19.phptnu [ PK HqY( ( % 0 Mail_Mime/tests/test_Bug_10596_1.phptnu [ PK HqYa[ # Mail_Mime/tests/class-filename.phptnu [ PK HqY29r " Mail_Mime/tests/encoding_case.phptnu [ PK HqYCz2} } # 8 Mail_Mime/tests/test_Bug_12165.phptnu [ PK HqYB& # Mail_Mime/tests/test_Bug_12466.phptnu [ PK HqY)#p p # Mail_Mime/tests/test_Bug_18772.phptnu [ PK HqY%+2P P # ۡ Mail_Mime/tests/test_Bug_18083.phptnu [ PK HqYv $ ~ Mail_Mime/tests/test_Bug_8541_1.phptnu [ PK HqY᠗" " * Ŧ Mail_Mime/tests/headers_with_mbstring.phptnu [ PK HqYk0 # Mail_Mime/tests/test_Bug_20564.phptnu [ PK HqY5 # Mail_Mime/tests/test_Bug_21098.phptnu [ PK HqY8 $ Mail_Mime/tests/test_Bug_3513_1.phptnu [ PK HqYX# # # Mail_Mime/tests/test_Bug_19497.phptnu [ PK HqY@/N N # Mail_Mime/tests/test_Bug_21206.phptnu [ PK HqYg+ # 6 Mail_Mime/tests/test_Bug_13444.phptnu [ PK HqY|J J 3 ' Mail_Mime/tests/sleep_wakeup_EOL-bug3488-part2.phptnu [ PK HqYMU. . # Mail_Mime/tests/test_Bug_20273.phptnu [ PK HqY2!B ' U Mail_Mime/tests/test_linebreak_dot.phptnu [ PK HqYXb # D Mail_Mime/tests/test_Bug_14779.phptnu [ PK HqY`~@ % Mail_Mime/tests/test_Bug_12385_1.phptnu [ PK HqY
Ǟ - Mail_Mime/tests/test_linebreak_larger_76.phptnu [ PK HqYԢ` ` # P Mail_Mime/tests/test_Bug_21255.phptnu [ PK HqYUiE! E! - Mail_Mime/tests/headers_without_mbstring.phptnu [ PK HqY(V, # Mail_Mime/tests/test_Bug_12411.phptnu [ PK HqY1d # Mail_Mime/tests/test_Bug_17025.phptnu [ PK HqYe@Q_ _ # p Mail_Mime/tests/test_Bug_14780.phptnu [ PK HqYZXHw w $ " Mail_Mime/tests/test_Bug_3513_3.phptnu [ PK HqYV # Structures_Graph/tests/AllTests.phpnu [ PK HqY * Structures_Graph/tests/AcyclicTestTest.phpnu [ PK HqY6:U U 0 r$ Structures_Graph/tests/TopologicalSorterTest.phpnu [ PK HqYfw(^ ^ ! ', Structures_Graph/tests/helper.incnu [ PK HqYW8j# j# ) - Structures_Graph/tests/BasicGraphTest.phpnu [ PK HqYیu " Q XML_Util/tests/ApiVersionTests.phpnu [ PK HqY~$[e e ( R XML_Util/tests/CreateEndElementTests.phpnu [ PK HqYDf: ) U XML_Util/tests/GetXmlDeclarationTests.phpnu [ PK HqYT T % jZ XML_Util/tests/CreateCommentTests.phpnu [ PK HqYG \ XML_Util/tests/Bug21177Tests.phpnu [ PK HqYYq ` XML_Util/tests/Bug21184Tests.phpnu [ PK HqY|\5 ) b XML_Util/tests/CollapseEmptyTagsTests.phpnu [ PK HqYG G * s XML_Util/tests/SplitQualifiedNameTests.phpnu [ PK HqYzt ' w XML_Util/tests/ReverseEntitiesTests.phpnu [ PK HqYܬ$ - XML_Util/tests/GetDocTypeDeclarationTests.phpnu [ PK HqY۩ XML_Util/tests/Bug18343Tests.phpnu [ PK HqY>M ) XML_Util/tests/Bug4950Tests.phpnu [ PK HqYrv " Q XML_Util/tests/RaiseErrorTests.phpnu [ PK HqYC ' c XML_Util/tests/ReplaceEntitiesTests.phpnu [ PK HqY4ej j * XML_Util/tests/CreateCDataSectionTests.phpnu [ PK HqYe>4 4 * _ XML_Util/tests/CreateTagFromArrayTests.phpnu [ PK HqYYR" " * m XML_Util/tests/CreateStartElementTests.phpnu [ PK HqY! $ XML_Util/tests/AbstractUnitTests.phpnu [ PK HqYm4* * ! XML_Util/tests/CreateTagTests.phpnu [ PK HqYGs ` XML_Util/tests/Bug5392Tests.phpnu [ PK HqYZt * XML_Util/tests/AttributesToStringTests.phpnu [ PK HqYݑh # = XML_Util/tests/IsValidNameTests.phpnu [ PK HqYt隄 0E Net_SMTP/tests/basic.phptnu [ PK HqY_xT QI Net_SMTP/tests/config.php.distnu [ PK HqY=m= = K Net_SMTP/tests/auth.phptnu [ PK HqY$Lp N Net_SMTP/tests/quotedata.phptnu [ PK HqY " CV Net_DIME/test/dime_record_test.phpnu [ PK HqY$6Wc Wc # ^ Net_DIME/test/dime_message_test.phpnu [ PK HqY Mail/tests/bug17317.phptnu [ PK HqY*zg
Mail/tests/9137.phptnu [ PK HqYrF* Mail/tests/9137_2.phptnu [ PK HqY4P7 D Mail/tests/bug17178.phptnu [ PK HqYV { Mail/tests/smtp_error.phptnu [ PK HqYD $ Mail/tests/validateQuotedString.phptnu [ PK HqYl;^| Mail/tests/13659.phptnu [ PK HqYE Mail/tests/rfc822.phptnu [ PK VqY
z bug17317.phptnu [ PK VqY*zg
o 9137.phptnu [ PK VqYrF* 9137_2.phptnu [ PK VqY4P7
bug17178.phptnu [ PK VqYV smtp_error.phptnu [ PK VqYD U validateQuotedString.phptnu [ PK VqYl;^|
6 13659.phptnu [ PK VqYE rfc822.phptnu [ PK h h '