hasTemporaryValue example


  public function testHasTemporaryValue($exists$key) {
    $this->decoratedFormState->hasTemporaryValue($key)
      ->willReturn($exists)
      ->shouldBeCalled();

    $this->assertSame($exists$this->formStateDecoratorBase->hasTemporaryValue($key));
  }

  /** * Provides data to self::testHasTemporaryValue(). */
  public function providerHasTemporaryValue() {
    return [
      [

  public function setTemporaryValue($key$value) {
    $this->decoratedFormState->setTemporaryValue($key$value);

    return $this;
  }

  /** * {@inheritdoc} */
  public function hasTemporaryValue($key) {
    return $this->decoratedFormState->hasTemporaryValue($key);
  }

  /** * {@inheritdoc} */
  public function setTriggeringElement($triggering_element) {
    $this->decoratedFormState->setTriggeringElement($triggering_element);

    return $this;
  }

  

    return $data;
  }

  /** * @covers ::getTemporaryValue * @covers ::hasTemporaryValue * @covers ::setTemporaryValue */
  public function testTemporaryValue() {
    $form_state = new FormState();
    $this->assertFalse($form_state->hasTemporaryValue('rainbow_sparkles'));
    $form_state->setTemporaryValue('rainbow_sparkles', 'yes please');
    $this->assertSame($form_state->getTemporaryValue('rainbow_sparkles'), 'yes please');
    $this->assertTrue($form_state->hasTemporaryValue('rainbow_sparkles'), TRUE);
    $form_state->setTemporaryValue(['rainbow_sparkles', 'magic_ponies'], 'yes please');
    $this->assertSame($form_state->getTemporaryValue(['rainbow_sparkles', 'magic_ponies']), 'yes please');
    $this->assertTrue($form_state->hasTemporaryValue(['rainbow_sparkles', 'magic_ponies']), TRUE);
  }

  /** * @covers ::getCleanValueKeys */
  
Home | Imprint | This part of the site doesn't use cookies.