class TextfieldTest in Drupal 10
Same name in this branch
- 10 core/modules/text/tests/src/Functional/TextFieldTest.php \Drupal\Tests\text\Functional\TextFieldTest
- 10 core/tests/Drupal/Tests/Core/Render/Element/TextfieldTest.php \Drupal\Tests\Core\Render\Element\TextfieldTest
- 10 core/modules/text/tests/src/Unit/Migrate/d6/TextFieldTest.php \Drupal\Tests\text\Unit\Migrate\d6\TextFieldTest
- 10 core/modules/text/tests/src/Unit/Migrate/d7/TextFieldTest.php \Drupal\Tests\text\Unit\Migrate\d7\TextFieldTest
- 10 core/modules/text/tests/src/Unit/Plugin/migrate/field/d6/TextFieldTest.php \Drupal\Tests\text\Unit\Plugin\migrate\field\d6\TextFieldTest
- 10 core/modules/text/tests/src/Unit/Plugin/migrate/field/d7/TextFieldTest.php \Drupal\Tests\text\Unit\Plugin\migrate\field\d7\TextFieldTest
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Render/Element/TextfieldTest.php \Drupal\Tests\Core\Render\Element\TextfieldTest
- 9 core/tests/Drupal/Tests/Core/Render/Element/TextfieldTest.php \Drupal\Tests\Core\Render\Element\TextfieldTest
@coversDefaultClass \Drupal\Core\Render\Element\Textfield @group Render
Hierarchy
- class \Drupal\Tests\Core\Render\Element\TextfieldTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of TextfieldTest
File
- core/
tests/ Drupal/ Tests/ Core/ Render/ Element/ TextfieldTest.php, line 13
Namespace
Drupal\Tests\Core\Render\ElementView source
class TextfieldTest extends UnitTestCase {
/**
* @covers ::valueCallback
*
* @dataProvider providerTestValueCallback
*/
public function testValueCallback($expected, $input) {
$element = [];
$form_state = $this
->prophesize(FormStateInterface::class)
->reveal();
$this
->assertSame($expected, Textfield::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,
];
$data[] = [
'testwithnewline',
"test\nwith\rnewline",
];
return $data;
}
}