You are here

protected function ContentEntityExampleTest::providerTestPaths in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/content_entity_example/tests/src/Functional/ContentEntityExampleTest.php \Drupal\Tests\content_entity_example\Functional\ContentEntityExampleTest::providerTestPaths()

Data provider for testPaths.

Parameters

int $contact_id: The id of an existing Contact entity.

Return value

array Nested array of testing data. Arranged like this:

  • Expected response code.
  • Path to request.
  • Permission for the user.
1 call to ContentEntityExampleTest::providerTestPaths()
ContentEntityExampleTest::testPaths in content_entity_example/tests/src/Functional/ContentEntityExampleTest.php
Test all paths exposed by the module, by permission.

File

content_entity_example/tests/src/Functional/ContentEntityExampleTest.php, line 161

Class

ContentEntityExampleTest
Tests the basic functions of the Content Entity Example module.

Namespace

Drupal\Tests\content_entity_example\Functional

Code

protected function providerTestPaths($contact_id) {
  return [
    [
      200,
      '/content_entity_example_contact/' . $contact_id,
      'view contact entity',
    ],
    [
      403,
      '/content_entity_example_contact/' . $contact_id,
      '',
    ],
    [
      200,
      '/content_entity_example_contact/list',
      'view contact entity',
    ],
    [
      403,
      '/content_entity_example_contact/list',
      '',
    ],
    [
      200,
      '/content_entity_example_contact/add',
      'add contact entity',
    ],
    [
      403,
      '/content_entity_example_contact/add',
      '',
    ],
    [
      200,
      '/content_entity_example_contact/' . $contact_id . '/edit',
      'edit contact entity',
    ],
    [
      403,
      '/content_entity_example_contact/' . $contact_id . '/edit',
      '',
    ],
    [
      200,
      '/contact/' . $contact_id . '/delete',
      'delete contact entity',
    ],
    [
      403,
      '/contact/' . $contact_id . '/delete',
      '',
    ],
    [
      200,
      'admin/structure/content_entity_example_contact_settings',
      'administer contact entity',
    ],
    [
      403,
      'admin/structure/content_entity_example_contact_settings',
      '',
    ],
  ];
}