function MatcherCrudTest::testAdd in Linkit 8.4
Test adding a matcher to a profile.
File
- src/
Tests/ MatcherCrudTest.php, line 61 - Contains \Drupal\linkit\Tests\MatcherCrudTest.
Class
- MatcherCrudTest
- Tests adding, listing, updating and deleting matchers on a profile.
Namespace
Drupal\linkit\TestsCode
function testAdd() {
$this
->drupalGet(Url::fromRoute('linkit.matcher.add', [
'linkit_profile' => $this->linkitProfile
->id(),
]));
$edit = array();
$edit['plugin'] = 'dummy_matcher';
$this
->drupalPostForm(NULL, $edit, t('Save and continue'));
// Load the saved profile.
$this->linkitProfile = Profile::load($this->linkitProfile
->id());
$matcher_ids = $this->linkitProfile
->getMatchers()
->getInstanceIds();
/** @var \Drupal\linkit\MatcherInterface $plugin */
$plugin = $this->linkitProfile
->getMatcher(current($matcher_ids));
$this
->assertRaw(t('Added %label matcher.', [
'%label' => $plugin
->getLabel(),
]));
$this
->assertNoText(t('No matchers added.'));
}