File: extract-zend2.2.phpt

package info (click to toggle)
php-log 1.10.0-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 404 kB
  • ctags: 592
  • sloc: php: 1,822; xml: 237; sql: 8; makefile: 3
file content (59 lines) | stat: -rw-r--r-- 1,457 bytes parent folder | download
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
--TEST--
Log: _extractMessage() [Zend Engine 2.2]
--SKIPIF--
<?php if (version_compare(zend_version(), "2.2.0", "<")) die('skip'); ?>
--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 a 'message' key. */
$logger->log(array('message' => 'Message Key'));

--EXPECT--
ident [info] String
ident [info] BareObject Object
(
)

ident [info] getMessage
ident [info] toString
ident [info] __toString
ident [info] PEAR_Error object
ident [info] Array
(
    [0] => 1
    [1] => 2
    [three] => 3
)

ident [info] Message Key