Creates an unpublished node and confirms correct redirect behavior.
function testUnpublishedNodeCreation() {
// Set the front page to the test page.
config('system.site')
->set('page.front', 'test-page')
->save();
// Set "Basic page" content type to be unpublished by default.
variable_set('node_options_page', array());
// Create a node.
$edit = array();
$edit["title"] = $this
->randomName(8);
$edit["body[" . LANGUAGE_NOT_SPECIFIED . "][0][value]"] = $this
->randomName(16);
$this
->drupalPost('node/add/page', $edit, t('Save'));
// Check that the user was redirected to the home page.
$this
->assertUrl('');
$this
->assertText(t('Test page text'));
// Confirm that the node was created.
$this
->assertRaw(t('!post %title has been created.', array(
'!post' => 'Basic page',
'%title' => $edit["title"],
)));
}