diff --git a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
index 8a99cad..e936dec 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php
@@ -160,8 +160,8 @@ public function testSource(array $source_data, array $expected_data, $expected_c
     // If an expected count was given, assert it only if the plugin is
     // countable.
     if (is_numeric($expected_count)) {
-      $this->assertInstanceOf('\Iterator', $plugin);
-      $this->assertSame($expected_count, iterator_count($plugin));
+      $this->assertInstanceOf('\Countable', $plugin);
+      $this->assertCount($expected_count, $plugin);
     }
 
     $i = 0;
@@ -185,6 +185,9 @@ public function testSource(array $source_data, array $expected_data, $expected_c
         }
       }
     }
+    // False positives occur if the foreach is not entered. So, confirm the
+    // foreach loop was entered.
+    $this->assertGreaterThan(0, $i);
   }
 
 }
