[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 --TEST-- 2 Log: _extractMessage() [Zend Engine 2] 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 an object with a __toString() method using casting. */ 29 class CastableObject { function __toString() { return "__toString"; } } 30 $logger->log(new CastableObject()); 31 32 /* Logging a PEAR_Error object. */ 33 require_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 a 'message' key. */ 40 $logger->log(array('message' => 'Message Key')); 41 42 --EXPECT-- 43 ident [info] String 44 ident [info] BareObject Object 45 ( 46 ) 47 48 ident [info] getMessage 49 ident [info] toString 50 ident [info] Object id #2 51 ident [info] PEAR_Error object 52 ident [info] Array 53 ( 54 [0] => 1 55 [1] => 2 56 [three] => 3 57 ) 58 59 ident [info] Message Key
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |