Same filename in this branch
- 10 core/tests/Drupal/Tests/Core/Utility/TokenTest.php
- 10 core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php
Same filename and directory in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php
- 9 core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php
Namespace
Drupal\Tests\Core\Render\Element
File
core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\Core\Render\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element\Token;
use Drupal\Tests\UnitTestCase;
class TokenTest extends UnitTestCase {
public function testValueCallback($expected, $input) {
$element = [];
$form_state = $this
->prophesize(FormStateInterface::class)
->reveal();
$this
->assertSame($expected, Token::valueCallback($element, $input, $form_state));
}
public static function providerTestValueCallback() {
$data = [];
$data[] = [
NULL,
FALSE,
];
$data[] = [
NULL,
NULL,
];
$data[] = [
'',
[
'test',
],
];
$data[] = [
'test',
'test',
];
$data[] = [
'123',
123,
];
return $data;
}
}
Classes