mirror of
https://github.com/tag1consulting/d7_to_d10_migration.git
synced 2025-09-06 00:51:22 +00:00
Initial commit
This commit is contained in:
commit
c5e731d8ae
2773 changed files with 600767 additions and 0 deletions
42
drupal7/web/modules/toolbar/toolbar.test
Normal file
42
drupal7/web/modules/toolbar/toolbar.test
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
class ToolbarTestCase extends DrupalWebTestCase {
|
||||
|
||||
protected $admin_user;
|
||||
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Toolbar',
|
||||
'description' => 'Test toolbar functionality.',
|
||||
'group' => 'Toolbar (core)',
|
||||
);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Setup users.
|
||||
$this->admin_user = $this->drupalCreateUser(array('access toolbar'));
|
||||
$this->drupalLogin($this->admin_user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests toggling the toolbar collapsed cookie.
|
||||
*/
|
||||
function testToolbarCollapsedCookie() {
|
||||
$this->drupalGet('toolbar/toggle');
|
||||
$set_cookie = $this->drupalGetHeader('set-cookie', TRUE);
|
||||
$this->assertTrue((strpos('Drupal.toolbar.collapsed=1; path=' . base_path() . '; SameSite=Lax', $set_cookie) !== FALSE), 'Toolbar cookie set to collapsed by default.');
|
||||
|
||||
// The next request should toggle the toolbar.collapsed cookie to off.
|
||||
$this->drupalGet('toolbar/toggle');
|
||||
$set_cookie = $this->drupalGetHeader('set-cookie', TRUE);
|
||||
$this->assertTrue((bool) preg_match('#Drupal.toolbar.collapsed=deleted; expires=Thu, 01.Jan.1970 00:00:01 GMT;( Max-Age=0;)? path=' . str_replace('/', '\/', base_path()) . '; SameSite=Lax#', $set_cookie), 'Toolbar cookie toggled to off (deleted).');
|
||||
|
||||
// The next request should toggle the toolbar.collapsed cookie back to 1.
|
||||
$this->drupalGet('toolbar/toggle');
|
||||
$set_cookie = $this->drupalGetHeader('set-cookie', TRUE);
|
||||
$this->assertTrue((strpos('Drupal.toolbar.collapsed=1; path=' . base_path() . '; SameSite=Lax', $set_cookie) !== FALSE), 'Toolbar cookie toggled to 1.');
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue