public function EntityUpdateUIFunctionsTest::testEntityUpdateBasicWebExec in Entity Update 2.0.x
Run basic tests.
File
- tests/
src/ Functional/ EntityUpdateUIFunctionsTest.php, line 48
Class
- EntityUpdateUIFunctionsTest
- Test Entity Update UI Functions.
Namespace
Drupal\Tests\entity_update\FunctionalCode
public function testEntityUpdateBasicWebExec() {
$assert = $this
->assertSession();
// Initially, Disable the field 'name' => No need to update.
EntityUpdateTestHelper::fieldDisable('name');
EntityUpdateTestHelper::fieldDisable('description');
EntityUpdateTestHelper::fieldSetType('type', NULL);
// Check no updates message.
$this
->drupalGet('admin/config/development/entity-update/status');
$assert
->pageTextContainsOnce('All Entities are up to date.');
// Check no updates message.
$edit = [];
$path = 'admin/config/development/entity-update/exec/basic';
$this
->drupalGet($path);
$this
->drupalPostForm($path, $edit, 'Run Basic Update');
$assert
->pageTextContainsOnce('Nothing to update. All entities are up to date.');
// One field to install.
EntityUpdateTestHelper::fieldEnable('name');
$this
->drupalGet('admin/config/development/entity-update/status');
$assert
->pageTextContainsOnce('The Name field needs to be installed.');
$edit = [];
$edit['confirm'] = FALSE;
$this
->drupalGet($path);
$this
->drupalPostForm($path, $edit, 'Run Basic Update');
$assert
->pageTextContainsOnce('If you want to execute, please check the checkbox.');
$edit = [];
$edit['confirm'] = TRUE;
$this
->drupalGet($path);
$this
->drupalPostForm($path, $edit, 'Run Basic Update');
$assert
->pageTextContainsOnce('Entity update SUCCESS');
// One field to install, one field to uninstall.
EntityUpdateTestHelper::fieldDisable('name');
EntityUpdateTestHelper::fieldEnable('description');
$this
->drupalGet('admin/config/development/entity-update/status');
$assert
->pageTextContainsOnce('The Description field needs to be installed.');
$assert
->pageTextContainsOnce('The Name field needs to be uninstalled.');
$edit = [];
$edit['confirm'] = TRUE;
$this
->drupalGet($path);
$this
->drupalPostForm($path, $edit, 'Run Basic Update');
$assert
->pageTextContainsOnce('Entity update SUCCESS');
$this
->drupalGet('admin/config/development/entity-update/status');
$assert
->pageTextContainsOnce('All Entities are up to date.');
}