diff --git a/core/modules/system/src/Tests/Module/PrepareUninstallTest.php b/core/modules/system/src/Tests/Module/PrepareUninstallTest.php index da1e7e3..d59673c 100644 --- a/core/modules/system/src/Tests/Module/PrepareUninstallTest.php +++ b/core/modules/system/src/Tests/Module/PrepareUninstallTest.php @@ -14,6 +14,13 @@ class PrepareUninstallTest extends WebTestBase { /** + * An array of node objects. + * + * @var \Drupal\node\NodeInterface[] + */ + protected $nodes; + + /** * Modules to enable. * * @var array @@ -29,11 +36,11 @@ public function setUp() { $admin_user = $this->drupalCreateUser(['administer modules']); $this->drupalLogin($admin_user); - // Create some nodes. - $this->drupalCreateNode(['type' => 'page']); - $this->drupalCreateNode(['type' => 'page']); - $this->drupalCreateNode(['type' => 'article']); - $this->drupalCreateNode(['type' => 'article']); + // Create 12 nodes. + for ($i = 1; $i <= 6; $i++) { + $this->nodes[] = $this->drupalCreateNode(['type' => 'page']); + $this->nodes[] = $this->drupalCreateNode(['type' => 'article']); + } } /** @@ -42,27 +49,32 @@ public function setUp() { public function testUninstall() { // Check Node cannot be uninstalled yet, there is content to be removed. $this->drupalGet('admin/modules/uninstall'); - $this->assertText(t('Remove content items')); + $this->assertText('Remove content items'); $this->assertLinkByHref('admin/modules/uninstall/entity/node'); // Delete Node data. $this->drupalGet('admin/modules/uninstall/entity/node'); - $this->assertText(t('There are 4 content items to remove. This action cannot be undone.')); + for ($i = 11; $i >= 2; $i--) { + $this->assertText($this->nodes[$i]->label()); + } + $this->assertText('And 2 more content items.'); + $this->assertText('This action cannot be undone.'); + $this->assertText('Make a backup of your database if you want to be able to restore these items.'); $this->drupalPostForm(NULL, ['limit' => 1], t('Delete all content items')); // Check we are redirected to the uninstall page and data has been removed. $this->assertUrl('admin/modules/uninstall', []); - $this->assertText(t('All content items have been deleted.')); + $this->assertText('All content items have been deleted.'); // Check there is no more data to be deleted, Node is ready to be disabled. - $this->assertText(t('Allows content to be submitted to the site and displayed on pages.')); + $this->assertText('Allows content to be submitted to the site and displayed on pages.'); $this->assertNoLinkByHref('admin/modules/uninstall/entity/node'); // Uninstall Node module. $this->drupalPostForm('admin/modules/uninstall', ['uninstall[node]' => TRUE], t('Uninstall')); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.')); - $this->assertNoText(t('Allows content to be submitted to the site and displayed on pages.')); + $this->assertText('The selected modules have been uninstalled.'); + $this->assertNoText('Allows content to be submitted to the site and displayed on pages.'); } }