TokenTest.php in Drupal 10
File
core/tests/Drupal/Tests/Core/Render/Element/TokenTest.php
View source
<?php
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 function providerTestValueCallback() {
$data = [];
$data[] = [
NULL,
FALSE,
];
$data[] = [
NULL,
NULL,
];
$data[] = [
'',
[
'test',
],
];
$data[] = [
'test',
'test',
];
$data[] = [
'123',
123,
];
return $data;
}
}