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
30b45478
Unverified
Commit
30b45478
authored
5 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3042538
by claudiu.cristea, Lendude: Convert ArgumentDefaultTest into a kernel test
parent
de09969b
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/user/tests/src/Kernel/Views/ArgumentDefaultTest.php
+57
-0
57 additions, 0 deletions
...dules/user/tests/src/Kernel/Views/ArgumentDefaultTest.php
with
57 additions
and
0 deletions
core/modules/user/tests/src/
Functiona
l/Views/ArgumentDefaultTest.php
→
core/modules/user/tests/src/
Kerne
l/Views/ArgumentDefaultTest.php
+
57
−
0
View file @
30b45478
<?php
namespace
Drupal\Tests\user\
Functiona
l\Views
;
namespace
Drupal\Tests\user\
Kerne
l\Views
;
use
Drupal\KernelTests\KernelTestBase
;
use
Drupal\Tests\user\Traits\UserCreationTrait
;
use
Drupal\views\Tests\ViewTestData
;
use
Drupal\views\Views
;
/**
...
...
@@ -9,7 +12,20 @@
*
* @group user
*/
class
ArgumentDefaultTest
extends
UserTestBase
{
class
ArgumentDefaultTest
extends
KernelTestBase
{
use
UserCreationTrait
;
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'node'
,
'system'
,
'user'
,
'user_test_views'
,
'views'
,
];
/**
* Views used by this test.
...
...
@@ -18,19 +34,24 @@ class ArgumentDefaultTest extends UserTestBase {
*/
public
static
$testViews
=
[
'test_plugin_argument_default_current_user'
];
public
function
test_plugin_argument_default_current_user
()
{
/**
* Tests the current user with argument default.
*/
public
function
testPluginArgumentDefaultCurrentUser
()
{
$this
->
installSchema
(
'system'
,
[
'sequences'
]);
$this
->
installEntitySchema
(
'user'
);
ViewTestData
::
createTestViews
(
get_class
(
$this
),
[
'user_test_views'
]);
// Create a user to test.
$account
=
$this
->
drupalC
reateUser
();
$account
=
$this
->
c
reateUser
();
// Switch the user.
\Drupal
::
service
(
'account_switcher'
)
->
switchTo
(
$account
);
$this
->
container
->
get
(
'account_switcher'
)
->
switchTo
(
$account
);
$view
=
Views
::
getView
(
'test_plugin_argument_default_current_user'
);
$view
->
initHandlers
();
$this
->
assertEqual
(
$view
->
argument
[
'null'
]
->
getDefaultArgument
(),
$account
->
id
(),
'Uid of the current user is used.'
);
// Switch back.
\Drupal
::
service
(
'account_switcher'
)
->
switchBack
();
$this
->
assertEquals
(
$account
->
id
(),
$view
->
argument
[
'null'
]
->
getDefaultArgument
(),
'Uid of the current user is used.'
);
}
}
This diff is collapsed.
Click to expand it.
Alex Pott
@alexpott
mentioned in commit
056ceebf
·
5 years ago
mentioned in commit
056ceebf
mentioned in commit 056ceebf5894530157779e1c0346254e78a1d8b8
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