function ContextualUnitTest::_contextual_links_id_testcases in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/contextual/src/Tests/ContextualUnitTest.php \Drupal\contextual\Tests\ContextualUnitTest::_contextual_links_id_testcases()
Provides testcases for testContextualLinksToId() and
2 calls to ContextualUnitTest::_contextual_links_id_testcases()
- ContextualUnitTest::testContextualIdToLinks in core/
modules/ contextual/ src/ Tests/ ContextualUnitTest.php - Tests _contextual_id_to_links().
- ContextualUnitTest::testContextualLinksToId in core/
modules/ contextual/ src/ Tests/ ContextualUnitTest.php - Tests _contextual_links_to_id().
File
- core/
modules/ contextual/ src/ Tests/ ContextualUnitTest.php, line 30 - Contains \Drupal\contextual\Tests\ContextualUnitTest.
Class
- ContextualUnitTest
- Tests all edge cases of converting from #contextual_links to ids and vice versa.
Namespace
Drupal\contextual\TestsCode
function _contextual_links_id_testcases() {
// Test branch conditions:
// - one group.
// - one dynamic path argument.
// - no metadata.
$tests[] = array(
'links' => array(
'node' => array(
'route_parameters' => array(
'node' => '14031991',
),
'metadata' => array(
'langcode' => 'en',
),
),
),
'id' => 'node:node=14031991:langcode=en',
);
// Test branch conditions:
// - one group.
// - multiple dynamic path arguments.
// - no metadata.
$tests[] = array(
'links' => array(
'foo' => array(
'route_parameters' => array(
'bar',
'key' => 'baz',
'qux',
),
'metadata' => array(
'langcode' => 'en',
),
),
),
'id' => 'foo:0=bar&key=baz&1=qux:langcode=en',
);
// Test branch conditions:
// - one group.
// - one dynamic path argument.
// - metadata.
$tests[] = array(
'links' => array(
'views_ui_edit' => array(
'route_parameters' => array(
'view' => 'frontpage',
),
'metadata' => array(
'location' => 'page',
'display' => 'page_1',
'langcode' => 'en',
),
),
),
'id' => 'views_ui_edit:view=frontpage:location=page&display=page_1&langcode=en',
);
// Test branch conditions:
// - multiple groups.
// - multiple dynamic path arguments.
$tests[] = array(
'links' => array(
'node' => array(
'route_parameters' => array(
'node' => '14031991',
),
'metadata' => array(
'langcode' => 'en',
),
),
'foo' => array(
'route_parameters' => array(
'bar',
'key' => 'baz',
'qux',
),
'metadata' => array(
'langcode' => 'en',
),
),
'edge' => array(
'route_parameters' => array(
'20011988',
),
'metadata' => array(
'langcode' => 'en',
),
),
),
'id' => 'node:node=14031991:langcode=en|foo:0=bar&key=baz&1=qux:langcode=en|edge:0=20011988:langcode=en',
);
return $tests;
}