Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cloud-3232932
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
cloud-3232932
Commits
76f5a4f9
Commit
76f5a4f9
authored
3 years ago
by
Yutong Li
Committed by
Yas Naoi
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3230948
by yutong.li, yas, kumikoono: Add test cases for AWS Cloud Admin Setting forms
parent
f759596d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/cloud_service_providers/aws_cloud/tests/src/Functional/Config/AwsCloudAdminSettings.php
+100
-0
100 additions, 0 deletions
...oud/tests/src/Functional/Config/AwsCloudAdminSettings.php
with
100 additions
and
0 deletions
modules/cloud_service_providers/aws_cloud/tests/src/Functional/Config/AwsCloudAdminSettings.php
0 → 100644
+
100
−
0
View file @
76f5a4f9
<?php
namespace
Drupal\Tests\aws_cloud\Functional\Config
;
use
Drupal\Tests\aws_cloud
\Functional\AwsCloudTestBase
;
/**
* Test Case class for AWS Cloud Admin Setting forms.
*
* @group AWS Cloud
*/
class
AwsCloudAdminSettings
extends
AwsCloudTestBase
{
public
const
AWS_CLOUD_ADMIN_SETTINGS_REPEAT_COUNT
=
2
;
/**
* Get permissions of login user.
*
* @return array
* permissions of login user.
*/
protected
function
getPermissions
():
array
{
return
[
'administer aws_cloud'
,
'administer site configuration'
,
];
}
/**
* Test for AwsCloudAdminSettings.
*
* @param string $setting_type
* The setting type id.
*
* @throws \Behat\Mink\Exception\ResponseTextException
*/
protected
function
runAwsCloudAdminSettings
(
$setting_type
):
void
{
for
(
$i
=
0
;
$i
<
self
::
AWS_CLOUD_ADMIN_SETTINGS_REPEAT_COUNT
;
$i
++
)
{
$this
->
drupalGet
(
"/admin/config/services/cloud/aws_cloud/
{
$setting_type
}
"
);
// Asserting no warning or error message.
$this
->
assertNoErrorMessage
();
}
}
/**
* Test AWS Cloud Admin Setting forms on location.
*/
public
function
testAwsCloudAdminLocationSettings
():
void
{
$this
->
runAwsCloudAdminSettings
(
'location'
);
// Input some value of the fields and save.
$config_factory
=
\Drupal
::
configFactory
();
$config
=
$config_factory
->
getEditable
(
'aws_cloud.settings'
);
$config
->
set
(
'aws_cloud_region_locations'
,
$config
->
get
(
strtolower
(
'aws_cloud_region_locations'
))
);
$config
->
save
();
$this
->
runAwsCloudAdminSettings
(
'location'
);
}
/**
* Test AWS Cloud Admin Setting forms on notification.
*/
public
function
testAwsCloudAdminNotificationSettings
():
void
{
$this
->
runAwsCloudAdminSettings
(
'notification'
);
// Input some value of the fields and save.
$config_factory
=
\Drupal
::
configFactory
();
$config
=
$config_factory
->
getEditable
(
'aws_cloud.settings'
);
$config
->
set
(
'aws_cloud_long_running_instance_notification'
,
!
$config
->
get
(
'aws_cloud_long_running_instance_notification'
)
);
$config
->
save
();
$this
->
runAwsCloudAdminSettings
(
'notification'
);
}
/**
* Test AWS Cloud Admin Setting forms on settings.
*/
public
function
testAwsCloudAdminSettings
():
void
{
$this
->
runAwsCloudAdminSettings
(
'settings'
);
// Input some value of the fields and save.
$config_factory
=
\Drupal
::
configFactory
();
$config
=
$config_factory
->
getEditable
(
'aws_cloud.settings'
);
$config
->
set
(
'aws_cloud_instance_terminate'
,
!
$config
->
get
(
'aws_cloud_instance_terminate'
)
);
$config
->
save
();
$this
->
runAwsCloudAdminSettings
(
'settings'
);
}
}
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