Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c5d0a8ef
Commit
c5d0a8ef
authored
Apr 14, 2013
by
Alex Pott
Browse files
Issue
#630446
by alexpott, David_Rothstein: Allow SimpleTest to test the non-interactive installer.
parent
dc8aeca0
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
View file @
c5d0a8ef
...
...
@@ -737,43 +737,13 @@ protected function setUp() {
// @see drupal_system_listing()
$conf
[
'simpletest_parent_profile'
]
=
$this
->
originalProfile
;
// Set installer parameters.
// @see install.php, install.core.inc
$connection_info
=
Database
::
getConnectionInfo
();
// Define information about the user 1 account.
$this
->
root_user
=
(
object
)
array
(
'uid'
=>
1
,
'name'
=>
'admin'
,
'mail'
=>
'admin@example.com'
,
'pass_raw'
=>
$this
->
randomName
(),
);
$settings
=
array
(
'interactive'
=>
FALSE
,
'parameters'
=>
array
(
'profile'
=>
$this
->
profile
,
'langcode'
=>
'en'
,
),
'forms'
=>
array
(
'install_settings_form'
=>
$connection_info
[
'default'
],
'install_configure_form'
=>
array
(
'site_name'
=>
'Drupal'
,
'site_mail'
=>
'simpletest@example.com'
,
'account'
=>
array
(
'name'
=>
$this
->
root_user
->
name
,
'mail'
=>
$this
->
root_user
->
mail
,
'pass'
=>
array
(
'pass1'
=>
$this
->
root_user
->
pass_raw
,
'pass2'
=>
$this
->
root_user
->
pass_raw
,
),
),
// form_type_checkboxes_value() requires NULL instead of FALSE values
// for programmatic form submissions to disable a checkbox.
'update_status_module'
=>
array
(
1
=>
NULL
,
2
=>
NULL
,
),
),
),
);
// Reset the static batch to remove Simpletest's batch operations.
$batch
=
&
batch_get
();
...
...
@@ -796,7 +766,8 @@ protected function setUp() {
// Execute the non-interactive installer.
require_once
DRUPAL_ROOT
.
'/core/includes/install.core.inc'
;
$this
->
settingsSet
(
'cache'
,
array
(
'default'
=>
'cache.backend.memory'
));
install_drupal
(
$settings
);
$parameters
=
$this
->
installParameters
();
install_drupal
(
$parameters
);
$this
->
settingsSet
(
'cache'
,
array
());
$this
->
rebuildContainer
();
...
...
@@ -854,6 +825,45 @@ protected function setUp() {
$this
->
setup
=
TRUE
;
}
/**
* Returns the parameters that will be used when Simpletest installs Drupal.
*
* @see install_drupal()
* @see install_state_defaults()
*/
protected
function
installParameters
()
{
$connection_info
=
Database
::
getConnectionInfo
();
$parameters
=
array
(
'interactive'
=>
FALSE
,
'parameters'
=>
array
(
'profile'
=>
$this
->
profile
,
'langcode'
=>
'en'
,
),
'forms'
=>
array
(
'install_settings_form'
=>
$connection_info
[
'default'
],
'install_configure_form'
=>
array
(
'site_name'
=>
'Drupal'
,
'site_mail'
=>
'simpletest@example.com'
,
'account'
=>
array
(
'name'
=>
$this
->
root_user
->
name
,
'mail'
=>
$this
->
root_user
->
mail
,
'pass'
=>
array
(
'pass1'
=>
$this
->
root_user
->
pass_raw
,
'pass2'
=>
$this
->
root_user
->
pass_raw
,
),
),
// form_type_checkboxes_value() requires NULL instead of FALSE values
// for programmatic form submissions to disable a checkbox.
'update_status_module'
=>
array
(
1
=>
NULL
,
2
=>
NULL
,
),
),
),
);
return
$parameters
;
}
/**
* Writes a test-specific settings.php file for the child site.
*
...
...
core/modules/system/lib/Drupal/system/Tests/
Common
/InstallerLanguageTest.php
→
core/modules/system/lib/Drupal/system/Tests/
Installer
/InstallerLanguageTest.php
View file @
c5d0a8ef
...
...
@@ -2,10 +2,10 @@
/**
* @file
* Definition of Drupal\system\Tests\
Common
\InstallerLanguageTest.
* Definition of Drupal\system\Tests\
Installer
\InstallerLanguageTest.
*/
namespace
Drupal\system\Tests\
Common
;
namespace
Drupal\system\Tests\
Installer
;
use
Drupal\simpletest\WebTestBase
;
...
...
core/modules/system/lib/Drupal/system/Tests/Installer/SiteNameTest.php
0 → 100644
View file @
c5d0a8ef
<?php
/**
* @file
* Contains \Drupal\system\Tests\Installer\SiteNameTest.
*/
namespace
Drupal\system\Tests\Installer
;
use
Drupal\simpletest\WebTestBase
;
/**
* Tests that the site name can be set during a non-interactive installation.
*/
class
SiteNameTest
extends
WebTestBase
{
/**
* The site name to be used when testing.
*
* @var string
*/
protected
$siteName
;
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Site name (non-interactive)'
,
'description'
=>
'Tests that the site name can be set during a non-interactive installation.'
,
'group'
=>
'Installer'
,
);
}
/**
* Overrides \Drupal\simpletest\WebTestBase::installParameters().
*/
protected
function
installParameters
()
{
$this
->
siteName
=
$this
->
randomName
();
$parameters
=
parent
::
installParameters
();
$parameters
[
'forms'
][
'install_configure_form'
][
'site_name'
]
=
$this
->
siteName
;
return
$parameters
;
}
/**
* Tests that the desired site name appears on the page after installation.
*/
function
testSiteName
()
{
$this
->
drupalGet
(
''
);
$this
->
assertRaw
(
$this
->
siteName
,
'The site name that was set during the installation appears on the front page after installation.'
);
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment