public function PreviewLinkTest::testEntitiesInaccessible in Preview Link 2.x
Same name and namespace in other branches
- 2.0.x tests/src/Functional/PreviewLinkTest.php \Drupal\Tests\preview_link\Functional\PreviewLinkTest::testEntitiesInaccessible()
Tests managing entities not possible when config is off.
File
- tests/
src/ Functional/ PreviewLinkTest.php, line 231
Class
- PreviewLinkTest
- Integration test for the preview link.
Namespace
Drupal\Tests\preview_link\FunctionalCode
public function testEntitiesInaccessible() : void {
\Drupal::configFactory()
->getEditable('preview_link.settings')
->set('multiple_entities', FALSE)
->save(TRUE);
$this
->drupalLogin($this
->createUser([
'generate preview links',
]));
$entity = EntityTestRevPub::create([
'name' => 'foo1',
]);
$entity
->save();
$generateUrl = $entity
->toUrl('preview-link-generate');
$this
->drupalGet($generateUrl);
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->buttonExists('op');
$this
->assertSession()
->pageTextNotContains('The associated entities this preview link unlocks.');
$this
->assertSession()
->fieldNotExists('entities[0][target_id]');
}