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

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