summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Stjerneman2016-09-17 23:06:55 +0200
committerEmil Stjerneman2016-09-17 23:06:55 +0200
commitb81d361449fbfee0f05d86575ea416e3535ddf47 (patch)
tree17d5fd65a65143f8ea40387090479a151d9eeced
parentf1fc37a424acf3e57f6140e0ec5616b34eb9c234 (diff)
by anon: Minor test fixes.8.x-5.0-beta3
-rw-r--r--tests/src/Kernel/LinkitEditorLinkDialogTest.php3
-rw-r--r--tests/src/Kernel/Matchers/AssertResultUriTrait.php29
2 files changed, 2 insertions, 30 deletions
diff --git a/tests/src/Kernel/LinkitEditorLinkDialogTest.php b/tests/src/Kernel/LinkitEditorLinkDialogTest.php
index f12f66e..34a7c02 100644
--- a/tests/src/Kernel/LinkitEditorLinkDialogTest.php
+++ b/tests/src/Kernel/LinkitEditorLinkDialogTest.php
@@ -123,13 +123,14 @@ class LinkitEditorLinkDialogTest extends LinkitKernelTestBase {
$form_builder->processForm($form_id, $form, $form_state);
$this->assertEquals('linkit.autocomplete', $form['linkit']['#autocomplete_route_name'], 'Linkit is enabled on the linkit field.');
- $this->assertEquals('', $form['linkit']['#default_value'], 'The linkit field is empty.');
+ $this->assertEmpty($form['linkit']['#default_value'], 'The linkit field is empty.');
$form_state->setValue('linkit', 'url_without_schema');
$form_builder->submitForm($form_object, $form_state);
$this->assertEmpty($form_state->getErrors(), 'Got no validation errors for url without schema.');
$this->assertEmpty($form_state->getValue(['attributes', 'data-entity-type']));
$this->assertEmpty($form_state->getValue(['attributes', 'data-entity-uuid']));
+ $this->assertEmpty($form_state->getValue(['attributes', 'data-entity-substitution']));
$form_state->setValue(['attributes', 'data-entity-type'], $entity->getEntityTypeId());
$form_state->setValue(['attributes', 'data-entity-uuid'], $entity->uuid());
diff --git a/tests/src/Kernel/Matchers/AssertResultUriTrait.php b/tests/src/Kernel/Matchers/AssertResultUriTrait.php
deleted file mode 100644
index 0f3da62..0000000
--- a/tests/src/Kernel/Matchers/AssertResultUriTrait.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-namespace Drupal\Tests\linkit\Kernel\Matchers;
-
-use Drupal\linkit\MatcherInterface;
-use Drupal\linkit\Suggestion\SuggestionCollection;
-
-/**
- * Provides helper methods for assertions.
- */
-trait AssertResultUriTrait {
-
- /**
- * Assert that paths are formatted as an URI with the entity: scheme.
- *
- * @param \Drupal\linkit\MatcherInterface $plugin
- * A matcher plugin.
- * @param \Drupal\linkit\Suggestion\SuggestionCollection $suggestions
- * A collection of suggestions.
- */
- public function assertResultUri(MatcherInterface $plugin, SuggestionCollection $suggestions) {
- $entity_type = $plugin->getPluginDefinition()['target_entity'];
- $substitution_id = $plugin->getConfiguration()['settings']['substitution_type'];
- foreach ($suggestions->getSuggestions() as $suggestion) {
- $this->assertTrue(preg_match("/^entity:" . $substitution_id . "\\/" . $entity_type . "\\/\\w+$/i", $suggestion->getPath()), 'Result URI correct formatted.');
- }
- }
-
-}