Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
paragraphs_gridstack
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
paragraphs_gridstack
Commits
9892b743
Commit
9892b743
authored
1 year ago
by
Bohdan Melnychuk
Committed by
Yurii Panchuk
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3417294
: Create install/uninstall test for Paragraph Gridstack
parent
cd154c32
Branches
Branches containing commit
Tags
1.0.0-beta4
Tags containing commit
1 merge request
!51
Issue #3417294: Create install/uninstall test for Paragraph Gridstack
Pipeline
#83350
canceled
1 year ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Kernel/ParagraphsGridstackBehaviorPluginTest.php
+111
-0
111 additions, 0 deletions
tests/src/Kernel/ParagraphsGridstackBehaviorPluginTest.php
with
111 additions
and
0 deletions
tests/src/Kernel/ParagraphsGridstackBehaviorPluginTest.php
0 → 100644
+
111
−
0
View file @
9892b743
<?php
namespace
Drupal\Tests\paragraphs_gridstack\Kernel
;
use
Drupal\KernelTests\KernelTestBase
;
use
Drupal\paragraphs\Entity\Paragraph
;
use
Drupal\paragraphs\Entity\ParagraphsType
;
/**
* Tests the Paragraphs Gridstack Behavior Plugin.
*
* @group paragraphs_gridstack
*/
class
ParagraphsGridstackBehaviorPluginTest
extends
KernelTestBase
{
/**
* Modules to enable.
*
* @var array
*/
protected
static
$modules
=
[
'user'
,
'file'
,
'system'
,
'node'
,
'field'
,
'field_ui'
,
'block'
,
'dblog'
,
'breakpoint'
,
'paragraphs'
,
'paragraphs_gridstack'
,
];
/**
* {@inheritdoc}
*/
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
installEntitySchema
(
'user'
);
$this
->
installEntitySchema
(
'paragraph'
);
$this
->
installSchema
(
'system'
,
[
'sequences'
]);
\Drupal
::
moduleHandler
()
->
loadInclude
(
'file'
,
'install'
);
\Drupal
::
moduleHandler
()
->
loadInclude
(
'paragraphs'
,
'install'
);
\Drupal
::
moduleHandler
()
->
loadInclude
(
'dblog'
,
'install'
);
\Drupal
::
moduleHandler
()
->
loadInclude
(
'paragraphs_gridstack'
,
'install'
);
}
/**
* Tests the behavior settings API.
*/
public
function
testBehaviorSettings
()
{
// Create a paragraph type.
$paragraph_type
=
ParagraphsType
::
create
([
'label'
=>
'test_text'
,
'id'
=>
'test_text'
,
'behavior_plugins'
=>
[
'gridstack_container'
=>
[
'enabled'
=>
TRUE
,
],
],
]);
$paragraph_type
->
save
();
// Create a paragraph and set its feature settings.
$paragraph
=
Paragraph
::
create
([
'type'
=>
'test_text'
,
]);
$feature_settings
=
[
'gridstack_container'
=>
[
'optionset'
=>
'default'
,
],
];
$paragraph
->
setAllBehaviorSettings
(
$feature_settings
);
$paragraph
->
save
();
}
/**
* Tests uninstalling a behavior plugin providing module.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
public
function
testBehaviorUninstall
()
{
// Create a paragraph type.
$paragraph_type
=
ParagraphsType
::
create
([
'label'
=>
'test_text'
,
'id'
=>
'test_text'
,
'behavior_plugins'
=>
[
'gridstack_container'
=>
[
'enabled'
=>
TRUE
,
],
],
]);
$paragraph_type
->
save
();
$dependencies
=
$paragraph_type
->
getDependencies
();
$plugins
=
$paragraph_type
->
getBehaviorPlugins
()
->
getInstanceIds
();
$this
->
assertSame
([
'module'
=>
[
'paragraphs_gridstack'
]],
$dependencies
);
$this
->
assertSame
([
'gridstack_container'
=>
'gridstack_container'
],
$plugins
);
// Uninstall plugin providing module.
$this
->
container
->
get
(
'config.manager'
)
->
uninstall
(
'module'
,
'paragraphs_gridstack'
);
$paragraph_type
=
ParagraphsType
::
load
(
'test_text'
);
$this
->
assertNotNull
(
$paragraph_type
);
$dependencies
=
$paragraph_type
->
getDependencies
();
$plugins
=
$paragraph_type
->
getBehaviorPlugins
()
->
getInstanceIds
();
$this
->
assertSame
([],
$dependencies
);
$this
->
assertSame
([],
$plugins
);
}
}
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