Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3421017
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3421017
Commits
cf174d10
Verified
Commit
cf174d10
authored
1 year ago
by
Dave Long
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3422040
by mondrake: Make remaining Drupal\Tests\Core\Form data providers, static
parent
4ec07d68
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
+5
-5
5 additions, 5 deletions
...sts/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
core/tests/Drupal/Tests/Core/Form/SubformStateTest.php
+10
-10
10 additions, 10 deletions
core/tests/Drupal/Tests/Core/Form/SubformStateTest.php
with
15 additions
and
15 deletions
core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
+
5
−
5
View file @
cf174d10
...
...
@@ -950,7 +950,7 @@ public function testSet($key, $value) {
/**
* Provides data to self::testSet().
*/
public
function
providerSet
()
{
public
static
function
providerSet
()
:
array
{
return
[
[
'FOO'
,
'BAR'
],
[
'FOO'
,
NULL
],
...
...
@@ -987,7 +987,7 @@ public function testGet($key, $value = NULL) {
/**
* Provides data to self::testGet().
*/
public
function
providerGet
()
{
public
static
function
providerGet
()
:
array
{
return
[
[
'FOO'
,
'BAR'
],
[
'FOO'
,
NULL
],
...
...
@@ -1017,7 +1017,7 @@ public function testHas($exists, $key) {
/**
* Provides data to self::testHas().
*/
public
function
providerHas
()
{
public
static
function
providerHas
()
:
array
{
return
[
[
TRUE
,
'FOO'
],
[
FALSE
,
'FOO'
],
...
...
@@ -1445,13 +1445,13 @@ public function testPrepareCallback($unprepared_callback, callable $prepared_cal
/**
* Provides data to self::testPrepareCallback().
*/
public
function
providerPrepareCallback
()
{
public
static
function
providerPrepareCallback
()
:
array
{
$function
=
'sleep'
;
$shorthand_form_method
=
'::submit()'
;
$closure
=
function
()
{};
$static_method_string
=
__METHOD__
;
$static_method_array
=
[
__CLASS__
,
__FUNCTION__
];
$object_method_array
=
[
$this
,
__FUNCTION__
];
$object_method_array
=
[
new
static
()
,
__FUNCTION__
];
return
[
// A shorthand form method is generally expanded to become a method on an
...
...
This diff is collapsed.
Click to expand it.
core/tests/Drupal/Tests/Core/Form/SubformStateTest.php
+
10
−
10
View file @
cf174d10
...
...
@@ -24,7 +24,7 @@ class SubformStateTest extends UnitTestCase {
*
* @var mixed[]
*/
protected
$formStateValues
=
[
protected
static
$formStateValues
=
[
'foo'
=>
'bar'
,
'dog'
=>
[
'breed'
=>
'Pit bull'
,
...
...
@@ -70,7 +70,7 @@ class SubformStateTest extends UnitTestCase {
*/
public
function
testGetValues
(
array
$parents
,
$expected
)
{
$parent_form_state
=
new
FormState
();
$parent_form_state
->
setValues
(
$this
->
formStateValues
);
$parent_form_state
->
setValues
(
static
::
$
formStateValues
);
$subform
=
NestedArray
::
getValue
(
$this
->
parentForm
,
$parents
);
$subform_state
=
SubformState
::
createForSubform
(
$subform
,
$this
->
parentForm
,
$parent_form_state
);
...
...
@@ -86,11 +86,11 @@ public function testGetValues(array $parents, $expected) {
/**
* Provides data to self::testGetValues().
*/
public
function
providerGetValues
()
{
public
static
function
providerGetValues
()
:
array
{
$data
=
[];
$data
[
'exist'
]
=
[
[
'dog'
],
$this
->
formStateValues
[
'dog'
],
static
::
$
formStateValues
[
'dog'
],
];
return
$data
;
...
...
@@ -115,11 +115,11 @@ public function testGetValuesBroken(array $parents, $expected) {
/**
* Provides data to self::testGetValuesBroken().
*/
public
function
providerGetValuesBroken
()
{
public
static
function
providerGetValuesBroken
()
:
array
{
$data
=
[];
$data
[
'exist'
]
=
[
[
'foo'
],
$this
->
formStateValues
[
'foo'
],
static
::
$
formStateValues
[
'foo'
],
];
$data
[
'nested'
]
=
[
[
'dog'
,
'name'
],
...
...
@@ -136,7 +136,7 @@ public function providerGetValuesBroken() {
*/
public
function
testGetValue
(
$parents
,
$key
,
$expected
,
$default
=
NULL
)
{
$parent_form_state
=
new
FormState
();
$parent_form_state
->
setValues
(
$this
->
formStateValues
);
$parent_form_state
->
setValues
(
static
::
$
formStateValues
);
$subform
=
NestedArray
::
getValue
(
$this
->
parentForm
,
$parents
);
$subform_state
=
SubformState
::
createForSubform
(
$subform
,
$this
->
parentForm
,
$parent_form_state
);
...
...
@@ -194,7 +194,7 @@ public static function providerTestGetValueBroken() {
*/
public
function
testSetValues
(
$parents
,
$new_values
,
$expected
)
{
$parent_form_state
=
new
FormState
();
$parent_form_state
->
setValues
(
$this
->
formStateValues
);
$parent_form_state
->
setValues
(
static
::
$
formStateValues
);
$subform
=
NestedArray
::
getValue
(
$this
->
parentForm
,
$parents
);
$subform_state
=
SubformState
::
createForSubform
(
$subform
,
$this
->
parentForm
,
$parent_form_state
);
...
...
@@ -231,14 +231,14 @@ public function testSetValuesBroken($parents, $new_values, $expected) {
/**
* Provides data to self::testSetValuesBroken().
*/
public
function
providerTestSetValuesBroken
()
{
public
static
function
providerTestSetValuesBroken
()
:
array
{
$data
=
[];
$data
[
'exist'
]
=
[
[
'foo'
],
[],
[
'foo'
=>
[],
'dog'
=>
$this
->
formStateValues
[
'dog'
],
'dog'
=>
static
::
$
formStateValues
[
'dog'
],
],
];
return
$data
;
...
...
This diff is collapsed.
Click to expand it.
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