function NodeRequirementsStatusFilterWarningTest::createTestView

Helper method to create a test view.

Parameters

string $id: The view ID.

string $label: The view label.

bool $status: Whether the view is enabled.

array $filters: Filters to apply to the view.

Return value

\Drupal\views\Entity\View The created view entity.

8 calls to NodeRequirementsStatusFilterWarningTest::createTestView()
NodeRequirementsStatusFilterWarningTest::testDescriptionWithMultipleViewsAndSingleModule in core/modules/node/tests/src/Kernel/NodeRequirementsStatusFilterWarningTest.php
Tests description with multiple views and one access module.
NodeRequirementsStatusFilterWarningTest::testDescriptionWithSingleViewAndSingleModule in core/modules/node/tests/src/Kernel/NodeRequirementsStatusFilterWarningTest.php
Tests description with one view and one access module.
NodeRequirementsStatusFilterWarningTest::testDescriptionWithViewsUiDisabled in core/modules/node/tests/src/Kernel/NodeRequirementsStatusFilterWarningTest.php
Tests description formatting with Views UI disabled.
NodeRequirementsStatusFilterWarningTest::testDescriptionWithViewsUiEnabledWithoutUserHavingEditViewDisplayAccess in core/modules/node/tests/src/Kernel/NodeRequirementsStatusFilterWarningTest.php
Tests description when Views UI is enabled but user cannot edit views.
NodeRequirementsStatusFilterWarningTest::testDescriptionWithViewsUiEnabledWithUserHavingEditViewDisplayAccess in core/modules/node/tests/src/Kernel/NodeRequirementsStatusFilterWarningTest.php
Tests description when Views UI is enabled but user can edit views.

... See full list

File

core/modules/node/tests/src/Kernel/NodeRequirementsStatusFilterWarningTest.php, line 227

Class

NodeRequirementsStatusFilterWarningTest
Tests redundant status filter warnings raised by node_requirements().

Namespace

Drupal\Tests\node\Kernel

Code

private function createTestView(string $id, string $label, bool $status, array $filters) : View {
  $view = View::create([
    'id' => $id,
    'label' => $label,
    'status' => $status,
    'base_table' => 'node_field_data',
    'display' => [
      'default' => [
        'display_title' => 'Default',
        'display_plugin' => 'default',
        'id' => 'default',
        'display_options' => [
          'filters' => $filters,
        ],
      ],
    ],
  ]);
  $view->save();
  return $view;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.