public function EntityRedirectTest::testBasicRedirect in Entity Redirect 8.2
File
- tests/
src/ Functional/ EntityRedirectTest.php, line 67
Class
- EntityRedirectTest
- Provide basic setup for all color field functional tests.
Namespace
Drupal\Tests\entity_redirect\FunctionalCode
public function testBasicRedirect() {
$edit = [
'title[0][value]' => $this
->randomMachineName(),
];
$this
->drupalPostForm('/node/add/article', $edit, t('Save'));
$session = $this
->assertSession();
$session
->addressEquals('/node/1');
$session
->statusCodeEquals(200);
$this
->drupalPostForm('/node/1/edit', $edit, t('Save'));
$session
->addressEquals('/user/2');
$session
->statusCodeEquals(200);
$this->settings['add']['active'] = TRUE;
$this->nodeType
->setThirdPartySetting('entity_redirect', 'redirect', $this->settings)
->save();
$this
->drupalPostForm('/node/add/article/', $edit, t('Save'));
$this
->assertEquals('https://www.google.ca/', $this
->getUrl());
$this->settings['edit']['destination'] = 'add_form';
$this->nodeType
->setThirdPartySetting('entity_redirect', 'redirect', $this->settings)
->save();
$this
->drupalPostForm('/node/2/edit', $edit, t('Save'));
$session
->addressEquals('/node/add/article');
$session
->statusCodeEquals(200);
$this->settings['edit']['destination'] = 'created';
$this->nodeType
->setThirdPartySetting('entity_redirect', 'redirect', $this->settings)
->save();
$this
->drupalPostForm('/node/2/edit', $edit, t('Save'));
$session
->addressEquals('/node/2');
$session
->statusCodeEquals(200);
$this->settings['edit']['destination'] = 'edit_form';
$this->nodeType
->setThirdPartySetting('entity_redirect', 'redirect', $this->settings)
->save();
$this
->drupalPostForm('/node/2/edit', $edit, t('Save'));
$session
->addressEquals('/node/2/edit');
$session
->statusCodeEquals(200);
}