Commit ff7473e8 authored by alexpott's avatar alexpott

Issue #2384481 by rpayanm, daffie, tadityar, hussainweb, areke,...

Issue #2384481 by rpayanm, daffie, tadityar, hussainweb, areke, claudiu.cristea: Make the class variables protected for NodeType
parent 1b2e7c45
......@@ -68,10 +68,10 @@ protected function setUp() {
// Add a node of the new content type.
$node_data = array(
'type' => $content_type->type,
'type' => $content_type->id(),
);
$this->container->get('comment.manager')->addDefaultField('node', $content_type->type);
$this->container->get('comment.manager')->addDefaultField('node', $content_type->id());
$this->node = $this->drupalCreateNode($node_data);
// Force a flush of the in-memory storage.
......
......@@ -110,18 +110,18 @@ public function testExportImport() {
$this->fieldStorage->save();
entity_create('field_config', array(
'field_storage' => $this->fieldStorage,
'bundle' => $this->contentType->type,
'bundle' => $this->contentType->id(),
))->save();
entity_get_form_display('node', $this->contentType->type, 'default')
entity_get_form_display('node', $this->contentType->id(), 'default')
->setComponent($this->fieldName, array(
'type' => 'text_textfield',
))
->save();
entity_get_display('node', $this->contentType->type, 'full')
entity_get_display('node', $this->contentType->id(), 'full')
->setComponent($this->fieldName)
->save();
$this->drupalGet('node/add/' . $this->contentType->type);
$this->drupalGet('node/add/' . $this->contentType->id());
$this->assertFieldByName("{$this->fieldName}[0][value]", '', 'Widget is displayed');
// Export the configuration.
......@@ -146,7 +146,7 @@ public function testExportImport() {
$field_storage->delete();
}
}
$this->drupalGet('node/add/' . $this->contentType->type);
$this->drupalGet('node/add/' . $this->contentType->id());
$this->assertNoFieldByName("{$this->fieldName}[0][value]", '', 'Widget is not displayed');
// Import the configuration.
......
......@@ -48,7 +48,7 @@ protected function setUp() {
// Create a content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test';
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
$this->type = $type->type;
$this->type = $type->id();
}
/**
......
......@@ -39,10 +39,10 @@ protected function setUp() {
// Create "referencing" and "referenced" node types.
$referencing = $this->drupalCreateContentType();
$this->referencingType = $referencing->type;
$this->referencingType = $referencing->id();
$referenced = $this->drupalCreateContentType();
$this->referencedType = $referenced->type;
$this->referencedType = $referenced->id();
entity_create('field_storage_config', array(
'field_name' => 'test_field',
......@@ -60,13 +60,13 @@ protected function setUp() {
'label' => 'Entity reference field',
'field_name' => 'test_field',
'entity_type' => 'node',
'bundle' => $referencing->type,
'bundle' => $referencing->id(),
'settings' => array(
'handler' => 'default',
'handler_settings' => array(
// Reference a single vocabulary.
'target_bundles' => array(
$referenced->type,
$referenced->id(),
),
// Enable auto-create.
'auto_create' => TRUE,
......@@ -74,10 +74,10 @@ protected function setUp() {
),
))->save();
entity_get_display('node', $referencing->type, 'default')
entity_get_display('node', $referencing->id(), 'default')
->setComponent('test_field')
->save();
entity_get_form_display('node', $referencing->type, 'default')
entity_get_form_display('node', $referencing->id(), 'default')
->setComponent('test_field', array(
'type' => 'entity_reference_autocomplete',
))
......
......@@ -194,7 +194,7 @@ protected function setUpEntityReferenceField() {
entity_create('field_config', array(
'field_name' => $this->referenceFieldName,
'bundle' => $this->referrerType->type,
'bundle' => $this->referrerType->id(),
'entity_type' => $this->testEntityTypeName,
))
->save();
......
......@@ -23,7 +23,7 @@ class SelectionTest extends WebTestBase {
*/
public function testSelectionHandler() {
// Create nodes.
$type = $this->drupalCreateContentType()->type;
$type = $this->drupalCreateContentType()->id();
$node1 = $this->drupalCreateNode(array('type' => $type));
$node2 = $this->drupalCreateNode(array('type' => $type));
$node3 = $this->drupalCreateNode();
......
......@@ -43,7 +43,7 @@ protected function setUp() {
// Create content type.
$content_type_info = $this->drupalCreateContentType();
$content_type = $content_type_info->type;
$content_type = $content_type_info->id();
$field_storage = array(
'field_name' => 'test_view_field',
......
......@@ -280,7 +280,7 @@ public function testRenameDeleteBundle() {
// Rename the article bundle and assert the entity display is renamed.
$type->old_type = 'article';
$type->type = 'article_rename';
$type->set('type', 'article_rename');
$type->save();
$old_display = entity_load('entity_view_display', 'node.article.default');
$this->assertFalse((bool) $old_display);
......
......@@ -41,7 +41,7 @@ protected function setUp() {
// Create content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test';
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
$this->type = $type->type;
$this->type = $type->id();
// Create a default vocabulary.
$vocabulary = entity_create('taxonomy_vocabulary', array(
......
......@@ -43,7 +43,7 @@ protected function setUp() {
// Create content type, with underscores.
$type_name = strtolower($this->randomMachineName(8)) . '_test';
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
$this->type = $type->type;
$this->type = $type->id();
// Create random field name.
$this->field_label = $this->randomMachineName(8);
......@@ -400,7 +400,7 @@ function testDeleteField() {
// Create an additional node type.
$type_name2 = strtolower($this->randomMachineName(8)) . '_test';
$type2 = $this->drupalCreateContentType(array('name' => $type_name2, 'type' => $type_name2));
$type_name2 = $type2->type;
$type_name2 = $type2->id();
// Add a field to the second node type.
$bundle_path2 = 'admin/structure/types/manage/' . $type_name2;
......
......@@ -64,7 +64,7 @@ function testFilterHooks() {
$edit['title[0][value]'] = $title;
$edit['body[0][value]'] = $this->randomMachineName(32);
$edit['body[0][format]'] = $format_id;
$this->drupalPostForm("node/add/{$type->type}", $edit, t('Save and publish'));
$this->drupalPostForm("node/add/{$type->id()}", $edit, t('Save and publish'));
$this->assertText(t('@type @title has been created.', array('@type' => $type_name, '@title' => $title)));
// Disable the text format.
......
......@@ -39,7 +39,7 @@ protected function setUp() {
function testFieldUI() {
// Add a content type.
$type = $this->drupalCreateContentType();
$type_path = 'admin/structure/types/manage/' . $type->type;
$type_path = 'admin/structure/types/manage/' . $type->id();
// Add a link field to the newly-created type.
$label = $this->randomMachineName();
......
......@@ -64,7 +64,7 @@ public function testContentTypeLanguageConfiguration() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
// User to create a node.
$web_user = $this->drupalCreateUser(array("create {$type1->type} content", "create {$type2->type} content", "edit any {$type2->type} content"));
$web_user = $this->drupalCreateUser(array("create {$type1->id()} content", "create {$type2->id()} content", "edit any {$type2->id()} content"));
// Add custom language.
$this->drupalLogin($admin_user);
......@@ -81,24 +81,24 @@ public function testContentTypeLanguageConfiguration() {
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
// Set the content type to use multilingual support.
$this->drupalGet("admin/structure/types/manage/{$type2->type}");
$this->drupalGet("admin/structure/types/manage/{$type2->id()}");
$this->assertText(t('Language settings'), 'Multilingual support widget present on content type configuration form.');
$edit = array(
'language_configuration[language_alterable]' => TRUE,
);
$this->drupalPostForm("admin/structure/types/manage/{$type2->type}", $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->name)));
$this->drupalPostForm("admin/structure/types/manage/{$type2->id()}", $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => $type2->label())));
$this->drupalLogout();
\Drupal::languageManager()->reset();
// Verify language selection is not present on the node add form.
$this->drupalLogin($web_user);
$this->drupalGet("node/add/{$type1->type}");
$this->drupalGet("node/add/{$type1->id()}");
// Verify language select list is not present.
$this->assertNoFieldByName('langcode[0][value]', NULL, 'Language select not present on the node add form.');
// Verify language selection appears on the node add form.
$this->drupalGet("node/add/{$type2->type}");
$this->drupalGet("node/add/{$type2->id()}");
// Verify language select list is present.
$this->assertFieldByName('langcode[0][value]', NULL, 'Language select present on the node add form.');
// Ensure language appears.
......@@ -108,7 +108,7 @@ public function testContentTypeLanguageConfiguration() {
$node_title = $this->randomMachineName();
$node_body = $this->randomMachineName();
$edit = array(
'type' => $type2->type,
'type' => $type2->id(),
'title' => $node_title,
'body' => array(array('value' => $node_body)),
'langcode' => $langcode,
......@@ -137,7 +137,7 @@ public function testContentTypeDirLang() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
// User to create a node.
$web_user = $this->drupalCreateUser(array("create {$type->type} content", "edit own {$type->type} content"));
$web_user = $this->drupalCreateUser(array("create {$type->id()} content", "edit own {$type->id()} content"));
// Login as admin.
$this->drupalLogin($admin_user);
......@@ -154,12 +154,12 @@ public function testContentTypeDirLang() {
\Drupal::languageManager()->reset();
// Set the content type to use multilingual support.
$this->drupalGet("admin/structure/types/manage/{$type->type}");
$this->drupalGet("admin/structure/types/manage/{$type->id()}");
$edit = array(
'language_configuration[language_alterable]' => TRUE,
);
$this->drupalPostForm("admin/structure/types/manage/{$type->type}", $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => $type->name)));
$this->drupalPostForm("admin/structure/types/manage/{$type->id()}", $edit, t('Save content type'));
$this->assertRaw(t('The content type %type has been updated.', array('%type' => $type->label())));
$this->drupalLogout();
// Login as web user to add new node.
......@@ -170,7 +170,7 @@ public function testContentTypeDirLang() {
foreach (array('en', 'es', 'ar') as $langcode) {
$nodes[$langcode] = $this->drupalCreateNode(array(
'langcode' => $langcode,
'type' => $type->type,
'type' => $type->id(),
'promote' => NODE_PROMOTED,
));
}
......
......@@ -117,11 +117,13 @@ function node_help($route_name, RouteMatchInterface $route_match) {
case 'entity.node.edit_form':
$node = $route_match->getParameter('node');
$type = NodeType::load($node->getType());
return (!empty($type->help) ? Xss::filterAdmin($type->help) : '');
$help = $type->getHelp();
return (!empty($help) ? Xss::filterAdmin($help) : '');
case 'node.add':
$type = $route_match->getParameter('node_type');
return (!empty($type->help) ? Xss::filterAdmin($type->help) : '');
$help = $type->getHelp();
return (!empty($help) ? Xss::filterAdmin($help) : '');
}
}
......@@ -286,7 +288,7 @@ function node_get_type_label(NodeInterface $node) {
* The node type description.
*/
function node_type_get_description(NodeTypeInterface $node_type) {
return $node_type->description;
return $node_type->getDescription();
}
/**
......@@ -329,14 +331,14 @@ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') {
$field->save();
// Assign widget settings for the 'default' form mode.
entity_get_form_display('node', $type->type, 'default')
entity_get_form_display('node', $type->id(), 'default')
->setComponent('body', array(
'type' => 'text_textarea_with_summary',
))
->save();
// Assign display settings for the 'default' and 'teaser' view modes.
entity_get_display('node', $type->type, 'default')
entity_get_display('node', $type->id(), 'default')
->setComponent('body', array(
'label' => 'hidden',
'type' => 'text_default',
......@@ -347,7 +349,7 @@ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') {
// might not exist.
$view_modes = \Drupal::entityManager()->getViewModes('node');
if (isset($view_modes['teaser'])) {
entity_get_display('node', $type->type, 'teaser')
entity_get_display('node', $type->id(), 'teaser')
->setComponent('body', array(
'label' => 'hidden',
'type' => 'text_summary_or_trimmed',
......@@ -366,7 +368,7 @@ function node_entity_extra_field_info() {
$extra = array();
$description = t('Node module element');
foreach (node_type_get_types() as $bundle) {
$extra['node'][$bundle->type]['display']['links'] = array(
$extra['node'][$bundle->id()]['display']['links'] = array(
'label' => t('Links'),
'description' => $description,
'weight' => 100,
......
......@@ -30,10 +30,10 @@ function template_preprocess_node_add_list(&$variables) {
$variables['types'] = array();
if (!empty($variables['content'])) {
foreach ($variables['content'] as $type) {
$variables['types'][$type->type] = array(
'type' => $type->type,
'add_link' => \Drupal::l($type->name, new Url('node.add', array('node_type' => $type->type))),
'description' => Xss::filterAdmin($type->description),
$variables['types'][$type->id()] = array(
'type' => $type->id(),
'add_link' => \Drupal::l($type->label(), new Url('node.add', array('node_type' => $type->id()))),
'description' => Xss::filterAdmin($type->getDescription()),
);
}
}
......
......@@ -79,15 +79,15 @@ public function addPage() {
// Only use node types the user has access to.
foreach ($this->entityManager()->getStorage('node_type')->loadMultiple() as $type) {
if ($this->entityManager()->getAccessControlHandler('node')->createAccess($type->type)) {
$content[$type->type] = $type;
if ($this->entityManager()->getAccessControlHandler('node')->createAccess($type->id())) {
$content[$type->id()] = $type;
}
}
// Bypass the node/add listing if only one content type is available.
if (count($content) == 1) {
$type = array_shift($content);
return $this->redirect('node.add', array('node_type' => $type->type));
return $this->redirect('node.add', array('node_type' => $type->id()));
}
return array(
......@@ -107,7 +107,7 @@ public function addPage() {
*/
public function add(NodeTypeInterface $node_type) {
$node = $this->entityManager()->getStorage('node')->create(array(
'type' => $node_type->type,
'type' => $node_type->id(),
));
$form = $this->entityFormBuilder()->getForm($node);
......@@ -243,7 +243,7 @@ public function revisionOverview(NodeInterface $node) {
* The page title.
*/
public function addPageTitle(NodeTypeInterface $node_type) {
return $this->t('Create @name', array('@name' => $node_type->name));
return $this->t('Create @name', array('@name' => $node_type->label()));
}
}
......@@ -50,7 +50,7 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface {
*
* @todo Rename to $id.
*/
public $type;
protected $type;
/**
* The human-readable name of the node type.
......@@ -59,21 +59,21 @@ class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface {
*
* @todo Rename to $label.
*/
public $name;
protected $name;
/**
* A brief description of this node type.
*
* @var string
*/
public $description;
protected $description;
/**
* Help information shown to the user when creating a Node of this type.
*
* @var string
*/
public $help;
protected $help;
/**
* Default value of the 'Create new revision' checkbox of this node type.
......@@ -153,6 +153,20 @@ public function setPreviewMode($preview_mode) {
$this->preview_mode = $preview_mode;
}
/**
* {@inheritdoc}
*/
public function getHelp() {
return $this->help;
}
/**
* {@inheritdoc}
*/
public function getDescription() {
return $this->description;
}
/**
* {@inheritdoc}
*/
......
......@@ -73,7 +73,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['name'] = array(
'#title' => t('Name'),
'#type' => 'textfield',
'#default_value' => $type->name,
'#default_value' => $type->label(),
'#description' => t('The human-readable name of this content type. This text will be displayed as part of the list on the <em>Add content</em> page. This name must be unique.'),
'#required' => TRUE,
'#size' => 30,
......@@ -96,7 +96,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['description'] = array(
'#title' => t('Description'),
'#type' => 'textarea',
'#default_value' => $type->description,
'#default_value' => $type->getDescription(),
'#description' => t('Describe this content type. The text will be displayed on the <em>Add content</em> page.'),
);
......@@ -132,7 +132,7 @@ public function form(array $form, FormStateInterface $form_state) {
$form['submission']['help'] = array(
'#type' => 'textarea',
'#title' => t('Explanation or submission guidelines'),
'#default_value' => $type->help,
'#default_value' => $type->getHelp(),
'#description' => t('This text will be displayed at the top of the page when creating or editing content of this type.'),
);
$form['workflow'] = array(
......@@ -220,8 +220,8 @@ public function validate(array $form, FormStateInterface $form_state) {
public function save(array $form, FormStateInterface $form_state) {
$type = $this->entity;
$type->setNewRevision($form_state->getValue(array('options', 'revision')));
$type->type = trim($type->id());
$type->name = trim($type->name);
$type->set('type', trim($type->id()));
$type->set('name', trim($type->label()));
$status = $type->save();
......
......@@ -71,4 +71,19 @@ public function getPreviewMode();
*/
public function setPreviewMode($preview_mode);
/**
* Returns the help information.
*
* @return string
* The help information of this node type.
*/
public function getHelp();
/**
* Returns the description.
*
* @return string
* The description of this node type.
*/
public function getDescription();
}
......@@ -76,7 +76,7 @@ public function buildRow(EntityInterface $entity) {
'data' => $this->getLabel($entity),
'class' => array('menu-label'),
);
$row['description'] = Xss::filterAdmin($entity->description);
$row['description'] = Xss::filterAdmin($entity->getDescription());
return $row + parent::buildRow($entity);
}
......
......@@ -73,7 +73,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$options = array();
$node_types = $this->entityStorage->loadMultiple();
foreach ($node_types as $type) {
$options[$type->type] = $type->name;
$options[$type->id()] = $type->label();
}
$form['bundles'] = array(
'#title' => $this->t('Node types'),
......
......@@ -50,7 +50,7 @@ public function testConfigurationRename() {
'type' => Unicode::strtolower($this->randomMachineName(16)),
'name' => $this->randomMachineName(),
));
$staged_type = $content_type->type;
$staged_type = $content_type->id();
// Check the default status value for a node of this type.
$node = entity_create('node', array('type' => $staged_type));
......@@ -68,9 +68,9 @@ public function testConfigurationRename() {
$this->copyConfig($active, $staging);
// Change the machine name of the content type.
$content_type->type = Unicode::strtolower($this->randomMachineName(8));
$content_type->set('type', Unicode::strtolower($this->randomMachineName(8)));
$content_type->save();
$active_type = $content_type->type;
$active_type = $content_type->id();
// Ensure the base field override has been renamed and the value is correct.
$node = entity_create('node', array('type' => $active_type));
......@@ -134,7 +134,7 @@ public function testConfigurationRename() {
$this->assertFalse(entity_load('node_type', $active_type), 'The content no longer exists with the old name.');
$content_type = entity_load('node_type', $staged_type);
$this->assertIdentical($staged_type, $content_type->type);
$this->assertIdentical($staged_type, $content_type->id());
// Ensure the base field override has been renamed and the value is correct.
$node = entity_create('node', array('type' => $staged_type));
......
......@@ -35,11 +35,11 @@ function testNodeTypeGetFunctions() {
$this->assertTrue(isset($node_types['article']), 'Node type article is available.');
$this->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
$this->assertEqual($node_types['article']->name, $node_names['article'], 'Correct node type base has been returned.');
$this->assertEqual($node_types['article']->label(), $node_names['article'], 'Correct node type base has been returned.');
$article = entity_load('node_type', 'article');
$this->assertEqual($node_types['article'], $article, 'Correct node type has been returned.');
$this->assertEqual($node_types['article']->name, $article->label(), 'Correct node type name has been returned.');
$this->assertEqual($node_types['article']->label(), $article->label(), 'Correct node type name has been returned.');
}
/**
......@@ -49,14 +49,14 @@ function testNodeTypeCreation() {
// Create a content type programmaticaly.
$type = $this->drupalCreateContentType();
$type_exists = (bool) entity_load('node_type', $type->type);
$type_exists = (bool) entity_load('node_type', $type->id());
$this->assertTrue($type_exists, 'The new content type has been created in the database.');
// Login a test user.
$web_user = $this->drupalCreateUser(array('create ' . $type->name . ' content'));
$web_user = $this->drupalCreateUser(array('create ' . $type->label() . ' content'));
$this->drupalLogin($web_user);
$this->drupalGet('node/add/' . $type->type);
$this->drupalGet('node/add/' . $type->id());
$this->assertResponse(200, 'The new content type can be accessed at node/add.');
// Create a content type via the user interface.
......@@ -137,11 +137,11 @@ function testNodeTypeDeletion() {
$this->drupalLogin($web_user);
// Add a new node of this type.
$node = $this->drupalCreateNode(array('type' => $type->type));
$node = $this->drupalCreateNode(array('type' => $type->id()));
// Attempt to delete the content type, which should not be allowed.
$this->drupalGet('admin/structure/types/manage/' . $type->name . '/delete');
$this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete');
$this->assertRaw(
t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', array('%type' => $type->name)),
t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', array('%type' => $type->label())),
'The content type will not be deleted until all nodes of that type are removed.'
);
$this->assertNoText(t('This action cannot be undone.'), 'The node type deletion confirmation form is not available.');
......@@ -149,9 +149,9 @@ function testNodeTypeDeletion() {
// Delete the node.
$node->delete();
// Attempt to delete the content type, which should now be allowed.
$this->drupalGet('admin/structure/types/manage/' . $type->name . '/delete');
$this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete');
$this->assertRaw(
t('Are you sure you want to delete the content type %type?', array('%type' => $type->name)),
t('Are you sure you want to delete the content type %type?', array('%type' => $type->label())),
'The content type is available for deletion.'
);
$this->assertText(t('This action cannot be undone.'), 'The node type deletion confirmation form is available.');
......
......@@ -34,8 +34,8 @@ public function testNodeViewTypeArgument() {
for ($j = 0; $j < 5; $j++) {
// Ensure the right order of the nodes.
$node = $this->drupalCreateNode(array('type' => $type->type, 'created' => REQUEST_TIME - ($i * 5 + $j)));
$nodes[$type->type][$node->id()] = $node;
$node = $this->drupalCreateNode(array('type' => $type->id(), 'created' => REQUEST_TIME - ($i * 5 + $j)));
$nodes[$type->id()][$node->id()] = $node;
$all_nids[] = $node->id();
}
}
......@@ -48,8 +48,8 @@ public function testNodeViewTypeArgument() {
$this->assertNids($all_nids);
foreach ($types as $type) {
$this->drupalGet("test-node-view/{$type->type}");
$this->assertNids(array_keys($nodes[$type->type]));
$this->drupalGet("test-node-view/{$type->id()}");
$this->assertNids(array_keys($nodes[$type->id()]));
}
}
......
......@@ -62,7 +62,7 @@ protected function setUp() {
// Create content type, with underscores.
$this->typeName = 'test_' . strtolower($this->randomMachineName());
$type = $this->drupalCreateContentType(['name' => $this->typeName, 'type' => $this->typeName]);
$this->type = $type->type;
$this->type = $type->id();
}
/**
......
......@@ -40,7 +40,7 @@ public function testGlossaryView() {
);
foreach ($nodes_per_char as $char => $count) {
$setting = array(
'type' => $type->type
'type' => $type->id()
);
for ($i = 0; $i < $count; $i++) {
$node = $setting;
......
......@@ -58,7 +58,7 @@ protected function setUp() {
// Create an instance of the text field on the content type.
$field = array(
'field_storage' => $field_storage,
'bundle' => $node_type->type,
'bundle' => $node_type->id(),
);
entity_create('field_config', $field)->save();
......
......@@ -39,7 +39,7 @@ public function testSearchIntegration() {
// with the word "sandwich". Make the second node link to the first.
$node['title'] = 'pizza';
$node['body'] = array(array('value' => 'pizza'));
$node['type'] = $type->type;
$node['type'] = $type->id();
$this->drupalCreateNode($node);
$this->drupalGet('node/1');
......
......@@ -47,19 +47,19 @@ public function testMultilingualSearchFilter() {
$edit = array(
'language_configuration[language_alterable]' => TRUE,
);
$this->drupalPostForm('admin/structure/types/manage/' . $type->type, $edit, t('Save content type'));
$this->drupalPostForm('admin/structure/types/manage/' . $type->id(), $edit, t('Save content type'));
$edit = array(
'entity_types[node]' => TRUE,
'settings[node][' . $type->type . '][translatable]' => TRUE,
'settings[node][' . $type->type . '][fields][title]' => TRUE,
'settings[node][' . $type->type . '][fields][body]' => TRUE,
'settings[node][' . $type->id() . '][translatable]' => TRUE,
'settings[node][' . $type->id() . '][fields][title]' => TRUE,
'settings[node][' . $type->id() . '][fields][body]' => TRUE,
);
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
// Add a node in English, with title "sandwich".
$values = array(
'title' => 'sandwich',
'type' => $type->type,
'type' => $type->id(),
);
$node = $this->drupalCreateNode($values);