public function UiCrudTest::testAddTamperInstance in Feeds Tamper 8.2
Same name in this branch
- 8.2 tests/src/Functional/UiCrudTest.php \Drupal\Tests\feeds_tamper\Functional\UiCrudTest::testAddTamperInstance()
- 8.2 tests/src/FunctionalJavascript/UiCrudTest.php \Drupal\Tests\feeds_tamper\FunctionalJavascript\UiCrudTest::testAddTamperInstance()
Tests adding a Tamper plugin using the UI.
File
- tests/
src/ Functional/ UiCrudTest.php, line 63
Class
- UiCrudTest
- Tests adding/editing/removing tamper plugins using the UI.
Namespace
Drupal\Tests\feeds_tamper\FunctionalCode
public function testAddTamperInstance() {
// Go to the tamper listing.
$this
->drupalGet($this->url);
// Click link for adding a tamper plugin to the source 'description'.
$this
->getSession()
->getPage()
->find('css', '#edit-description-add-link')
->click();
// Select plugin.
$edit = [
'tamper_id' => 'trim',
];
$this
->submitForm($edit, 'Submit');
// Configure plugin.
$edit = [
'plugin_configuration[label]' => 'Trim test',
'plugin_configuration[side]' => 'ltrim',
];
$this
->submitForm($edit, 'Submit');
// And assert that the tamper plugin was added.
$this->feedType = $this
->reloadEntity($this->feedType);
$plugin_collection = $this->feedTypeTamperManager
->getTamperMeta($this->feedType, TRUE)
->getTampers();
$this
->assertCount(1, $plugin_collection);
$tamper = $plugin_collection
->getIterator()
->current();
$this
->assertEquals('trim', $tamper
->getPluginId());
$this
->assertEquals('Trim test', $tamper
->getSetting('label'));
$this
->assertEquals('ltrim', $tamper
->getSetting('side'));
$this
->assertEquals('description', $tamper
->getSetting('source'));
}