Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
config_ignore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
3
Merge Requests
3
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
config_ignore
Commits
0c333406
Commit
0c333406
authored
Jan 21, 2017
by
tlyngej
Committed by
tlyngej
Jan 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2832671
by tlyngej, jrockowitz: Add tests
parent
b4ded9af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
0 deletions
+106
-0
src/Tests/ConfigIgnoreSettingsTest.php
src/Tests/ConfigIgnoreSettingsTest.php
+40
-0
src/Tests/ConfigIgnoreTest.php
src/Tests/ConfigIgnoreTest.php
+66
-0
No files found.
src/Tests/ConfigIgnoreSettingsTest.php
0 → 100644
View file @
0c333406
<?php
namespace
Drupal\config_ignore\Tests
;
use
Drupal\simpletest\WebTestBase
;
/**
* Class ConfigIgnoreSettingsTest.
*
* @package Drupal\config_ignore\Tests
* @group config_ignore
*/
class
ConfigIgnoreSettingsTest
extends
WebTestBase
{
/**
* Modules to enable.
*
* @var array
*/
public
static
$modules
=
[
'config_ignore'
];
/**
* Verify that the settings form works.
*/
public
function
testSettingsForm
()
{
// Login with a user that has permission to import config.
$this
->
drupalLogin
(
$this
->
drupalCreateUser
([
'import configuration'
]));
$edit
=
[
'ignored_config_entities'
=>
'config.test'
,
];
$this
->
drupalPostForm
(
'admin/config/development/configuration/ignore'
,
$edit
,
t
(
'Save configuration'
));
$settings
=
$this
->
config
(
'config_ignore.settings'
)
->
get
(
'ignored_config_entities'
);
$this
->
assertEqual
(
$settings
,
[
'config.test'
]);
}
}
src/Tests/ConfigIgnoreTest.php
0 → 100644
View file @
0c333406
<?php
namespace
Drupal\config_ignore\Tests
;
use
Drupal\simpletest\WebTestBase
;
use
Drupal\Core\Serialization\Yaml
;
/**
* Class ConfigIgnoreTest.
*
* @package Drupal\config_ignore\Tests
* @group config_ignore
*/
class
ConfigIgnoreTest
extends
WebTestBase
{
/**
* Modules to enable.
*
* @var array
*/
public
static
$modules
=
[
'config_ignore'
];
/**
* The profile to install as a basis for testing.
*
* We need to change it form the standard 'testing' profile as that will not
* print the title on the page, which we use for testing.
*
* @var string
*/
protected
$profile
=
'minimal'
;
/**
* Verify that config can get ignored.
*/
public
function
testValidateIgnoring
()
{
// Login with a user that has permission to import config.
$this
->
drupalLogin
(
$this
->
drupalCreateUser
([
'import configuration'
]));
// Set the site name to a known value that we later will try and overwrite.
$this
->
config
(
'system.site'
)
->
set
(
'name'
,
'Test import'
)
->
save
();
// Set the system.site:name to be ignored upon config import.
$this
->
config
(
'config_ignore.settings'
)
->
set
(
'ignored_config_entities'
,
[
'system.site'
])
->
save
();
// Assemble a change that will try and override the current value.
$config
=
$this
->
config
(
'system.site'
)
->
set
(
'name'
,
'Import has changed title'
);
$edit
=
[
'config_type'
=>
'system.simple'
,
'config_name'
=>
$config
->
getName
(),
'import'
=>
Yaml
::
encode
(
$config
->
get
()),
];
// Submit a new single item config, with the changes.
$this
->
drupalPostForm
(
'admin/config/development/configuration/single/import'
,
$edit
,
t
(
'Import'
));
$this
->
drupalPostForm
(
NULL
,
array
(),
t
(
'Confirm'
));
// Validate if the title from the imported config was rejected.
$this
->
assertText
(
'Test import'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment