Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
script_manager
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
script_manager
Commits
71325752
Commit
71325752
authored
2 years ago
by
Adam Bramley
Committed by
Adam Bramley
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3350607
by mcaddz, acbramley: Add Script form broken on Drupal 10
parent
030d9c8b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Entity/Script.php
+2
-2
2 additions, 2 deletions
src/Entity/Script.php
tests/src/Functional/ScriptManagerAdminTest.php
+81
-0
81 additions, 0 deletions
tests/src/Functional/ScriptManagerAdminTest.php
with
83 additions
and
2 deletions
src/Entity/Script.php
+
2
−
2
View file @
71325752
...
...
@@ -88,14 +88,14 @@ class Script extends ConfigEntityBase implements ScriptInterface, EntityWithPlug
* {@inheritdoc}
*/
public
function
getSnippet
():
string
{
return
$this
->
snippet
;
return
$this
->
snippet
??
''
;
}
/**
* {@inheritdoc}
*/
public
function
getPosition
():
string
{
return
$this
->
position
;
return
$this
->
position
??
''
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
tests/src/Functional/ScriptManagerAdminTest.php
0 → 100644
+
81
−
0
View file @
71325752
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\Tests\script_manager\Functional
;
use
Drupal\Core\Url
;
use
Drupal\script_manager
\Entity\Script
;
use
Drupal\script_manager
\Entity\ScriptInterface
;
use
Drupal\Tests\BrowserTestBase
;
/**
* Test the script manager admin UI.
*
* @group script_manager
*/
final
class
ScriptManagerAdminTest
extends
BrowserTestBase
{
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'script_manager'
,
'block'
,
];
/**
* {@inheritdoc}
*/
protected
$defaultTheme
=
'stark'
;
/**
* {@inheritdoc}
*/
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
drupalPlaceBlock
(
'local_actions_block'
);
}
/**
* Test the admin UI.
*/
public
function
testAdminUi
():
void
{
$this
->
drupalLogin
(
$this
->
drupalCreateUser
([
'administer scripts'
,
]));
$collectionUrl
=
Url
::
fromRoute
(
'entity.script.collection'
);
$this
->
drupalGet
(
$collectionUrl
);
$assert
=
$this
->
assertSession
();
$assert
->
statusCodeEquals
(
200
);
$assert
->
pageTextContains
(
'There are no script entities yet'
);
$assert
->
linkExists
(
'Add Script'
);
$this
->
clickLink
(
'Add Script'
);
$assert
->
statusCodeEquals
(
200
);
$this
->
submitForm
([
'label'
=>
'Foo'
,
'id'
=>
'foo'
,
'position'
=>
ScriptInterface
::
POSITION_TOP
,
'snippet'
=>
'bar'
,
],
'Save'
);
$script
=
Script
::
load
(
'foo'
);
$assert
->
addressEquals
(
$collectionUrl
->
toString
());
$assert
->
pageTextContains
(
'Foo'
);
$assert
->
linkByHrefExists
(
$script
->
toUrl
(
'edit-form'
)
->
toString
());
$assert
->
linkByHrefExists
(
$script
->
toUrl
(
'delete-form'
)
->
toString
());
$this
->
clickLink
(
'Edit'
);
$assert
->
fieldValueEquals
(
'label'
,
'Foo'
);
$assert
->
fieldValueEquals
(
'position'
,
ScriptInterface
::
POSITION_TOP
);
$assert
->
fieldValueEquals
(
'snippet'
,
'bar'
);
$this
->
drupalGet
(
$script
->
toUrl
(
'delete-form'
));
$this
->
submitForm
([],
'Delete'
);
$assert
->
pageTextContains
(
'The script Foo has been deleted.'
);
$assert
->
pageTextContains
(
'There are no script entities yet'
);
}
}
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