$this->assertText('Custom theme: seven. Actual theme: seven. Theme callback inheritance is being tested.','Theme callback inheritance correctly uses the administrative theme.');
$this->assertRaw('seven/style.css',"The administrative theme's CSS appears on the page.");
$this->assertText('Custom theme: seven. Actual theme: seven.','The theme callback system is correctly triggered for an administrator when the site is in maintenance mode.');
$this->assertRaw('seven/style.css',"The administrative theme's CSS appears on the page.");
$offline_message=t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.',array('@site'=>\Drupal::config('system.site')->get('name')));
$this->drupalGet('test-page');
$this->assertText($offline_message);
$this->drupalGet('menu_login_callback');
$this->assertText('This is TestControllers::testLogin.','Maintenance mode can be bypassed using an event subscriber.');
* Test that an authenticated user hitting 'user/login' gets redirected to
* 'user' and 'user/register' gets redirected to the user edit page.
*/
functiontestAuthUserUserLogin(){
$web_user=$this->drupalCreateUser(array());
$this->drupalLogin($web_user);
$this->drupalGet('user/login');
// Check that we got to 'user'.
$this->assertTrue($this->url==url('user/'.$this->loggedInUser->id(),array('absolute'=>TRUE)),"Logged-in user redirected to user on accessing user/login");
// user/register should redirect to user/UID/edit.
$this->drupalGet('user/register');
$this->assertTrue($this->url==url('user/'.$this->loggedInUser->id().'/edit',array('absolute'=>TRUE)),"Logged-in user redirected to user/UID/edit on accessing user/register");
}
/**
* Test the theme callback when it is set to use an optional theme.
$this->assertText('Custom theme: NONE. Actual theme: bartik.','The theme callback system falls back on the default theme when a theme that is not enabled is requested.');
$this->assertRaw('bartik/css/style.css',"The default theme's CSS appears on the page.");
$this->assertText('Custom theme: NONE. Actual theme: bartik.','The theme callback system falls back on the default theme when a theme that does not exist is requested.');
$this->assertRaw('bartik/css/style.css',"The default theme's CSS appears on the page.");
}
/**
* Test the theme callback when no theme is requested.
$this->assertText('Custom theme: NONE. Actual theme: bartik.','The theme callback system falls back on the default theme when no theme is requested.');
$this->assertRaw('bartik/css/style.css',"The default theme's CSS appears on the page.");
}
/**
* Test that hook_custom_theme() can control the theme of a page.
*/
functiontestHookCustomTheme(){
// Trigger hook_custom_theme() to dynamically request the Stark theme for
$this->assertText('Custom theme: seven. Actual theme: seven.','The result of hook_custom_theme() does not override what was set in a theme callback.');
$this->assertRaw('seven/style.css',"The Seven theme's CSS appears on the page.");
}
/**
* Tests for menu_link_maintain().
*/
functiontestMenuLinkMaintain(){
protectedfunctiondoTestMenuLinkMaintain(){
$admin_user=$this->drupalCreateUser(array('access content','administer site configuration'));
$this->drupalLogin($admin_user);
...
...
@@ -317,7 +174,7 @@ function testMenuLinkMaintain() {
/**
* Tests for menu_name parameter for hook_menu().
*/
functiontestMenuName(){
protectedfunctiondoTestMenuName(){
$admin_user=$this->drupalCreateUser(array('administer site configuration'));
$offline_message=t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.',array('@site'=>\Drupal::config('system.site')->get('name')));
$this->drupalGet('test-page');
$this->assertText($offline_message);
$this->drupalGet('menu_login_callback');
$this->assertText('This is TestControllers::testLogin.','Maintenance mode can be bypassed using an event subscriber.');
* Test that an authenticated user hitting 'user/login' gets redirected to
* 'user' and 'user/register' gets redirected to the user edit page.
*/
publicfunctiontestAuthUserUserLogin(){
$web_user=$this->drupalCreateUser(array());
$this->drupalLogin($web_user);
$this->drupalGet('user/login');
// Check that we got to 'user'.
$this->assertTrue($this->url==url('user/'.$this->loggedInUser->id(),array('absolute'=>TRUE)),"Logged-in user redirected to user on accessing user/login");
// user/register should redirect to user/UID/edit.
$this->drupalGet('user/register');
$this->assertTrue($this->url==url('user/'.$this->loggedInUser->id().'/edit',array('absolute'=>TRUE)),"Logged-in user redirected to user/UID/edit on accessing user/register");
$this->assertText('Custom theme: seven. Actual theme: seven. Theme callback inheritance is being tested.','Theme callback inheritance correctly uses the administrative theme.');
$this->assertRaw('seven/style.css',"The administrative theme's CSS appears on the page.");
}
/**
* Test the theme callback when the site is in maintenance mode.
$this->assertText('Custom theme: seven. Actual theme: seven.','The theme callback system is correctly triggered for an administrator when the site is in maintenance mode.');
$this->assertRaw('seven/style.css',"The administrative theme's CSS appears on the page.");
$this->assertText('Custom theme: NONE. Actual theme: bartik.','The theme callback system falls back on the default theme when a theme that is not enabled is requested.');
$this->assertRaw('bartik/css/style.css',"The default theme's CSS appears on the page.");
$this->assertText('Custom theme: NONE. Actual theme: bartik.','The theme callback system falls back on the default theme when a theme that does not exist is requested.');
$this->assertRaw('bartik/css/style.css',"The default theme's CSS appears on the page.");
}
/**
* Test the theme callback when no theme is requested.
$this->assertText('Custom theme: NONE. Actual theme: bartik.','The theme callback system falls back on the default theme when no theme is requested.');
$this->assertRaw('bartik/css/style.css',"The default theme's CSS appears on the page.");
}
/**
* Test that hook_custom_theme() can control the theme of a page.
*/
protectedfunctiondoTestHookCustomTheme(){
// Trigger hook_custom_theme() to dynamically request the Stark theme for
$this->assertText('Custom theme: seven. Actual theme: seven.','The result of hook_custom_theme() does not override what was set in a theme callback.');
$this->assertRaw('seven/style.css',"The Seven theme's CSS appears on the page.");