diff --git a/core/modules/system/src/Tests/Entity/DoNotUseMeDeprecatedTestTrait.php b/core/modules/system/src/Tests/Entity/DoNotUseMeDeprecatedTestTrait.php
new file mode 100644
index 0000000000..89fcaacf51
--- /dev/null
+++ b/core/modules/system/src/Tests/Entity/DoNotUseMeDeprecatedTestTrait.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Drupal\system\Tests\Entity;
+
+@trigger_error('Do not use me, thanks!', E_USER_DEPRECATED);
+
+/**
+ * Provides deprecated test trait for check unexpected deprecated error.
+ *
+ * @deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
+ */
+trait DoNotUseMeDeprecatedTestTrait {
+
+}
diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index e1ef7db737..525cb58631 100644
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -145,6 +145,11 @@
 }
 
 $test_list = simpletest_script_get_test_list();
+if (in_array('Drupal\Tests\simpletest\Functional\OtherInstallationProfileTestsTest', $test_list)) {
+  $test_list = ['Drupal\Tests\simpletest\Functional\OtherInstallationProfileTestsTest'];
+} else {
+  $test_list = [];
+}
 
 // Try to allocate unlimited time to run the tests.
 drupal_set_time_limit(0);
@@ -823,7 +828,7 @@ function simpletest_script_run_one_test($test_id, $test_class) {
     }
     $test = new $class_name($test_id);
     if ($args['suppress-deprecations']) {
-      putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
+      putenv('SYMFONY_DEPRECATIONS_HELPER=weak');
     }
     else {
       // Prevent deprecations caused by vendor code calling deprecated code.
