]> granicus.if.org Git - php/commitdiff
MFH: New tests for syslog
authorKalle Sommer Nielsen <kalle@php.net>
Wed, 5 Nov 2008 09:58:51 +0000 (09:58 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Wed, 5 Nov 2008 09:58:51 +0000 (09:58 +0000)
ext/standard/tests/misc/syslog_basic.phpt [new file with mode: 0644]
ext/standard/tests/misc/syslog_parameters.phpt [new file with mode: 0644]
ext/standard/tests/misc/syslog_vars_variation1.phpt [new file with mode: 0644]
ext/standard/tests/misc/syslog_vars_variation2.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/misc/syslog_basic.phpt b/ext/standard/tests/misc/syslog_basic.phpt
new file mode 100644 (file)
index 0000000..6c627e9
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Basic syslog test
+--FILE--
+<?php
+openlog('phpt', LOG_NDELAY | LOG_PID, LOG_USER);
+
+syslog(LOG_WARNING, 'Basic syslog test');
+
+closelog();
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/standard/tests/misc/syslog_parameters.phpt b/ext/standard/tests/misc/syslog_parameters.phpt
new file mode 100644 (file)
index 0000000..fdb31ae
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Syslog parameter parsing test
+--FILE--
+<?php
+openlog();
+openlog(NULL, 'string', 0);
+
+syslog();
+syslog('Wrong parameter order', LOG_WARNING);
+
+closelog('Doesnt take any parameters');
+?>
+--EXPECTF--
+Warning: openlog() expects exactly 3 parameters, 0 given in %s on line %d
+
+Warning: openlog() expects parameter 2 to be long, string given in %s on line %d
+
+Warning: syslog() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: syslog() expects parameter 1 to be long, string given in %s on line %d
+
+Warning: closelog() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/standard/tests/misc/syslog_vars_variation1.phpt b/ext/standard/tests/misc/syslog_vars_variation1.phpt
new file mode 100644 (file)
index 0000000..7cac8ad
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+define_syslog_variables() variation 1
+--INI--
+define_syslog_variables=On
+--FILE--
+<?php
+var_dump(isset($LOG_ERR));
+?>
+--EXPECTF--
+bool(true)
diff --git a/ext/standard/tests/misc/syslog_vars_variation2.phpt b/ext/standard/tests/misc/syslog_vars_variation2.phpt
new file mode 100644 (file)
index 0000000..bdd445b
--- /dev/null
@@ -0,0 +1,52 @@
+--TEST--
+define_syslog_variables() variation 2
+--FILE--
+<?php
+define_syslog_variables();
+
+$standard_types = Array(
+                       'LOG_EMERG', 
+                       'LOG_ALERT', 
+                       'LOG_CRIT', 
+                       'LOG_ERR', 
+                       'LOG_WARNING', 
+                       'LOG_NOTICE', 
+                       'LOG_INFO', 
+                       'LOG_DEBUG', 
+                       'LOG_KERN', 
+                       'LOG_USER', 
+                       'LOG_MAIL', 
+                       'LOG_DAEMON', 
+                       'LOG_AUTH', 
+                       'LOG_LPR', 
+                       'LOG_PID', 
+                       'LOG_CONS', 
+                       'LOG_ODELAY', 
+                       'LOG_NDELAY'
+                       );
+
+foreach($standard_types as $logtype)
+{
+       var_dump(isset(${$logtype}));
+}
+?>
+--EXPECTF--
+Deprecated: Function define_syslog_variables() is deprecated in %s on line %d
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)