Commit b54f02f5 authored by tim.plunkett's avatar tim.plunkett

Issue #1790484 by tim.plunkett: Adjust for removal of node_type_get_name().

parent 450b4334
<?php
/**
* @file
* Definition of Drupal\views\Tests\Node\FieldTypeTest.
*/
namespace Drupal\views\Tests\Node;
/**
* Tests the Views\node\Plugin\views\field\Type handler.
*/
class FieldTypeTest extends NodeTestBase {
public static function getInfo() {
return array(
'name' => 'Node: Node Type field',
'description' => 'Tests the Views\node\Plugin\views\field\Type handler.',
'group' => 'Views Modules',
);
}
public function testFieldType() {
$node = $this->drupalCreateNode();
$expected_result[] = array(
'nid' => $node->id(),
'node_type' => $node->bundle(),
);
$column_map = array(
'nid' => 'nid',
'node_type' => 'node_type',
);
$view = $this->getView();
$view->preview();
$this->executeView($view);
$this->assertIdenticalResultset($view, $expected_result, $column_map, 'The correct node type was displayed.');
}
/**
* Overrides Drupal\views\Tests\ViewTestBase::getBasicView().
*/
protected function getBasicView() {
return $this->createViewFromConfig('test_field_type');
}
}
......@@ -37,7 +37,7 @@ function title() {
}
function node_type($type) {
$output = node_type_get_name($type);
$output = node_type_get_label($type);
if (empty($output)) {
$output = t('Unknown content type');
}
......
......@@ -48,7 +48,7 @@ public function buildOptionsForm(&$form, &$form_state) {
*/
function render_name($data, $values) {
if ($this->options['machine_name'] != 1 && $data !== NULL && $data !== '') {
return t($this->sanitizeValue(node_type_get_name($data)));
return t($this->sanitizeValue(node_type_get_label($data)));
}
return $this->sanitizeValue($data);
}
......
api_version: '3.0'
base_table: node
core: '8'
description: ''
disabled: '0'
display:
default:
display_options:
fields:
type:
field: type
id: type
table: node
display_plugin: default
display_title: Master
id: default
position: '0'
human_name: ''
name: test_field_type
tag: ''
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment