Issue #2384481 follow-up by larowlan: [HEAD BROKEN] Fix references to node type properties in Seven theme.
parent
b9719546df
commit
7d013683a7
|
@ -10,6 +10,7 @@ namespace Drupal\standard\Tests;
|
|||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\contact\Entity\ContactForm;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\user\Entity\Role;
|
||||
|
||||
/**
|
||||
* Tests Standard installation profile expectations.
|
||||
|
@ -22,6 +23,13 @@ class StandardTest extends WebTestBase {
|
|||
|
||||
protected $profile = 'standard';
|
||||
|
||||
/**
|
||||
* The admin user.
|
||||
*
|
||||
* @var \Drupal\user\UserInterface
|
||||
*/
|
||||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* Tests Standard installation profile.
|
||||
*/
|
||||
|
@ -32,12 +40,14 @@ class StandardTest extends WebTestBase {
|
|||
$this->assertResponse(200);
|
||||
|
||||
// Test anonymous user can access 'Main navigation' block.
|
||||
$admin = $this->drupalCreateUser(array(
|
||||
$this->adminUser = $this->drupalCreateUser(array(
|
||||
'administer blocks',
|
||||
'post comments',
|
||||
'skip comment approval',
|
||||
'create article content',
|
||||
'create page content',
|
||||
));
|
||||
$this->drupalLogin($admin);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
// Configure the block.
|
||||
$this->drupalGet('admin/structure/block/add/system_menu_block:main/bartik');
|
||||
$this->drupalPostForm(NULL, array(
|
||||
|
@ -79,7 +89,7 @@ class StandardTest extends WebTestBase {
|
|||
));
|
||||
|
||||
// Add a comment.
|
||||
$this->drupalLogin($admin);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('node/1');
|
||||
$this->drupalPostForm(NULL, array(
|
||||
'subject[0][value]' => 'Barfoo',
|
||||
|
@ -120,6 +130,17 @@ class StandardTest extends WebTestBase {
|
|||
$contact_form = ContactForm::load('feedback');
|
||||
$recipients = $contact_form->getRecipients();
|
||||
$this->assertEqual(['simpletest@example.com'], $recipients);
|
||||
|
||||
$role = Role::create([
|
||||
'id' => 'admin_theme',
|
||||
'label' => 'Admin theme',
|
||||
]);
|
||||
$role->grantPermission('view the administration theme');
|
||||
$role->save();
|
||||
$this->adminUser->addRole($role->id());
|
||||
$this->adminUser->save();
|
||||
$this->drupalGet('node/add');
|
||||
$this->assertResponse(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,10 +72,11 @@ function seven_preprocess_menu_local_task(&$variables) {
|
|||
*/
|
||||
function seven_preprocess_node_add_list(&$variables) {
|
||||
if (!empty($variables['content'])) {
|
||||
/** @var \Drupal\node\NodeTypeInterface $type */
|
||||
foreach ($variables['content'] as $type) {
|
||||
$variables['types'][$type->type]['label'] = String::checkPlain($type->name);
|
||||
$variables['types'][$type->type]['description'] = Xss::filterAdmin($type->description);
|
||||
$variables['types'][$type->type]['url'] = \Drupal::url('node.add', array('node_type' => $type->type));
|
||||
$variables['types'][$type->id()]['label'] = String::checkPlain($type->label());
|
||||
$variables['types'][$type->id()]['description'] = Xss::filterAdmin($type->getDescription());
|
||||
$variables['types'][$type->id()]['url'] = \Drupal::url('node.add', array('node_type' => $type->id()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue