Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
field_lock_multi_values
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
field_lock_multi_values
Commits
f4795635
Commit
f4795635
authored
4 months ago
by
Kurucz István
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3496287
by nevergone: Test "Hide previous value" feature
parent
f6748544
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Functional/TestHidePreviousValue.php
+54
-0
54 additions, 0 deletions
tests/src/Functional/TestHidePreviousValue.php
with
54 additions
and
0 deletions
tests/src/Functional/TestHidePreviousValue.php
0 → 100644
+
54
−
0
View file @
f4795635
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\Tests\field_lock_multi_values\Functional
;
use
PHPUnit\Framework\Attributes\Group
;
/**
* Generic test base class.
*/
#[Group('field_lock_multi_values')]
class
TestLockPreviousValue
extends
TestBase
{
public
function
testLockPreviousValue
()
{
$page
=
$this
->
getSession
()
->
getPage
();
// Submit a test node.
$delta
=
4
;
$this
->
drupalGet
(
'/node/add/page'
);
for
(
$i
=
0
;
$i
<
$delta
;
$i
++
)
{
$this
->
submitForm
([],
'Add another item'
);
}
$edit
=
[
'edit-title-0-value'
=>
$this
->
randomMachineName
(),
];
for
(
$i
=
0
;
$i
<=
$delta
;
$i
++
)
{
$edit
[
"
{
$this
->
field_id
}
[
$i
][value]"
]
=
$this
->
randomMachineName
();
$edit
[
"
{
$this
->
field_id
}
[
$i
][_weight]"
]
=
$i
;
}
$this
->
submitForm
(
$edit
,
'Save'
);
// Test node edit form with original functionality.
$this
->
drupalGet
(
'/node/1/edit'
);
for
(
$i
=
0
;
$i
<=
$delta
;
$i
++
)
{
$disabled
=
$page
->
findById
(
"edit-field-string-textfield-
$i
-value"
)
->
getAttribute
(
'disabled'
);
$this
->
assertEquals
(
''
,
$disabled
);
}
// TODO: check!
// enable "Lock Previous Value" feature.
$this
->
drupalGet
(
'/admin/structure/types/manage/page/form-display'
);
$this
->
click
(
'#edit-fields-field-string-textfield-settings-edit'
);
$page
->
checkField
(
'Lock previous value'
);
$this
->
submitForm
([],
'Update'
);
$this
->
submitForm
([],
'Save'
);
// Test node edit form with updated functionality.
$this
->
drupalGet
(
'/node/1/edit'
);
for
(
$i
=
0
;
$i
<=
$delta
;
$i
++
)
{
$disabled
=
$page
->
findById
(
"edit-field-string-textfield-
$i
-value"
)
->
getAttribute
(
'disabled'
);
$this
->
assertEquals
(
'disabled'
,
$disabled
);
}
}
}
This diff is collapsed.
Click to expand it.
Kurucz István
@nevergone
mentioned in commit
03975890
·
4 months ago
mentioned in commit
03975890
mentioned in commit 0397589066f35a640cac2a4d0845ae1b4a406c07
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