You are here

public function FileFieldPathsTokensTest::assertToken in File (Field) Paths 8

Assert that the provided token matches the provided value.

Parameters

string $token: The token to test.

string $value: The value to check against the token.

array $data: The data to process the token with.

4 calls to FileFieldPathsTokensTest::assertToken()
FileFieldPathsTokensTest::testTokensBasic in tests/src/Functional/FileFieldPathsTokensTest.php
Test token values with a text file.
FileFieldPathsTokensTest::testTokensMoved in tests/src/Functional/FileFieldPathsTokensTest.php
Test token values with a moved text file.
FileFieldPathsTokensTest::testTokensMultiExtension in tests/src/Functional/FileFieldPathsTokensTest.php
Test token values with a multi-extension text file.
FileFieldPathsTokensTest::testTokensUtf in tests/src/Functional/FileFieldPathsTokensTest.php
Test token value with a UTF file.

File

tests/src/Functional/FileFieldPathsTokensTest.php, line 22

Class

FileFieldPathsTokensTest
Test token functionality.

Namespace

Drupal\Tests\filefield_paths\Functional

Code

public function assertToken($token, $value, array $data) {
  $result = \Drupal::token()
    ->replace($token, $data);
  $this
    ->assertEquals($value, $result, "Token {$token} equals {$value}");
}