tests: Complete test coverage of HtmlArmor
[lhc/web/wiklou.git] / tests / phpunit / includes / TestLogger.php
index 7086a92..21d1bf2 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Testing logger
  *
- * Copyright (C) 2015 Brad Jorsch <bjorsch@wikimedia.org>
+ * Copyright (C) 2015 Wikimedia Foundation and contributors
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,7 +20,6 @@
  * http://www.gnu.org/copyleft/gpl.html
  *
  * @file
- * @author Brad Jorsch <bjorsch@wikimedia.org>
  */
 
 use Psr\Log\LogLevel;
@@ -38,9 +37,11 @@ class TestLogger extends \Psr\Log\AbstractLogger {
        private $filter = null;
 
        /**
-        * @param bool $collect Whether to collect logs
+        * @param bool $collect Whether to collect logs. @see setCollect()
         * @param callable $filter Filter logs before collecting/printing. Signature is
         *  string|null function ( string $message, string $level, array $context );
+        * @param bool $collectContext Whether to keep the context passed to log.
+        *                             @since 1.29 @see setCollectContext()
         */
        public function __construct( $collect = false, $filter = null, $collectContext = false ) {
                $this->collect = $collect;
@@ -51,9 +52,23 @@ class TestLogger extends \Psr\Log\AbstractLogger {
        /**
         * Set the "collect" flag
         * @param bool $collect
+        * @return TestLogger $this
         */
        public function setCollect( $collect ) {
                $this->collect = $collect;
+               return $this;
+       }
+
+       /**
+        * Set the collectContext flag
+        *
+        * @param bool $collectContext
+        * @since 1.29
+        * @return TestLogger $this
+        */
+       public function setCollectContext( $collectContext ) {
+               $this->collectContext = $collectContext;
+               return $this;
        }
 
        /**