You are here

class TestMessenger in Feeds extensible parsers 8

Stores messages without calling drupal_set_message().

Hierarchy

Expanded class hierarchy of TestMessenger

8 files declare their use of TestMessenger
HtmlParserTest.php in tests/src/Unit/Feeds/Parser/HtmlParserTest.php
JmesPathLinesParserTest.php in tests/src/Unit/Feeds/Parser/JmesPathLinesParserTest.php
JmesPathParserTest.php in tests/src/Unit/Feeds/Parser/JmesPathParserTest.php
JsonPathLinesParserTest.php in tests/src/Unit/Feeds/Parser/JsonPathLinesParserTest.php
JsonPathParserTest.php in tests/src/Unit/Feeds/Parser/JsonPathParserTest.php

... See full list

File

src/Messenger/TestMessenger.php, line 10

Namespace

Drupal\feeds_ex\Messenger
View source
class TestMessenger extends Messenger {

  /**
   * The messages that have been set.
   *
   * @var array
   */
  protected $messages = [];

  /**
   * Constructs a new TestMessenger.
   */
  public function __construct() {
  }

  /**
   * {@inheritdoc}
   */
  public function addMessage($message, $type = self::TYPE_STATUS, $repeat = FALSE) {
    $this->messages[] = [
      'message' => $message,
      'type' => $type,
      'repeat' => $repeat,
    ];
  }

  /**
   * Returns the messages.
   *
   * This is used to inspect messages that have been set.
   *
   * @return array
   *   A list of message arrays.
   */
  public function getMessages() {
    return $this->messages;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Messenger::$flashBag protected property The flash bag.
Messenger::$killSwitch protected property The kill switch.
Messenger::addError public function Adds a new error message to the queue. Overrides MessengerInterface::addError
Messenger::addStatus public function Adds a new status message to the queue. Overrides MessengerInterface::addStatus
Messenger::addWarning public function Adds a new warning message to the queue. Overrides MessengerInterface::addWarning
Messenger::all public function Gets all messages. Overrides MessengerInterface::all
Messenger::deleteAll public function Deletes all messages. Overrides MessengerInterface::deleteAll
Messenger::deleteByType public function Deletes all messages of a certain type. Overrides MessengerInterface::deleteByType
Messenger::messagesByType public function Gets all messages of a certain type. Overrides MessengerInterface::messagesByType
MessengerInterface::TYPE_ERROR constant An error.
MessengerInterface::TYPE_STATUS constant A status message.
MessengerInterface::TYPE_WARNING constant A warning.
TestMessenger::$messages protected property The messages that have been set.
TestMessenger::addMessage public function Adds a new message to the queue. Overrides Messenger::addMessage
TestMessenger::getMessages public function Returns the messages.
TestMessenger::__construct public function Constructs a new TestMessenger. Overrides Messenger::__construct