Issue #1811648 by xjm: Remove SimpleTestTest dependency on the node frontpage.

8.0.x
webchick 2012-10-12 20:58:32 -07:00
parent 6d5b0fffa9
commit cb1248b363
1 changed files with 18 additions and 6 deletions

View File

@ -30,6 +30,13 @@ class SimpleTestTest extends WebTestBase {
*/ */
protected $test_ids = array(); protected $test_ids = array();
/**
* The administrative user account to use during testing.
*
* @var Drupal\user\User
*/
protected $admin_user;
public static function getInfo() { public static function getInfo() {
return array( return array(
'name' => 'SimpleTest functionality', 'name' => 'SimpleTest functionality',
@ -41,9 +48,9 @@ class SimpleTestTest extends WebTestBase {
function setUp() { function setUp() {
if (!$this->inCURL()) { if (!$this->inCURL()) {
parent::setUp(); parent::setUp();
// Create and login user // Create and log in an admin user.
$admin_user = $this->drupalCreateUser(array('administer unit tests')); $this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
$this->drupalLogin($admin_user); $this->drupalLogin($this->admin_user);
} }
else { else {
self::$modules = array('non_existent_module'); self::$modules = array('non_existent_module');
@ -57,10 +64,15 @@ class SimpleTestTest extends WebTestBase {
function testInternalBrowser() { function testInternalBrowser() {
global $conf; global $conf;
if (!$this->inCURL()) { if (!$this->inCURL()) {
$this->drupalGet('node'); // Retrieve the user page and check its title and headers.
$this->drupalGet('user');
$this->assertTrue($this->drupalGetHeader('Date'), t('An HTTP header was received.')); $this->assertTrue($this->drupalGetHeader('Date'), t('An HTTP header was received.'));
$this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => config('system.site')->get('name'))), t('Site title matches.')); $this->assertTitle(t('@user | @site-name', array(
$this->assertNoTitle('Foo', t('Site title does not match.')); '@user' => $this->admin_user->name,
'@site-name' => config('system.site')->get('name'),
)));
$this->assertNoTitle('Foo');
// Make sure that we are locked out of the installer when prefixing // Make sure that we are locked out of the installer when prefixing
// using the user-agent header. This is an important security check. // using the user-agent header. This is an important security check.
global $base_url; global $base_url;