source: branches/1.2/workflow/inc/log/tests/extract-zend2.0.phpt @ 1349

Revision 1349, 1.7 KB checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

  • Property svn:executable set to *
Line 
1--TEST--
2Log: _extractMessage() [Zend Engine 2.0]
3--SKIPIF--
4<?php
5if (version_compare(zend_version(), "2.0.0", "<") ||
6    version_compare(zend_version(), "2.2.0", ">=")) die('skip');
7?>
8--FILE--
9<?php
10
11require_once 'Log.php';
12
13$conf = array('lineFormat' => '%2$s [%3$s] %4$s');
14$logger = &Log::singleton('console', '', 'ident', $conf);
15
16/* Logging a regular string. */
17$logger->log('String');
18
19/* Logging a bare object. */
20class BareObject {}
21$logger->log(new BareObject());
22
23/* Logging an object with a getMessage() method. */
24class GetMessageObject { function getMessage() { return "getMessage"; } }
25$logger->log(new GetMessageObject());
26
27/* Logging an object with a toString() method. */
28class ToStringObject { function toString() { return "toString"; } }
29$logger->log(new ToStringObject());
30
31/* Logging an object with a __toString() method using casting. */
32class CastableObject { function __toString() { return "__toString"; } }
33$logger->log(new CastableObject());
34
35/* Logging a PEAR_Error object. */
36require_once 'PEAR.php';
37$logger->log(new PEAR_Error('PEAR_Error object', 100));
38
39/* Logging an array. */
40$logger->log(array(1, 2, 'three' => 3));
41
42/* Logging an array with scalar 'message' keys. */
43$logger->log(array('message' => 'Message Key'));
44$logger->log(array('message' => 50));
45
46/* Logging an array with a non-scalar 'message' key. */
47$logger->log(array('message' => array(1, 2, 3)));
48
49--EXPECT--
50ident [info] String
51ident [info] BareObject::__set_state(array(
52))
53ident [info] getMessage
54ident [info] toString
55ident [info] Object id #2
56ident [info] PEAR_Error object
57ident [info] array (
58  0 => 1,
59  1 => 2,
60  'three' => 3,
61
62ident [info] Message Key
63ident [info] 50
64ident [info] array (
65  0 => 1,
66  1 => 2,
67  2 => 3,
68)
Note: See TracBrowser for help on using the repository browser.