--- src/Tests/PathautoMassDeleteTest.php	2017-01-24 14:40:06.108995383 +0100
+++ src/Tests/PathautoMassDeleteTest.php	2017-01-26 23:42:07.742455844 +0100
@@ -126,9 +126,10 @@ class PathautoMassDeleteTest extends Web
     $this->assertText(t('All of your automatically generated path aliases have been deleted.'));
     $this->assertUrl('admin/config/search/path/delete_bulk');
 
-    // Make sure that only custom aliases still exist.
+    // Make sure that only custom aliases and aliases with no information about
+    // their state still exist.
     $aliases = \Drupal::database()->select('url_alias', 'ua')->fields('ua', ['source'])->execute()->fetchCol();
-    $this->assertEqual($aliases, ['/node/4', '/node/5'], 'Custom aliases still exist.');
+    $this->assertEqual($aliases, ['/node/101', '/node/104', '/node/105'], 'Custom aliases still exist.');
   }
 
   /**
@@ -142,22 +143,26 @@ class PathautoMassDeleteTest extends Web
     // the entities are already created we just update them, otherwise we create
     // them.
     if (empty($this->nodes)) {
-      for ($i = 1; $i <= 5; $i++) {
+      // Create a large number of nodes (100+) to make sure that the batch code works.
+      for ($i = 1; $i <= 105; $i++) {
         // Set the alias of two nodes manually.
-        $settings = ($i > 3) ? ['path' => ['alias' => "/custom_alias_$i", 'pathauto' => PathautoState::SKIP]] : [];
+        $settings = ($i > 103) ? ['path' => ['alias' => "/custom_alias_$i", 'pathauto' => PathautoState::SKIP]] : [];
         $node = $this->drupalCreateNode($settings);
         $this->nodes[$node->id()] = $node;
       }
     }
     else {
       foreach ($this->nodes as $node) {
-        if ($node->id() > 3) {
+        if ($node->id() > 103) {
           // The alias is set manually.
           $node->set('path', ['alias' => '/custom_alias_' . $node->id()]);
         }
         $node->save();
       }
     }
+    // Delete information about the state of an alias to make sure that aliases
+    // with no such data are left alone by default.
+    \Drupal::keyValue('pathauto_state.node')->delete(101);
 
     if (empty($this->accounts)) {
       for ($i = 1; $i <= 5; $i++) {
