function ContentModerationRouteSubscriberTest::setLatestRevisionFlagTestCases
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Unit/ContentModerationRouteSubscriberTest.php \Drupal\Tests\content_moderation\Unit\ContentModerationRouteSubscriberTest::setLatestRevisionFlagTestCases()
- 8.9.x core/modules/content_moderation/tests/src/Unit/ContentModerationRouteSubscriberTest.php \Drupal\Tests\content_moderation\Unit\ContentModerationRouteSubscriberTest::setLatestRevisionFlagTestCases()
- 10 core/modules/content_moderation/tests/src/Unit/ContentModerationRouteSubscriberTest.php \Drupal\Tests\content_moderation\Unit\ContentModerationRouteSubscriberTest::setLatestRevisionFlagTestCases()
Data provider for ::testSetLatestRevisionFlag.
File
-
core/
modules/ content_moderation/ tests/ src/ Unit/ ContentModerationRouteSubscriberTest.php, line 72
Class
- ContentModerationRouteSubscriberTest
- @coversDefaultClass \Drupal\content_moderation\Routing\ContentModerationRouteSubscriber
Namespace
Drupal\Tests\content_moderation\UnitCode
public static function setLatestRevisionFlagTestCases() {
return [
'Entity parameter not on an entity form' => [
[],
[
'entity_test' => [
'type' => 'entity:entity_test_rev',
],
],
],
'Entity parameter on an entity form' => [
[
'_entity_form' => 'entity_test_rev.edit',
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
],
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
'load_latest_revision' => TRUE,
],
],
],
'Entity form with no operation' => [
[
'_entity_form' => 'entity_test_rev',
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
],
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
'load_latest_revision' => TRUE,
],
],
],
'Non-moderated entity form' => [
[
'_entity_form' => 'entity_test_mulrev',
],
[
'entity_test_mulrev' => [
'type' => 'entity:entity_test_mulrev',
],
],
],
'Multiple entity parameters on an entity form' => [
[
'_entity_form' => 'entity_test_rev.edit',
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
],
'node' => [
'type' => 'entity:node',
],
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
'load_latest_revision' => TRUE,
],
'node' => [
'type' => 'entity:node',
],
],
],
'Overridden load_latest_revision flag does not change' => [
[
'_entity_form' => 'entity_test_rev.edit',
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
'load_latest_revision' => FALSE,
],
],
],
'Non-revisionable entity type will not change' => [
[
'_entity_form' => 'entity_test.edit',
],
[
'entity_test' => [
'type' => 'entity:entity_test',
],
],
FALSE,
FALSE,
],
'Overridden load_latest_revision flag does not change with multiple parameters' => [
[
'_entity_form' => 'entity_test_rev.edit',
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
],
'node' => [
'type' => 'entity:node',
'load_latest_revision' => FALSE,
],
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
'load_latest_revision' => TRUE,
],
'node' => [
'type' => 'entity:node',
'load_latest_revision' => FALSE,
],
],
],
'Parameter without type is unchanged' => [
[
'_entity_form' => 'entity_test_rev.edit',
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
],
'unrelated_param' => [
'foo' => 'bar',
],
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
'load_latest_revision' => TRUE,
],
'unrelated_param' => [
'foo' => 'bar',
],
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.