You are here

class TestSession in Rules 8.3

Implements just the methods we need for the Rules unit tests.

Hierarchy

  • class \Drupal\Tests\rules\Unit\TestSession implements \Symfony\Component\HttpFoundation\Session\SessionInterface

Expanded class hierarchy of TestSession

File

tests/src/Unit/TestSession.php, line 11

Namespace

Drupal\Tests\rules\Unit
View source
class TestSession implements SessionInterface {

  /**
   * Simulated session storage.
   *
   * @var array
   */
  protected $logs = [];

  /**
   * {@inheritdoc}
   */
  public function all() {
  }

  /**
   * {@inheritdoc}
   */
  public function clear() {
  }

  /**
   * {@inheritdoc}
   */
  public function get($key, $default = NULL) {
    if (isset($this->logs[$key])) {
      return $this->logs[$key];
    }
    else {
      return $default;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getBag($name) {
  }

  /**
   * {@inheritdoc}
   */
  public function getId() {
  }

  /**
   * {@inheritdoc}
   */
  public function getMetadataBag() {
  }

  /**
   * {@inheritdoc}
   */
  public function getName() {
  }

  /**
   * {@inheritdoc}
   */
  public function has($name) {
  }

  /**
   * {@inheritdoc}
   */
  public function invalidate($lifetime = NULL) {
  }

  /**
   * {@inheritdoc}
   */
  public function isStarted() {
  }

  /**
   * {@inheritdoc}
   */
  public function migrate($destroy = FALSE, $lifetime = NULL) {
  }

  /**
   * {@inheritdoc}
   */
  public function registerBag(SessionBagInterface $bag) {
  }

  /**
   * {@inheritdoc}
   */
  public function remove($key) {
    if (isset($this->logs[$key])) {
      $return = $this->logs[$key];
      unset($this->logs[$key]);
      return $return;
    }
    else {
      return NULL;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function replace(array $attributes) {
  }

  /**
   * {@inheritdoc}
   */
  public function save() {
  }

  /**
   * {@inheritdoc}
   */
  public function set($key, $value) {
    $this->logs[$key] = $value;
  }

  /**
   * {@inheritdoc}
   */
  public function setId($id) {
  }

  /**
   * {@inheritdoc}
   */
  public function setName($name) {
  }

  /**
   * {@inheritdoc}
   */
  public function start() {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestSession::$logs protected property Simulated session storage.
TestSession::all public function Returns attributes.
TestSession::clear public function Clears all attributes.
TestSession::get public function Returns an attribute.
TestSession::getBag public function Gets a bag instance by name.
TestSession::getId public function Returns the session ID.
TestSession::getMetadataBag public function Gets session meta.
TestSession::getName public function Returns the session name.
TestSession::has public function Checks if an attribute is defined.
TestSession::invalidate public function Invalidates the current session.
TestSession::isStarted public function Checks if the session was started.
TestSession::migrate public function Migrates the current session to a new session id while maintaining all session attributes.
TestSession::registerBag public function Registers a SessionBagInterface with the session.
TestSession::remove public function Removes an attribute.
TestSession::replace public function Sets attributes.
TestSession::save public function Force the session to be saved and closed.
TestSession::set public function Sets an attribute.
TestSession::setId public function Sets the session ID.
TestSession::setName public function Sets the session name.
TestSession::start public function Starts the session storage.