public function UiCrudTest::testEditTamperInstance in Feeds Tamper 8.2
Tests editing a Tamper plugin using the UI.
File
- tests/
src/ Functional/ UiCrudTest.php, line 103
Class
- UiCrudTest
- Tests adding/editing/removing tamper plugins using the UI.
Namespace
Drupal\Tests\feeds_tamper\FunctionalCode
public function testEditTamperInstance() {
// Programmatically add a tamper plugin instance.
$uuid = $this->feedTypeTamperManager
->getTamperMeta($this->feedType)
->addTamper([
'plugin' => 'convert_case',
'operation' => 'strtoupper',
'label' => 'Str to Upper',
'source' => 'title',
'description' => 'Convert the case to uppercase.',
]);
$this->feedType
->save();
// Go to the tamper listing.
$this
->drupalGet($this->url);
// Click link for editing this tamper plugin.
$this
->getSession()
->getPage()
->find('css', '#edit-title ul.dropbutton li:nth-child(1) a')
->click();
// Change a setting.
$edit = [
'plugin_configuration[operation]' => 'ucfirst',
];
$this
->submitForm($edit, 'Submit');
// Assert that the tamper instance configuration was updated.
$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('convert_case', $tamper
->getPluginId());
$this
->assertEquals($uuid, $tamper
->getSetting('uuid'));
$this
->assertEquals('ucfirst', $tamper
->getSetting('operation'));
$this
->assertEquals('title', $tamper
->getSetting('source'));
}