public function testLogDetails() { $fake = $this->getMock('stdClass', array('log')); Log::receive(array($fake, 'log')); Log::minLevel(Log::LEVEL_DEBUG); $expectedDetails = array('ping' => 'pong'); $fake->expects($this->at(0))->method('log')->with($this->equalTo('Message 1'), $this->equalTo(Log::LEVEL_INFO), $this->equalTo($expectedDetails)); Log::write('Message 1', Log::LEVEL_INFO, $expectedDetails); }
/** * Builds the plugin cache and gets an array of plugin objects. * * @return array */ protected function buildPluginCache() { $classObjects = array(); if (!is_dir($this->path)) { Log::write('Plugin path not a directory.', Log::LEVEL_WARNING, compact('path')); return array(); } if ($handle = opendir($this->path)) { while (false !== ($entry = readdir($handle))) { if ($entry === '.' || $entry === '..') { continue; } $class = $this->namespace . '\\' . basename($entry, '.php'); if (class_exists($class)) { $plugin = new $class(); if ($plugin->enabled) { $classObjects[$class] = $plugin; } } } closedir($handle); // Order the plugin objects by priority uasort($classObjects, array($this, 'comparePriority')); } return $classObjects; }
/** * Clears all listener callbacks. * * @return void */ public function clearAll() { Log::write('Clearing all events.', Log::LEVEL_DEBUG); $this->registry = array(); }