class PluralTranslationTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php \Drupal\Tests\Core\Annotation\PluralTranslationTest
- 10 core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php \Drupal\Tests\Core\Annotation\PluralTranslationTest
- 9 core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php \Drupal\Tests\Core\Annotation\PluralTranslationTest
- 8.9.x core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php \Drupal\Tests\Core\Annotation\PluralTranslationTest
Tests Drupal\Core\Annotation\PluralTranslation.
Attributes
#[CoversClass(PluralTranslation::class)]
#[Group('Annotation')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Annotation\PluralTranslationTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of PluralTranslationTest
File
-
core/
tests/ Drupal/ Tests/ Core/ Annotation/ PluralTranslationTest.php, line 17
Namespace
Drupal\Tests\Core\AnnotationView source
class PluralTranslationTest extends UnitTestCase {
/**
* Tests get.
*/
public function testGet(array $values) : void {
$annotation = new PluralTranslation($values);
$default_values = [
'context' => NULL,
];
$this->assertEquals($values + $default_values, $annotation->get());
}
/**
* Provides data to self::testGet().
*/
public static function providerTestGet() : array {
$data = [];
$data[] = [
[
'singular' => Random::machineName(),
'plural' => Random::machineName(),
'context' => Random::machineName(),
],
];
$data[] = [
[
'singular' => Random::machineName(),
'plural' => Random::machineName(),
],
];
return $data;
}
/**
* Tests missing data.
*/
public function testMissingData($data) : void {
$this->expectException(\InvalidArgumentException::class);
new PluralTranslation($data);
}
public static function providerTestMissingData() : array {
$data = [];
$data['all-missing'] = [
[],
];
$data['singular-missing'] = [
[
'plural' => 'muh',
],
];
$data['plural-missing'] = [
[
'singular' => 'muh',
],
];
return $data;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.