/usr/share/doc/php-log/tests/extract-zend2.0.phpt is in php-log 1.12.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | --TEST--
Log: _extractMessage() [Zend Engine 2.0]
--SKIPIF--
<?php
if (version_compare(zend_version(), "2.0.0", "<") ||
version_compare(zend_version(), "2.2.0", ">=")) die('skip');
?>
--INI--
date.timezone=UTC
--FILE--
<?php
require_once 'Log.php';
$conf = array('lineFormat' => '%2$s [%3$s] %4$s');
$logger = Log::singleton('console', '', 'ident', $conf);
/* Logging a regular string. */
$logger->log('String');
/* Logging a bare object. */
class BareObject {}
$logger->log(new BareObject());
/* Logging an object with a getMessage() method. */
class GetMessageObject { function getMessage() { return "getMessage"; } }
$logger->log(new GetMessageObject());
/* Logging an object with a toString() method. */
class ToStringObject { function toString() { return "toString"; } }
$logger->log(new ToStringObject());
/* Logging an object with a __toString() method using casting. */
class CastableObject { function __toString() { return "__toString"; } }
$logger->log(new CastableObject());
/* Logging a PEAR_Error object. */
require_once 'PEAR.php';
$logger->log(new PEAR_Error('PEAR_Error object', 100));
/* Logging an array. */
$logger->log(array(1, 2, 'three' => 3));
/* Logging an array with scalar 'message' keys. */
$logger->log(array('message' => 'Message Key'));
$logger->log(array('message' => 50));
/* Logging an array with a non-scalar 'message' key. */
$logger->log(array('message' => array(1, 2, 3)));
--EXPECT--
ident [info] String
ident [info] BareObject::__set_state(array(
))
ident [info] getMessage
ident [info] toString
ident [info] Object id #2
ident [info] PEAR_Error object
ident [info] array (
0 => 1,
1 => 2,
'three' => 3,
ident [info] Message Key
ident [info] 50
ident [info] array (
0 => 1,
1 => 2,
2 => 3,
)
|