TextareaTest.php

Same filename in this branch
  1. 11.x core/modules/system/tests/src/Functional/Form/TextareaTest.php
Same filename and directory in other branches
  1. 9 core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php
  2. 8.9.x core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php
  3. 10 core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php

Namespace

Drupal\Tests\Core\Render\Element

File

core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Render\Element;

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element\Textarea;
use Drupal\Tests\UnitTestCase;

/**
 * @coversDefaultClass \Drupal\Core\Render\Element\Textarea
 * @group Render
 */
class TextareaTest extends UnitTestCase {
  
  /**
   * @covers ::valueCallback
   *
   * @dataProvider providerTestValueCallback
   */
  public function testValueCallback($expected, $input) : void {
    $element = [];
    $form_state = $this->prophesize(FormStateInterface::class)
      ->reveal();
    $this->assertSame($expected, Textarea::valueCallback($element, $input, $form_state));
  }
  
  /**
   * Data provider for testValueCallback().
   */
  public static function providerTestValueCallback() {
    $data = [];
    $data[] = [
      NULL,
      FALSE,
    ];
    $data[] = [
      NULL,
      NULL,
    ];
    $data[] = [
      '',
      [
        'test',
      ],
    ];
    $data[] = [
      'test',
      'test',
    ];
    $data[] = [
      '123',
      123,
    ];
    return $data;
  }

}

Classes

Title Deprecated Summary
TextareaTest @coversDefaultClass \Drupal\Core\Render\Element\Textarea[[api-linebreak]] @group Render

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.