Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
603f0d4c
Unverified
Commit
603f0d4c
authored
5 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3042640
by jian he, claudiu.cristea: Convert TaxonomyFieldTidTest to a kernel test
parent
bdd4ddb9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyFieldTidTest.php
+72
-0
72 additions, 0 deletions
.../taxonomy/tests/src/Kernel/Views/TaxonomyFieldTidTest.php
with
72 additions
and
0 deletions
core/modules/taxonomy/tests/src/
Functiona
l/Views/TaxonomyFieldTidTest.php
→
core/modules/taxonomy/tests/src/
Kerne
l/Views/TaxonomyFieldTidTest.php
+
72
−
0
View file @
603f0d4c
<?php
namespace
Drupal\Tests\taxonomy\
Functiona
l\Views
;
namespace
Drupal\Tests\taxonomy\
Kerne
l\Views
;
use
Drupal\Core\Link
;
use
Drupal\Core\Render\RenderContext
;
use
Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait
;
use
Drupal\Tests\views\Kernel\ViewsKernelTestBase
;
use
Drupal\views\Tests\ViewTestData
;
use
Drupal\views\Views
;
/**
...
...
@@ -10,15 +14,46 @@
*
* @group taxonomy
*/
class
TaxonomyFieldTidTest
extends
TaxonomyTestBase
{
class
TaxonomyFieldTidTest
extends
ViewsKernelTestBase
{
use
TaxonomyTestTrait
;
/**
* Views used by this test.
*
* @var array
* {@inheritdoc}
*/
public
static
$modules
=
[
'taxonomy'
,
'taxonomy_test_views'
,
'text'
,
'filter'
];
/**
* {@inheritdoc}
*/
public
static
$testViews
=
[
'test_taxonomy_tid_field'
];
/**
* A taxonomy term to use in this test.
*
* @var \Drupal\taxonomy\TermInterface
*/
protected
$term1
;
/**
* {@inheritdoc}
*/
protected
function
setUp
(
$import_test_views
=
TRUE
)
{
parent
::
setUp
(
$import_test_views
);
$this
->
installEntitySchema
(
'taxonomy_term'
);
$this
->
installConfig
([
'filter'
]);
/** @var \Drupal\taxonomy\Entity\Vocabulary $vocabulary */
$vocabulary
=
$this
->
createVocabulary
();
$this
->
term1
=
$this
->
createTerm
(
$vocabulary
);
ViewTestData
::
createTestViews
(
get_class
(
$this
),
[
'taxonomy_test_views'
]);
}
/**
* Tests the taxonomy field handler.
*/
public
function
testViewsHandlerTidField
()
{
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer
=
\Drupal
::
service
(
'renderer'
);
...
...
@@ -29,9 +64,9 @@ public function testViewsHandlerTidField() {
$actual
=
$renderer
->
executeInRenderContext
(
new
RenderContext
(),
function
()
use
(
$view
)
{
return
$view
->
field
[
'name'
]
->
advancedRender
(
$view
->
result
[
0
]);
});
$expected
=
\Drupal
::
l
(
$this
->
term1
->
label
(),
$this
->
term1
->
toUrl
());
$expected
=
Link
::
fromTextAndUr
l
(
$this
->
term1
->
label
(),
$this
->
term1
->
toUrl
());
$this
->
assertEqual
(
$expected
,
$actual
);
$this
->
assertEqual
s
(
$expected
->
toString
()
,
$actual
);
}
}
This diff is collapsed.
Click to expand it.
Alex Pott
@alexpott
mentioned in commit
88ecbd91
·
5 years ago
mentioned in commit
88ecbd91
mentioned in commit 88ecbd912da97951fa43a72acdc02f2cf7481d11
Toggle commit list
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment