Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Issue forks
linkit-2886455
Commits
b81d3614
Commit
b81d3614
authored
Sep 17, 2016
by
Emil Stjerneman
Browse files
by anon: Minor test fixes.
parent
f1fc37a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/src/Kernel/LinkitEditorLinkDialogTest.php
View file @
b81d3614
...
...
@@ -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
->
assertE
quals
(
''
,
$form
[
'linkit'
][
'#default_value'
],
'The linkit field is empty.'
);
$this
->
assertE
mpty
(
$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
());
...
...
tests/src/Kernel/Matchers/AssertResultUriTrait.php
deleted
100644 → 0
View file @
f1fc37a4
<?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.'
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment