You are here

class TextareaTest in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php \Drupal\Tests\Core\Render\Element\TextareaTest
  2. 9 core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php \Drupal\Tests\Core\Render\Element\TextareaTest

@coversDefaultClass \Drupal\Core\Render\Element\Textarea @group Render

Hierarchy

  • class \Drupal\Tests\Core\Render\Element\TextareaTest extends \Drupal\Tests\UnitTestCase

Expanded class hierarchy of TextareaTest

File

core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php, line 13

Namespace

Drupal\Tests\Core\Render\Element
View source
class TextareaTest extends UnitTestCase {

  /**
   * @covers ::valueCallback
   *
   * @dataProvider providerTestValueCallback
   */
  public function testValueCallback($expected, $input) {
    $element = [];
    $form_state = $this
      ->prophesize(FormStateInterface::class)
      ->reveal();
    $this
      ->assertSame($expected, Textarea::valueCallback($element, $input, $form_state));
  }

  /**
   * Data provider for testValueCallback().
   */
  public function providerTestValueCallback() {
    $data = [];
    $data[] = [
      NULL,
      FALSE,
    ];
    $data[] = [
      NULL,
      NULL,
    ];
    $data[] = [
      '',
      [
        'test',
      ],
    ];
    $data[] = [
      'test',
      'test',
    ];
    $data[] = [
      '123',
      123,
    ];
    return $data;
  }

}

Members