Issue #2163003 by andypost: Node addition is broken when only one content type exists.

8.0.x
webchick 2013-12-27 11:59:09 -08:00
parent 588e6783d2
commit e3d7216fb2
2 changed files with 6 additions and 1 deletions

View File

@ -43,7 +43,7 @@ class NodeController extends ControllerBase {
// Bypass the node/add listing if only one content type is available. // Bypass the node/add listing if only one content type is available.
if (count($content) == 1) { if (count($content) == 1) {
$type = array_shift($content); $type = array_shift($content);
return $this->redirect('node_add', array('node_type' => $type->type)); return $this->redirect('node.add', array('node_type' => $type->type));
} }
return array( return array(

View File

@ -43,6 +43,11 @@ class NodeCreationTest extends NodeTestBase {
* Creates a "Basic page" node and verifies its consistency in the database. * Creates a "Basic page" node and verifies its consistency in the database.
*/ */
function testNodeCreation() { function testNodeCreation() {
// Test /node/add page with only one content type.
entity_load('node_type', 'article')->delete();
$this->drupalGet('node/add');
$this->assertResponse(200);
$this->assertUrl('node/add/page');
// Create a node. // Create a node.
$edit = array(); $edit = array();
$edit['title[0][value]'] = $this->randomName(8); $edit['title[0][value]'] = $this->randomName(8);