public function testAttachLog() { foreach (explode(':', get_include_path()) as $path) { if (file_exists($path . '/Log.php')) { include_once 'Log.php'; } } if (!class_exists('Log')) { $this->markTestSkipped(); } $log = Log::factory('null'); HTTP_OAuth::attachLog($log); $oauth = $this->getMock('HTTP_OAuth', array('foo')); $oauth->debug('foo'); $oauth->info('foo'); $oauth->err('foo'); HTTP_OAuth::detachLog($log); }
/** * Accept * * @param mixed $object Object to accept * * @see getHTTPRequest2() * @return void */ public function accept($object) { switch (get_class($object)) { case 'HTTP_Request2': $this->request = $object; foreach (self::$logs as $log) { $this->request->attach(new HTTP_Request2_Observer_Log($log)); } break; default: if ($object instanceof Log) { HTTP_OAuth::attachLog($object); $this->getHTTPRequest2()->attach(new HTTP_Request2_Observer_Log($object)); } break; } }