You are here

public function OnlyOneTest::providerDeleteContentTypeConfig in Allow a content type only once (Only One) 8

Data provider for testDeleteContentTypeConfig().

Return value

array An array of arrays, each containing:

  • 'expected' - Expected return from deleteContentTypeConfig().
  • 'content_types' - Content types configured to have onlyone node.
  • 'content_type' - The content type to delete from the config.

See also

testDeleteContentTypeConfig()

File

tests/src/Unit/OnlyOneTest.php, line 363

Class

OnlyOneTest
Tests the OnlyOne class methods.

Namespace

Drupal\Tests\onlyone\Unit

Code

public function providerDeleteContentTypeConfig() {

  // Content types configured to have onlyone node.
  $content_types = [];
  $content_types[1] = [
    'page',
    'blog',
    'article',
  ];
  $content_types[2] = [
    'house',
    'car',
  ];
  $content_types[3] = [
    'person',
    'dog',
    'cat',
    'bird',
  ];
  $tests['existing content type 1'] = [
    TRUE,
    'page',
    $content_types[1],
  ];
  $tests['existing content type 2'] = [
    TRUE,
    'car',
    $content_types[2],
  ];
  $tests['existing content type 3'] = [
    TRUE,
    'dog',
    $content_types[3],
  ];
  $tests['non existing content type 1'] = [
    FALSE,
    'book',
    $content_types[1],
  ];
  $tests['non existing content type 2'] = [
    FALSE,
    'plane',
    $content_types[2],
  ];
  $tests['non existing content type 3'] = [
    FALSE,
    'horse',
    $content_types[3],
  ];
  return $tests;
}