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
674251e8
Unverified
Commit
674251e8
authored
5 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3042877
by claudiu.cristea, Lendude: Convert ArgumentValidatorTermTest into a Kernel test
parent
603f0d4c
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/ArgumentValidatorTermTest.php
+13
-18
13 additions, 18 deletions
...nomy/tests/src/Kernel/Views/ArgumentValidatorTermTest.php
with
13 additions
and
18 deletions
core/modules/taxonomy/tests/src/
Functiona
l/Views/ArgumentValidatorTermTest.php
→
core/modules/taxonomy/tests/src/
Kerne
l/Views/ArgumentValidatorTermTest.php
+
13
−
18
View file @
674251e8
<?php
namespace
Drupal\Tests\taxonomy\
Functiona
l\Views
;
namespace
Drupal\Tests\taxonomy\
Kerne
l\Views
;
use
Drupal\views\Views
;
...
...
@@ -8,7 +8,8 @@
* Tests the plugin of the taxonomy: term argument validator.
*
* @group taxonomy
* @see Views\taxonomy\Plugin\views\argument_validator\Term
*
* @see \Drupal\taxonomy\Plugin\views\argument_validator\Term
*/
class
ArgumentValidatorTermTest
extends
TaxonomyTestBase
{
...
...
@@ -34,19 +35,13 @@ class ArgumentValidatorTermTest extends TaxonomyTestBase {
protected
$ids
=
[];
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public
static
$
modules
=
[
'taxonomy'
,
'taxonomy_test_views'
,
'views_test_config
'
];
public
static
$
testViews
=
[
'test_argument_validator_term
'
];
/**
* Views used by this test.
*
* @var array
* {@inheritdoc}
*/
public
static
$testViews
=
[
'test_argument_validator_term'
];
protected
function
setUp
(
$import_test_views
=
TRUE
)
{
parent
::
setUp
(
$import_test_views
);
...
...
@@ -71,14 +66,14 @@ public function testArgumentValidatorTerm() {
// Pass in a single valid term.
foreach
(
$this
->
terms
as
$term
)
{
$this
->
assertTrue
(
$view
->
argument
[
'tid'
]
->
setArgument
(
$term
->
id
()));
$this
->
assertEqual
(
$view
->
argument
[
'tid'
]
->
getTitle
()
,
$term
->
label
()
);
$this
->
assertEqual
s
(
$term
->
label
(),
$view
->
argument
[
'tid'
]
->
getTitle
());
$view
->
argument
[
'tid'
]
->
validated_title
=
NULL
;
$view
->
argument
[
'tid'
]
->
argument_validated
=
NULL
;
}
// Pass in a invalid term.
$this
->
assertFalse
(
$view
->
argument
[
'tid'
]
->
setArgument
(
rand
(
1000
,
10000
)));
$this
->
assertE
qual
(
''
,
$view
->
argument
[
'tid'
]
->
getTitle
());
$this
->
assertE
mpty
(
$view
->
argument
[
'tid'
]
->
getTitle
());
$view
->
argument
[
'tid'
]
->
validated_title
=
NULL
;
$view
->
argument
[
'tid'
]
->
argument_validated
=
NULL
;
...
...
@@ -88,31 +83,31 @@ public function testArgumentValidatorTerm() {
// Pass in a single term.
$this
->
assertTrue
(
$view
->
argument
[
'tid'
]
->
setArgument
(
$this
->
terms
[
0
]
->
id
()));
$this
->
assertEqual
(
$view
->
argument
[
'tid'
]
->
getTitle
()
,
$this
->
terms
[
0
]
->
label
()
);
$this
->
assertEqual
s
(
$this
->
terms
[
0
]
->
label
(),
$view
->
argument
[
'tid'
]
->
getTitle
());
$view
->
argument
[
'tid'
]
->
validated_title
=
NULL
;
$view
->
argument
[
'tid'
]
->
argument_validated
=
NULL
;
// Check for multiple valid terms separated by commas.
$this
->
assertTrue
(
$view
->
argument
[
'tid'
]
->
setArgument
(
implode
(
','
,
$this
->
ids
)));
$this
->
assertEqual
(
$view
->
argument
[
'tid'
]
->
getTitle
()
,
implode
(
', '
,
$this
->
names
)
);
$this
->
assertEqual
s
(
implode
(
', '
,
$this
->
names
),
$view
->
argument
[
'tid'
]
->
getTitle
());
$view
->
argument
[
'tid'
]
->
validated_title
=
NULL
;
$view
->
argument
[
'tid'
]
->
argument_validated
=
NULL
;
// Check for multiple valid terms separated by plus signs.
$this
->
assertTrue
(
$view
->
argument
[
'tid'
]
->
setArgument
(
implode
(
'+'
,
$this
->
ids
)));
$this
->
assertEqual
(
$view
->
argument
[
'tid'
]
->
getTitle
()
,
implode
(
' + '
,
$this
->
names
)
);
$this
->
assertEqual
s
(
implode
(
' + '
,
$this
->
names
),
$view
->
argument
[
'tid'
]
->
getTitle
());
$view
->
argument
[
'tid'
]
->
validated_title
=
NULL
;
$view
->
argument
[
'tid'
]
->
argument_validated
=
NULL
;
// Check for a single invalid term.
$this
->
assertFalse
(
$view
->
argument
[
'tid'
]
->
setArgument
(
rand
(
1000
,
10000
)));
$this
->
assertE
qual
(
''
,
$view
->
argument
[
'tid'
]
->
getTitle
());
$this
->
assertE
mpty
(
$view
->
argument
[
'tid'
]
->
getTitle
());
$view
->
argument
[
'tid'
]
->
validated_title
=
NULL
;
$view
->
argument
[
'tid'
]
->
argument_validated
=
NULL
;
// Check for multiple invalid terms.
$this
->
assertFalse
(
$view
->
argument
[
'tid'
]
->
setArgument
(
implode
(
','
,
[
rand
(
1000
,
10000
),
rand
(
1000
,
10000
)])));
$this
->
assertE
qual
(
''
,
$view
->
argument
[
'tid'
]
->
getTitle
());
$this
->
assertE
mpty
(
$view
->
argument
[
'tid'
]
->
getTitle
());
$view
->
argument
[
'tid'
]
->
validated_title
=
NULL
;
$view
->
argument
[
'tid'
]
->
argument_validated
=
NULL
;
}
...
...
This diff is collapsed.
Click to expand it.
Alex Pott
@alexpott
mentioned in commit
4ae5c313
·
5 years ago
mentioned in commit
4ae5c313
mentioned in commit 4ae5c313eb530d432047a876bd0a8149b00c94ea
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