Commit: 371372714dcac655f53a53ef4d45ad02916b4f4a Author: Martin Jansen <mar...@divbyzero.net> Sun, 6 Jan 2013 08:59:10 +0100 Committer: Lars Strojny <lstro...@php.net> Sun, 6 Jan 2013 15:04:27 +0100 Parents: 4a3bf25e3ffa71d8d65df686c27903d7c9fafee6 Branches: PHP-5.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=371372714dcac655f53a53ef4d45ad02916b4f4a Log: Add unit test for mail.log ini setting. Changed paths: A ext/standard/tests/mail/mail_log.phpt Diff: diff --git a/ext/standard/tests/mail/mail_log.phpt b/ext/standard/tests/mail/mail_log.phpt new file mode 100644 index 0000000..86346ec --- /dev/null +++ b/ext/standard/tests/mail/mail_log.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test mail() function : mail.log ini setting +--INI-- +sendmail_path=tee /tmp/mail.out >/dev/null +mail.log = /tmp/mail.log +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) == "WIN") + die("skip Won't run on Windows"); +?> +--FILE-- +<?php +date_default_timezone_set("UTC"); + +$logfile = ini_get("mail.log"); +if (file_exists($logfile)) { + unlink($logfile); +} +touch($logfile); +clearstatcache(); + +$to = "t...@example.com"; +$subject = "mail.log test"; +$message = "Testing mail.log"; +$headers = "X-Test: 1"; + +var_dump(filesize($logfile) == 0); +clearstatcache(); + +var_dump(mail($to, $subject, $message, $headers)); + +var_dump(filesize($logfile) > 0); +clearstatcache(); + +echo file_get_contents($logfile); +?> +Done +--CLEAN-- +<?php +unlink("/tmp/mail.log"); +unlink("/tmp/mail.out"); +?> +--EXPECTF-- +bool(true) +bool(true) +bool(true) +[%d-%s-%d %d:%d:%d UTC] mail() on [%smail_log.php:%d]: To: t...@example.com -- Headers: X-Test: 1 +Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php