~ubuntu-branches/ubuntu/natty/php-log/natty

« back to all changes in this revision

Viewing changes to Log-1.9.8/tests/extract.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Jose Carlos Medeiros
  • Date: 2007-05-16 20:42:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070516204226-myf5wokps22o2bn8
Tags: 1.9.11-1
* New upstream release. (Closes: #417567)
* Updated debian/watch file.
* Remove debian/package/tmp created directory.
* Removed php4 support. (Closes: #424821)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--TEST--
2
 
Log: _extractMessage() [Zend Engine 1]
3
 
--SKIPIF--
4
 
<?php if (version_compare(zend_version(), "2.0.0", ">=")) die('skip'); ?>
5
 
--FILE--
6
 
<?php
7
 
 
8
 
require_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. */
17
 
class BareObject {}
18
 
$logger->log(new BareObject());
19
 
 
20
 
/* Logging an object with a getMessage() method. */
21
 
class GetMessageObject { function getMessage() { return "getMessage"; } }
22
 
$logger->log(new GetMessageObject());
23
 
 
24
 
/* Logging an object with a toString() method. */
25
 
class ToStringObject { function toString() { return "toString"; } }
26
 
$logger->log(new ToStringObject());
27
 
 
28
 
/* Logging a PEAR_Error object. */
29
 
require_once 'PEAR.php';
30
 
$logger->log(new PEAR_Error('PEAR_Error object', 100));
31
 
 
32
 
/* Logging an array. */
33
 
$logger->log(array(1, 2, 'three' => 3));
34
 
 
35
 
/* Logging an array with a 'message' key. */
36
 
$logger->log(array('message' => 'Message Key'));
37
 
 
38
 
--EXPECT--
39
 
ident [info] String
40
 
ident [info] bareobject Object
41
 
(
42
 
)
43
 
 
44
 
ident [info] getMessage
45
 
ident [info] toString
46
 
ident [info] PEAR_Error object
47
 
ident [info] Array
48
 
(
49
 
    [0] => 1
50
 
    [1] => 2
51
 
    [three] => 3
52
 
)
53
 
 
54
 
ident [info] Message Key