NodeTitleBuiltinFailoverTest.php in Freelinking 4.0.x
File
tests/src/Functional/NodeTitleBuiltinFailoverTest.php
View source
<?php
namespace Drupal\Tests\freelinking\Functional;
class NodeTitleBuiltinFailoverTest extends FreelinkingBrowserTestBase {
protected function setUp() : void {
parent::setUp();
$edit = [
'filters[freelinking][status]' => 1,
'filters[freelinking][weight]' => 0,
'filters[freelinking][settings][plugins][nodetitle][enabled]' => 1,
'filters[freelinking][settings][plugins][nodetitle][settings][failover]' => 'showtext',
'filters[filter_url][weight]' => 1,
'filters[filter_html][weight]' => 2,
'filters[filter_autop][weight]' => 3,
'filters[filter_htmlcorrector][weight]' => 4,
];
$this
->updateFilterSettings('plain_text', $edit);
}
public function testNodeTitleShowtextFailover() {
$edit = [];
$edit['title[0][value]'] = t('Testing all freelinking plugins');
$edit['body[0][value]'] = $this
->getNodeBodyValue();
$this
->drupalGet('node/add/page');
$this
->submitForm($edit, 'Save');
$this
->assertSession()
->pageTextContains(t('Basic page @title has been created.', [
'@title' => $edit['title[0][value]'],
]));
$this
->assertSession()
->linkNotExists('Third page', 'No link exists for the third page.');
$this
->assertSession()
->pageTextContainsOnce('Third page');
}
protected function getNodeBodyValue() {
return <<<EOF
<ul>
<li>Nodetitle: [[nodetitle:First page]]</li>
<li>Nodetitle: [[nodetitle:Second page]]</li>
<li>Nodetitle: [[nodetitle:Third page]]</li>
</ul>
EOF;
}
}