/** * @param string $tagsToLog Which tags to log * @param array $messages Messages and tags to log * @param int $count How many messages should get logged * * @dataProvider providerTestLog */ function testLog($tagsToLog, $messages, $count) { # Setup the logger TagLog::setTags($tagsToLog); # Loop through the messages and log them foreach ($messages as $msg => $tag) { TagLog::log($msg, $tag); } # Check the message count $lines = file($this->logfile); $loggedMessages = sizeof($lines); $this->assertEquals($loggedMessages, $count); }
/** * @param string $tags Either a list of coma-separated tags * is passed, or the "*"-wildcard is used, which logs * all debug messages. If this parameter is left empty, * no messages are logged. */ public static function setTags($tags = null) { self::$tags = $tags ? explode(',', $tags) : false; }