Issue #3293216 by longwave, Spokje, quietone: Rename references to Simpletest in tests

merge-requests/2541/merge
catch 2022-08-15 11:24:13 +09:00
parent 790442c305
commit ebe774d4b9
74 changed files with 137 additions and 192 deletions

View File

@ -25,7 +25,7 @@ sites/*/services*.yml
sites/*/files
sites/*/private
# Ignore SimpleTest multi-site environment.
# Ignore multi-site test environment.
sites/simpletest
# If you prefer to store your .gitignore file in the sites/ folder, comment
@ -38,5 +38,5 @@ sites/simpletest
# */files
# */private
# Ignore SimpleTest multi-site environment.
# Ignore multi-site test environment.
# simpletest

View File

@ -201,7 +201,7 @@ function _drupal_exception_handler_additional($exception, $exception2) {
}
/**
* Returns the test prefix if this is an internal request from SimpleTest.
* Returns the test prefix if this is an internal request from a test.
*
* @param string $new_prefix
* Internal use only. A new prefix to be stored.
@ -224,9 +224,8 @@ function drupal_valid_test_ua($new_prefix = NULL) {
// a test environment.
$test_prefix = FALSE;
// A valid Simpletest request will contain a hashed and salted authentication
// code. Check if this code is present in a cookie or custom user agent
// string.
// A valid test request will contain a hashed and salted authentication code.
// Check if this code is present in a cookie or custom user agent string.
$http_user_agent = $_SERVER['HTTP_USER_AGENT'] ?? NULL;
$user_agent = $_COOKIE['SIMPLETEST_USER_AGENT'] ?? $http_user_agent;
if (isset($user_agent) && preg_match("/^simple(\w+\d+):(.+):(.+):(.+)$/", $user_agent, $matches)) {
@ -268,7 +267,7 @@ function drupal_valid_test_ua($new_prefix = NULL) {
}
/**
* Generates a user agent string with a HMAC and timestamp for simpletest.
* Generates a user agent string with a HMAC and timestamp for tests.
*/
function drupal_generate_test_ua($prefix) {
static $key, $last_prefix;

View File

@ -29,7 +29,7 @@ class DbDumpCommand extends DbCommandBase {
/**
* An array of table patterns to exclude completely.
*
* This excludes any lingering simpletest tables generated during test runs.
* This excludes any lingering tables generated during test runs.
*
* @var array
*/

View File

@ -370,7 +370,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
$app_root = static::guessApplicationRoot();
}
// Check for a simpletest override.
// Check for a test override.
if ($test_prefix = drupal_valid_test_ua()) {
$test_db = new TestDatabase($test_prefix);
return $test_db->getTestSitePath();
@ -982,7 +982,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
// Only code that interfaces directly with tests should rely on this
// constant; e.g., the error/exception handler conditionally adds further
// error information into HTTP response headers that are consumed by
// Simpletest's internal browser.
// the internal browser.
define('DRUPAL_TEST_IN_CHILD_SITE', TRUE);
// Web tests are to be conducted with runtime assertions active.

View File

@ -168,8 +168,8 @@ class ExtensionDiscovery {
// expected extension type specific directory names only.
$searchdirs[static::ORIGIN_ROOT] = '';
// Simpletest uses the regular built-in multi-site functionality of Drupal
// for running web tests. As a consequence, extensions of the parent site
// Tests use the regular built-in multi-site functionality of Drupal for
// running web tests. As a consequence, extensions of the parent site
// located in a different site-specific directory are not discovered in a
// test site environment, because the site directories are not the same.
// Therefore, add the site directory of the parent site to the search paths,

View File

@ -277,9 +277,9 @@ trait FunctionalTestSetupTrait {
$this->container->get('request_stack')->push($request);
// The request context is normally set by the router_listener from within
// its KernelEvents::REQUEST listener. In the simpletest parent site this
// event is not fired, therefore it is necessary to updated the request
// context manually here.
// its KernelEvents::REQUEST listener. In the parent site this event is not
// fired, therefore it is necessary to update the request context manually
// here.
$this->container->get('router.request_context')->fromRequest($request);
return $request;
@ -503,7 +503,7 @@ trait FunctionalTestSetupTrait {
}
/**
* Returns the parameters that will be used when Simpletest installs Drupal.
* Returns the parameters that will be used when the test installs Drupal.
*
* @see install_drupal()
* @see install_state_defaults()

View File

@ -12,17 +12,15 @@ use Psr\Http\Message\ResponseInterface;
class TestHttpClientMiddleware {
/**
* {@inheritdoc}
*
* HTTP middleware that replaces the user agent for simpletest requests.
* HTTP middleware that replaces the user agent for test requests.
*/
public function __invoke() {
// If the database prefix is being used by SimpleTest to run the tests in a copied
// database then set the user-agent header to the database prefix so that any
// calls to other Drupal pages will run the SimpleTest prefixed database. The
// user-agent is used to ensure that multiple testing sessions running at the
// same time won't interfere with each other as they would if the database
// prefix were stored statically in a file or database variable.
// If the database prefix is being used to run the tests in a copied
// database, then set the User-Agent header to the database prefix so that
// any calls to other Drupal pages will run the test-prefixed database. The
// user agent is used to ensure that multiple testing sessions running at
// the same time won't interfere with each other as they would if the
// database prefix were stored statically in a file or database variable.
return function ($handler) {
return function (RequestInterface $request, array $options) use ($handler) {
if ($test_prefix = drupal_valid_test_ua()) {

View File

@ -169,8 +169,7 @@ class PhpUnitTestRunner implements ContainerInjectionInterface {
$old_cwd = getcwd();
chdir($this->appRoot . "/core");
// exec in a subshell so that the environment is isolated when running tests
// via the simpletest UI.
// exec in a subshell so that the environment is isolated.
$ret = exec(implode(" ", $command), $output, $status);
chdir($old_cwd);

View File

@ -27,23 +27,22 @@ class TestDatabase {
protected $databasePrefix;
/**
* Returns the database connection to the site running Simpletest.
* Returns the database connection to the site under test.
*
* @return \Drupal\Core\Database\Connection
* The database connection to use for inserting assertions.
*
* @see \Drupal\simpletest\TestBase::prepareEnvironment()
* @see \Drupal\Core\Test\TestSetupTrait::getDatabaseConnection()
*/
public static function getConnection() {
// Check whether there is a test runner connection.
// @see run-tests.sh
// @todo Convert Simpletest UI runner to create + use this connection, too.
try {
$connection = Database::getConnection('default', 'test-runner');
}
catch (ConnectionNotDefinedException $e) {
// Check whether there is a backup of the original default connection.
// @see TestBase::prepareEnvironment()
// @see \Drupal\Core\Test\TestSetupTrait::changeDatabasePrefix()
try {
$connection = Database::getConnection('default', 'simpletest_original_default');
}
@ -185,9 +184,7 @@ class TestDatabase {
* This is useful for inserting assertions that can only be recorded after
* the test case has been destroyed, such as PHP fatal errors. The caller
* information is not automatically gathered since the caller is most likely
* inserting the assertion on behalf of other code. In all other respects
* the method behaves just like \Drupal\simpletest\TestBase::assert() in terms
* of storing the assertion.
* inserting the assertion on behalf of other code.
*
* @param string $test_id
* The test ID to which the assertion relates.
@ -310,7 +307,7 @@ class TestDatabase {
}
/**
* Defines the database schema for run-tests.sh and simpletest module.
* Defines the database schema for run-tests.sh and PHPUnit tests.
*
* @return array
* Array suitable for use in a hook_schema() implementation.
@ -319,12 +316,12 @@ class TestDatabase {
*/
public static function testingSchema() {
$schema['simpletest'] = [
'description' => 'Stores simpletest messages',
'description' => 'Stores test messages',
'fields' => [
'message_id' => [
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique simpletest message ID.',
'description' => 'Primary Key: Unique test message ID.',
],
'test_id' => [
'type' => 'int',
@ -385,12 +382,12 @@ class TestDatabase {
],
];
$schema['simpletest_test_id'] = [
'description' => 'Stores simpletest test IDs, used to auto-increment the test ID so that a fresh test ID is used.',
'description' => 'Stores test IDs, used to auto-increment the test ID so that a fresh test ID is used.',
'fields' => [
'test_id' => [
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique simpletest ID used to group test results together. Each time a set of tests
'description' => 'Primary Key: Unique test ID used to group test results together. Each time a set of tests
are run a new test ID is used.',
],
'last_prefix' => [

View File

@ -5,7 +5,7 @@ namespace Drupal\Core\Test;
use Drupal\Core\DrupalKernel;
/**
* Kernel to mock requests to test simpletest.
* Kernel that is only used by mock front controllers.
*/
class TestKernel extends DrupalKernel {

View File

@ -117,8 +117,8 @@ class BookBreadcrumbTest extends BrowserTestBase {
static $number = 0;
$edit = [];
$edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - SimpleTest test node ' . $this->randomMachineName(10);
$edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
$edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - test node ' . $this->randomMachineName(10);
$edit['body[0][value]'] = 'test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
$edit['book[bid]'] = $book_nid;
if ($parent !== NULL) {

View File

@ -186,8 +186,8 @@ trait BookTestTrait {
// Used to ensure that when sorted nodes stay in same order.
static $number = 0;
$edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - SimpleTest test node ' . $this->randomMachineName(10);
$edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
$edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - test node ' . $this->randomMachineName(10);
$edit['body[0][value]'] = 'test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
$edit['book[bid]'] = $book_nid;
if ($parent !== NULL) {

View File

@ -116,8 +116,8 @@ class BookRelationshipTest extends ViewTestBase {
static $number = 0;
$edit = [];
$edit['title[0][value]'] = $number . ' - SimpleTest test node ' . $this->randomMachineName(10);
$edit['body[0][value]'] = 'SimpleTest test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
$edit['title[0][value]'] = $number . ' - test node ' . $this->randomMachineName(10);
$edit['body[0][value]'] = 'test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
$edit['book[bid]'] = $book_nid;
if ($parent !== NULL) {

View File

@ -42,14 +42,14 @@ class ContentModerationRouteSubscriberTest extends UnitTestCase {
$definition = $this->createMock(EntityTypeInterface::class);
$definition->expects($this->any())
->method('getClass')
->will($this->returnValue(SimpleTestEntity::class));
->will($this->returnValue(TestEntity::class));
$definition->expects($this->any())
->method('isRevisionable')
->willReturn(FALSE);
$revisionable_definition = $this->createMock(EntityTypeInterface::class);
$revisionable_definition->expects($this->any())
->method('getClass')
->will($this->returnValue(SimpleTestEntity::class));
->will($this->returnValue(TestEntity::class));
$revisionable_definition->expects($this->any())
->method('isRevisionable')
->willReturn(TRUE);
@ -245,5 +245,5 @@ class ContentModerationRouteSubscriberTest extends UnitTestCase {
/**
* A concrete entity.
*/
class SimpleTestEntity extends EntityBase {
class TestEntity extends EntityBase {
}

View File

@ -824,7 +824,7 @@ class DbLogTest extends BrowserTestBase {
* @param string $log_message
* The database log message to check.
* @param string $message
* The message to pass to simpletest.
* A message to display if the assertion fails.
*
* @internal
*/

View File

@ -22,7 +22,7 @@ class DummyReadOnlyStreamWrapper extends LocalReadOnlyStream {
* {@inheritdoc}
*/
public function getDescription() {
return t('Dummy wrapper for simpletest (readonly).');
return t('Dummy wrapper for testing (readonly).');
}
public function getDirectoryPath() {

View File

@ -24,7 +24,7 @@ class DummyRemoteStreamWrapper extends PublicStream {
* {@inheritdoc}
*/
public function getDescription() {
return t('Dummy wrapper for simpletest (remote).');
return t('Dummy wrapper for testing (remote).');
}
public function realpath() {

View File

@ -22,7 +22,7 @@ class DummyStreamWrapper extends LocalStream {
* {@inheritdoc}
*/
public function getDescription() {
return t('Dummy wrapper for simpletest.');
return t('Dummy wrapper for testing.');
}
public function getDirectoryPath() {

View File

@ -139,7 +139,7 @@ class FileFieldWidgetTest extends FileFieldTestBase {
// Visit the node creation form, and upload 3 files for each field. Since
// the field has cardinality of 3, ensure the "Upload" button is displayed
// until after the 3rd file, and after that, isn't displayed. Because
// SimpleTest triggers the last button with a given name, so upload to the
// the last button with a given name is triggered by default, upload to the
// second field first.
$this->drupalGet("node/add/$type_name");
foreach ([$field_name2, $field_name] as $each_field_name) {

View File

@ -77,7 +77,7 @@ class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlter
$this->assertEntity(1, 'Image1.png', 39325, 'public://image-1.png', 'image/png', 1);
$this->assertEntity(2, 'Image2.jpg', 1831, 'public://image-2.jpg', 'image/jpeg', 1);
$this->assertEntity(3, 'image-3.jpg', 1831, 'public://image-3.jpg', 'image/jpeg', 1);
$this->assertEntity(4, 'html-1.txt', 24, 'public://html-1.txt', 'text/plain', 1);
$this->assertEntity(4, 'html-1.txt', 19, 'public://html-1.txt', 'text/plain', 1);
// Ensure temporary file was not migrated.
$this->assertNull(File::load(6));

View File

@ -1131,7 +1131,7 @@ body {color:red}
* Asserts that a text transformed to lowercase with HTML entities decoded does contains a given string.
*
* Otherwise fails the test with a given message, similar to all the
* SimpleTest assert* functions.
* PHPUnit assert* functions.
*
* Note that this does not remove nulls, new lines and other characters that
* could be used to obscure a tag or an attribute name.
@ -1142,12 +1142,10 @@ body {color:red}
* Lowercase, plain text to look for.
* @param string $message
* (optional) Message to display if failed. Defaults to an empty string.
* @param string $group
* (optional) The group this message belongs to. Defaults to 'Other'.
*
* @internal
*/
public function assertNormalized(string $haystack, string $needle, string $message = '', string $group = 'Other'): void {
public function assertNormalized(string $haystack, string $needle, string $message = ''): void {
$this->assertStringContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message);
}
@ -1155,7 +1153,7 @@ body {color:red}
* Asserts that text transformed to lowercase with HTML entities decoded does not contain a given string.
*
* Otherwise fails the test with a given message, similar to all the
* SimpleTest assert* functions.
* PHPUnit assert* functions.
*
* Note that this does not remove nulls, new lines, and other character that
* could be used to obscure a tag or an attribute name.
@ -1166,12 +1164,10 @@ body {color:red}
* Lowercase, plain text to look for.
* @param string $message
* (optional) Message to display if failed. Defaults to an empty string.
* @param string $group
* (optional) The group this message belongs to. Defaults to 'Other'.
*
* @internal
*/
public function assertNoNormalized(string $haystack, string $needle, string $message = '', string $group = 'Other'): void {
public function assertNoNormalized(string $haystack, string $needle, string $message = ''): void {
$this->assertStringNotContainsString($needle, strtolower(Html::decodeEntities($haystack)), $message);
}

View File

@ -45,7 +45,7 @@ class ImageFieldValidateTest extends ImageFieldTestBase {
$this->submitForm([], 'Remove');
$this->submitForm([], 'Save');
// Get invalid image test files from simpletest.
// Get invalid image test files.
$dir = 'core/tests/fixtures/files';
$files = [];
if (is_dir($dir)) {

View File

@ -94,8 +94,7 @@ abstract class MigrateTestBase extends KernelTestBase implements MigrateMessageI
$connection_info = Database::getConnectionInfo('default');
foreach ($connection_info as $target => $value) {
$prefix = $value['prefix'];
// Simpletest uses 7 character prefixes at most so this can't cause
// collisions.
// Tests use 7 character prefixes at most so this can't cause collisions.
$connection_info[$target]['prefix'] = $prefix . '0';
}
Database::addConnectionInfo('migrate', 'default', $connection_info['default']);

View File

@ -136,8 +136,7 @@ class MigrationPluginListTest extends KernelTestBase {
$connection_info = Database::getConnectionInfo('default');
foreach ($connection_info as $target => $value) {
$prefix = $value['prefix'];
// Simpletest uses 7 character prefixes at most so this can't cause
// collisions.
// Tests use 7 character prefixes at most so this can't cause collisions.
$connection_info[$target]['prefix'] = $prefix . '0';
}
Database::addConnectionInfo('migrate', 'default', $connection_info['default']);

View File

@ -99,8 +99,8 @@ abstract class MigrateUpgradeTestBase extends BrowserTestBase {
$connection_info = Database::getConnectionInfo('default')['default'];
if ($connection_info['driver'] === 'sqlite') {
// Create database file in the test site's public file directory so that
// \Drupal\simpletest\TestBase::restoreEnvironment() will delete this once
// the test is complete.
// \Drupal\Tests\BrowserTestBase::cleanupEnvironment() will delete this
// once the test is complete.
$file = $this->publicFilesDirectory . '/' . $this->testId . '-migrate.db.sqlite';
touch($file);
$connection_info['database'] = $file;
@ -108,9 +108,9 @@ abstract class MigrateUpgradeTestBase extends BrowserTestBase {
}
else {
$prefix = $connection_info['prefix'];
// Simpletest uses fixed length prefixes. Create a new prefix for the
// Test databases use fixed length prefixes. Create a new prefix for the
// source database. Adding to the end of the prefix ensures that
// \Drupal\simpletest\TestBase::restoreEnvironment() will remove the
// \Drupal\Tests\BrowserTestBase::cleanupEnvironment() will remove the
// additional tables.
$connection_info['prefix'] = $prefix . '0';
}

View File

@ -1 +1 @@
<h1>SimpleTest HTML</h1>
<h1>Test HTML</h1>

View File

@ -1 +1 @@
<h1>SimpleTest HTML</h1>
<h1>Test HTML</h1>

View File

@ -196,7 +196,7 @@ class CommentAttributesTest extends CommentTestBase {
// Posts comment #2 as anonymous user.
$anonymous_user = [];
$anonymous_user['name'] = $this->randomMachineName();
$anonymous_user['mail'] = 'tester@simpletest.org';
$anonymous_user['mail'] = 'test@example.org';
$anonymous_user['homepage'] = 'http://example.org/';
$comment2 = $this->saveComment($this->node->id(), 0, $anonymous_user);

View File

@ -80,7 +80,7 @@ class ImageFieldAttributesTest extends ImageFieldTestBase {
->setBundleMapping(['types' => []])
->save();
// Get the test image that simpletest provides.
// Get the test image.
$image = current($this->drupalGetTestFiles('image'));
// Save a node with the image.

View File

@ -2,7 +2,7 @@
/**
* @file
* Simpletest mock module for Ajax forms testing.
* Mock module for Ajax forms testing.
*/
use Drupal\Core\Ajax\AddCssCommand;

View File

@ -206,8 +206,7 @@ class AjaxFormsTestCommandsForm extends FormBase {
];
// Demonstrates the Ajax 'settings' command. The 'settings' command has
// nothing visual to "show", but it can be tested via SimpleTest and via
// Firebug.
// nothing visual to "show", but it can be tested.
$form['settings_command_example'] = [
'#type' => 'submit',
'#value' => $this->t("AJAX 'settings' command"),

View File

@ -1,5 +1,5 @@
# Tests
conneg.simpletest:
conneg.test:
path: conneg/simple.json
defaults:
_controller: '\Drupal\conneg_test\Controller\TestController::simple'

View File

@ -44,7 +44,7 @@ class DatabaseTestController extends ControllerBase {
* Runs a pager query and returns the results.
*
* This function does care about the page GET parameter, as set by the
* simpletest HTTP call.
* test HTTP call.
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
@ -70,7 +70,7 @@ class DatabaseTestController extends ControllerBase {
* Runs a pager query and returns the results.
*
* This function does care about the page GET parameter, as set by the
* simpletest HTTP call.
* test HTTP call.
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
@ -96,7 +96,7 @@ class DatabaseTestController extends ControllerBase {
* Runs a tablesort query and returns the results.
*
* This function does care about the page GET parameter, as set by the
* simpletest HTTP call.
* test HTTP call.
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
@ -128,7 +128,7 @@ class DatabaseTestController extends ControllerBase {
* Runs a tablesort query with a second order_by after and returns the results.
*
* This function does care about the page GET parameter, as set by the
* simpletest HTTP call.
* test HTTP call.
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/

View File

@ -41,7 +41,7 @@ class ErrorTestController extends ControllerBase {
* Generate warnings to test the error handler.
*/
public function generateWarnings($collect_errors = FALSE) {
// Tell Drupal error reporter to send errors to Simpletest or not.
// Tell Drupal error reporter to collect test errors or not.
define('SIMPLETEST_COLLECT_ERRORS', $collect_errors);
// This will generate a notice.
$notice = new \stdClass();

View File

@ -1,5 +1,5 @@
name: PHPUnit Test
type: module
description: 'Provides dummy classes for use by SimpleTest tests.'
description: 'Provides dummy classes for use by tests.'
package: Testing
version: VERSION

View File

@ -135,7 +135,7 @@ class TestControllers {
// Remove the exception logger from the event dispatcher. We are going to
// throw an exception to check if it is properly escaped when rendered as a
// backtrace. The exception logger does a call to error_log() which is not
// handled by the Simpletest error handler and would cause a test failure.
// handled by the test error handler and would cause a test failure.
$event_dispatcher = \Drupal::service('event_dispatcher');
$exception_logger = \Drupal::service('exception.logger');
$event_dispatcher->removeSubscriber($exception_logger);

View File

@ -97,26 +97,6 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
] = $this->createReferenceTestEntities($this->entity);
}
/**
* Generates standardized entity cache tags test info.
*
* @param string $entity_type_label
* The label of the entity type whose cache tags to test.
* @param string $group
* The test group.
*
* @return array
*
* @see \Drupal\simpletest\TestBase::getInfo()
*/
protected static function generateStandardizedInfo($entity_type_label, $group) {
return [
'name' => "$entity_type_label entity cache tags",
'description' => "Test the $entity_type_label entity's cache tags.",
'group' => $group,
];
}
/**
* Creates the entity to be tested.
*

View File

@ -369,7 +369,7 @@ class SessionTest extends BrowserTestBase {
}
/**
* Assert whether the SimpleTest browser sent a session cookie.
* Assert whether the test browser sent a session cookie.
*
* @internal
*/

View File

@ -56,8 +56,8 @@ class PageTitleTest extends BrowserTestBase {
$title = "string with <em>HTML</em>";
// Generate node content.
$edit = [
'title[0][value]' => '!SimpleTest! ' . $title . $this->randomMachineName(20),
'body[0][value]' => '!SimpleTest! test body' . $this->randomMachineName(200),
'title[0][value]' => '!Test! ' . $title . $this->randomMachineName(20),
'body[0][value]' => '!Test! test body' . $this->randomMachineName(200),
];
// Create the node with HTML in the title.
$this->drupalGet('node/add/page');

View File

@ -95,7 +95,7 @@ class DbCommandBaseTest extends KernelTestBase {
]);
$this->assertEquals('extra2', $command->getDatabaseConnection($command_tester->getInput())->getPrefix());
// This breaks simpletest cleanup.
// This breaks test cleanup.
// @code
// $command_tester->execute([
// '--prefix' => 'notsimpletest',

View File

@ -30,9 +30,6 @@ class Toolbar extends RenderElement {
],
// Metadata for the toolbar wrapping element.
'#attributes' => [
// The id cannot be simply "toolbar" or it will clash with the
// simpletest tests listing which produces a checkbox with attribute
// id="toolbar".
'id' => 'toolbar-administration',
'role' => 'group',
'aria-label' => $this->t('Site administration toolbar'),

View File

@ -56,7 +56,7 @@ class MigrateUserPictureD6FileTest extends MigrateDrupal6TestBase {
$this->assertEntity(3, 'Image1.png', 39325, 'public://image-1.png', 'image/png', 1);
$this->assertEntity(4, 'Image2.jpg', 1831, 'public://image-2.jpg', 'image/jpeg', 1);
$this->assertEntity(5, 'Image-test.gif', 183, 'public://image-test.gif', 'image/jpeg', 1);
$this->assertEntity(6, 'html-1.txt', 24, 'public://html-1.txt', 'text/plain', 1);
$this->assertEntity(6, 'html-1.txt', 19, 'public://html-1.txt', 'text/plain', 1);
}
/**

View File

@ -2073,11 +2073,6 @@ parameters:
count: 1
path: tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
-
message: "#^Function container_test_file_service_test_service_function not found\\.$#"
count: 1
path: tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
-
message: "#^Cannot unset offset int on array\\<string, mixed\\>\\.$#"
count: 1

View File

@ -28,8 +28,6 @@ class SystemListingCrossProfileCompatibleTest extends KernelTestBase {
* This test needs to use a different installation profile than the test which
* asserts that this test is found.
*
* @see \Drupal\simpletest\Tests\InstallationProfileModuleTestsTest
*
* @var string
*/
protected $profile = 'minimal';

View File

@ -572,8 +572,8 @@ function simpletest_script_init() {
* parameters were passed).
*
* Otherwise, there are three database connections of concern:
* - --sqlite: The test runner connection, providing access to Simpletest
* database tables for recording test IDs and assertion results.
* - --sqlite: The test runner connection, providing access to database tables
* for recording test IDs and assertion results.
* - --dburl: A database connection that is used as base connection info for all
* tests; i.e., every test will spawn from this connection. In case this
* connection uses e.g. SQLite, then all tests will run against SQLite. This
@ -654,7 +654,7 @@ function simpletest_script_setup_database($new = FALSE) {
// Add the test runner database connection.
Database::addConnectionInfo('test-runner', 'default', $databases['test-runner']['default']);
// Create the Simpletest schema.
// Create the test result schema.
try {
$connection = Database::getConnection('default', 'test-runner');
$schema = $connection->schema();
@ -770,7 +770,7 @@ function simpletest_script_execute_batch($test_classes) {
$db_prefix = TestDatabase::lastTestGet($child['test_id'])['last_prefix'];
$test_db = new TestDatabase($db_prefix);
$test_directory = $test_db->getTestSitePath();
echo 'Simpletest database and files kept and test exited immediately on fail so should be reproducible if you change settings.php to use the database prefix ' . $db_prefix . ' and config directories in ' . $test_directory . "\n";
echo 'Test database and files kept and test exited immediately on fail so should be reproducible if you change settings.php to use the database prefix ' . $db_prefix . ' and config directories in ' . $test_directory . "\n";
$args['keep-results'] = TRUE;
// Exit repeat loop immediately.
$args['repeat'] = -1;
@ -1316,7 +1316,7 @@ function simpletest_script_print_alternatives($string, $array, $degree = 4) {
}
/**
* Loads the simpletest messages from the database.
* Loads test result messages from the database.
*
* Messages are ordered by test class and message id.
*
@ -1324,7 +1324,7 @@ function simpletest_script_print_alternatives($string, $array, $degree = 4) {
* Array of test IDs of the messages to be loaded.
*
* @return array
* Array of simpletest messages from the database.
* Array of test result messages from the database.
*/
function simpletest_script_load_messages_by_test_id($test_ids) {
global $args;

View File

@ -93,7 +93,7 @@ class AjaxFormPageCacheTest extends WebDriverTestBase {
$this->assertNotNull($green_span2, 'DOM update: After reload - the selected color SPAN is green.');
$build_id_from_cache_first_ajax = $this->getFormBuildId();
$this->assertNotEquals($build_id_from_cache_initial, $build_id_from_cache_first_ajax, 'Build id is changed in the simpletest-DOM on first AJAX submission');
$this->assertNotEquals($build_id_from_cache_initial, $build_id_from_cache_first_ajax, 'Build id is changed in the DOM on first AJAX submission');
$this->assertNotEquals($build_id_first_ajax, $build_id_from_cache_first_ajax, 'Build id from first user is not reused');
// Changing the value of a select input element, triggers an AJAX

View File

@ -276,7 +276,7 @@ class UncaughtExceptionTest extends BrowserTestBase {
* @param string $error_message
* The expected error message.
*
* @see \Drupal\simpletest\TestBase::prepareEnvironment()
* @see \Drupal\Core\Test\FunctionalTestSetupTrait::prepareEnvironment()
* @see \Drupal\Core\DrupalKernel::bootConfiguration()
*
* @internal
@ -306,7 +306,7 @@ class UncaughtExceptionTest extends BrowserTestBase {
/**
* Asserts that no errors have been logged to the PHP error.log thus far.
*
* @see \Drupal\simpletest\TestBase::prepareEnvironment()
* @see \Drupal\Core\Test\FunctionalTestSetupTrait::prepareEnvironment()
* @see \Drupal\Core\DrupalKernel::bootConfiguration()
*
* @internal

View File

@ -31,7 +31,7 @@ class BrowserTestBaseUserAgentTest extends BrowserTestBase {
$system_path = $this->buildUrl(\Drupal::service('extension.list.module')->getPath('system'));
$http_path = $system_path . '/tests/http.php/user/login';
$https_path = $system_path . '/tests/https.php/user/login';
// Generate a valid simpletest User-Agent to pass validation.
// Generate a valid test User-Agent to pass validation.
$this->assertNotFalse(preg_match('/test\d+/', $this->databasePrefix, $matches), 'Database prefix contains test prefix.');
$this->agent = drupal_generate_test_ua($matches[0]);

View File

@ -13,8 +13,6 @@ use Drupal\Tests\BrowserTestBase;
*
* @group Test
* @group FunctionalTestSetupTrait
*
* @see \Drupal\simpletest\Tests\SimpleTestInstallBatchTest
*/
class ModuleInstallBatchTest extends BrowserTestBase {

View File

@ -7,7 +7,7 @@ use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Test\AssertMailTrait;
/**
* Tests the SimpleTest email capturing logic, the assertMail assertion and the
* Tests the email capturing logic, the assertMail assertion and the
* drupalGetMails function.
*
* @group browsertestbase
@ -42,7 +42,7 @@ class MailCaptureTest extends BrowserTestBase {
$this->assertCount(0, $captured_emails, 'The captured emails queue is empty.');
// Send the email.
\Drupal::service('plugin.manager.mail')->getInstance(['module' => 'simpletest', 'key' => 'drupal_mail_test'])->mail($message);
\Drupal::service('plugin.manager.mail')->getInstance(['module' => 'test', 'key' => 'drupal_mail_test'])->mail($message);
// Ensure that there is one email in the captured emails array.
$captured_emails = $this->drupalGetMails();

View File

@ -522,7 +522,7 @@ trait AssertContentTrait {
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
*
* @see \Drupal\simpletest\AssertContentTrait::assertRaw()
* @see \Drupal\KernelTests\AssertContentTrait::assertRaw()
*/
protected function assertText($text, $message = '', $group = 'Other'): void {
$this->assertTextHelper($text, $message, $group, FALSE);
@ -547,7 +547,7 @@ trait AssertContentTrait {
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
*
* @see \Drupal\simpletest\AssertContentTrait::assertNoRaw()
* @see \Drupal\KernelTests\AssertContentTrait::assertNoRaw()
*/
protected function assertNoText($text, $message = '', $group = 'Other'): void {
$this->assertTextHelper($text, $message, $group, TRUE);

View File

@ -36,14 +36,11 @@ class DefaultConfigTest extends KernelTestBase {
*
* Comparing them does not make sense.
*
* @todo Figure out why simpletest.settings is not installed.
*
* @var array
*/
public static $skippedConfig = [
'locale.settings' => ['path: '],
'syslog.settings' => ['facility: '],
'simpletest.settings' => TRUE,
];
/**

View File

@ -21,8 +21,8 @@ class TableSortExtenderTest extends KernelTestBase {
// Test simple table headers.
$headers = ['foo', 'bar', 'baz'];
// Reset $request->query to prevent parameters from Simpletest and Batch API
// ending up in $ts['query'].
// Reset $request->query to prevent parameters from Batch API ending up in
// $ts['query'].
$expected_ts = [
'name' => 'foo',
'sql' => '',

View File

@ -104,11 +104,8 @@ class ContentNegotiationRoutingTest extends KernelTestBase {
/** @var \Symfony\Component\HttpKernel\HttpKernelInterface $kernel */
$kernel = \Drupal::getContainer()->get('http_kernel');
$response = $kernel->handle($request);
// Verbose message since simpletest doesn't let us provide a message and
// see the error.
$this->assertTrue(TRUE, $message);
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
$this->assertStringContainsString($content_type, $response->headers->get('Content-type'));
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode(), $message);
$this->assertStringContainsString($content_type, $response->headers->get('Content-type'), $message);
}
}

View File

@ -585,7 +585,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa
}
$definition = $container->getDefinition($id);
$definition->clearTag('needs_destruction');
$container->setDefinition("simpletest.$route_provider_service_name", $definition);
$container->setDefinition("test.$route_provider_service_name", $definition);
$route_provider_definition = new Definition(RouteProvider::class);
$route_provider_definition->setPublic(TRUE);

View File

@ -21,7 +21,7 @@ class RouteProvider implements PreloadableRouteProviderInterface {
protected function lazyLoadItself() {
if (!isset($this->service)) {
$container = \Drupal::getContainer();
$this->service = $container->get('simpletest.router.route_provider');
$this->service = $container->get('test.router.route_provider');
$container->get('router.builder')->rebuild();
}

View File

@ -417,7 +417,7 @@ abstract class BrowserTestBase extends TestCase {
}
/**
* Clean up the Simpletest environment.
* Clean up the test environment.
*/
protected function cleanupEnvironment() {
// Remove all prefixed tables.
@ -544,7 +544,7 @@ abstract class BrowserTestBase extends TestCase {
}
/**
* Installs Drupal into the Simpletest site.
* Installs Drupal into the test site.
*/
public function installDrupal() {
$this->initUserSession();

View File

@ -868,12 +868,9 @@ class ContainerTest extends TestCase {
$services['synthetic'] = [
'synthetic' => TRUE,
];
// The file could have been named as a .php file. The reason it is a .data
// file is that SimpleTest tries to load it. SimpleTest does not like such
// fixtures and hence we use a neutral name like .data.
$services['container_test_file_service_test'] = [
'class' => '\stdClass',
'file' => __DIR__ . '/Fixture/container_test_file_service_test_service_function.data',
'file' => __DIR__ . '/Fixture/container_test_file_service_test_service_function.php',
];
// Test multiple arguments.

View File

@ -76,7 +76,7 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
*/
public function testSecurity() {
$php = new $this->storageClass($this->settings);
$name = 'simpletest.php';
$name = 'test.php';
$php->save($name, '<?php');
$expected_root_directory = $this->directory . '/test';
if (substr($name, -4) === '.php') {

View File

@ -583,7 +583,7 @@ class XssTest extends TestCase {
* Asserts that a text transformed to lowercase with HTML entities decoded does contain a given string.
*
* Otherwise fails the test with a given message, similar to all the
* SimpleTest assert* functions.
* PHPUnit assert* functions.
*
* Note that this does not remove nulls, new lines and other characters that
* could be used to obscure a tag or an attribute name.
@ -605,7 +605,7 @@ class XssTest extends TestCase {
* Asserts that text transformed to lowercase with HTML entities decoded does not contain a given string.
*
* Otherwise fails the test with a given message, similar to all the
* SimpleTest assert* functions.
* PHPUnit assert* functions.
*
* Note that this does not remove nulls, new lines, and other character that
* could be used to obscure a tag or an attribute name.

View File

@ -444,14 +444,14 @@ class EntityResolverManagerTest extends UnitTestCase {
$definition = $this->createMock('Drupal\Core\Entity\EntityTypeInterface');
$definition->expects($this->any())
->method('getClass')
->will($this->returnValue('Drupal\Tests\Core\Entity\SimpleTestEntity'));
->will($this->returnValue('Drupal\Tests\Core\Entity\TestEntity'));
$definition->expects($this->any())
->method('isRevisionable')
->willReturn(FALSE);
$revisionable_definition = $this->createMock('Drupal\Core\Entity\EntityTypeInterface');
$revisionable_definition->expects($this->any())
->method('getClass')
->will($this->returnValue('Drupal\Tests\Core\Entity\SimpleTestEntity'));
->will($this->returnValue('Drupal\Tests\Core\Entity\TestEntity'));
$revisionable_definition->expects($this->any())
->method('isRevisionable')
->willReturn(TRUE);
@ -500,7 +500,7 @@ class BasicControllerClass {
/**
* A concrete entity.
*/
class SimpleTestEntity extends EntityBase {
class TestEntity extends EntityBase {
}

View File

@ -24,7 +24,7 @@ class MenuLinkMock extends MenuLinkBase {
'options' => [],
'expanded' => '0',
'enabled' => '1',
'provider' => 'simpletest',
'provider' => 'test',
'metadata' => [
'cache_contexts' => [],
'cache_tags' => [],

View File

@ -46,7 +46,7 @@ class RendererBubblingTest extends RendererTestBase {
$element = [
'#type' => 'container',
'#cache' => [
'keys' => ['simpletest', 'renderer', 'children_attached'],
'keys' => ['test', 'renderer', 'children_attached'],
],
'#attached' => ['library' => ['test/parent']],
'#title' => 'Parent',
@ -68,7 +68,7 @@ class RendererBubblingTest extends RendererTestBase {
// Load the element from cache and verify the presence of the #attached
// JavaScript.
$element = ['#cache' => ['keys' => ['simpletest', 'renderer', 'children_attached']]];
$element = ['#cache' => ['keys' => ['test', 'renderer', 'children_attached']]];
// Verify that the element was retrieved from the cache.
$this->assertNotEmpty($this->renderer->renderRoot($element));
$this->assertEquals($element['#attached']['library'], $expected_libraries, 'The element, child and subchild #attached libraries are included.');

View File

@ -1024,7 +1024,7 @@ HTML;
$this->assertSame($element['#attached']['drupalSettings'], $expected_js_settings, '#attached is modified; both the original JavaScript setting and the ones added by each placeholder #lazy_builder callback exist.');
// GET request: validate cached data.
$cached_element = $this->memoryCache->get('simpletest:renderer:children_placeholders')->data;
$cached_element = $this->memoryCache->get('test:renderer:children_placeholders')->data;
$expected_element = [
'#attached' => [
'drupalSettings' => [
@ -1095,7 +1095,7 @@ HTML;
$test_element = [
'#type' => 'details',
'#cache' => [
'keys' => ['simpletest', 'renderer', 'children_placeholders'],
'keys' => ['test', 'renderer', 'children_placeholders'],
],
'#title' => 'Parent',
'#attached' => [

View File

@ -88,14 +88,14 @@ class TestDiscoveryTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\Tests\ExampleSimpleTest',
'name' => 'Drupal\Tests\ExampleTest',
'group' => 'test',
'groups' => ['test'],
'description' => 'Example test.',
'type' => 'PHPUnit-Unit',
],
// Classname.
'Drupal\Tests\ExampleSimpleTest',
'Drupal\Tests\ExampleTest',
// Doc block.
"/**
* Example test.
@ -110,14 +110,14 @@ class TestDiscoveryTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\Tests\ExampleSimpleTest',
'name' => 'Drupal\Tests\ExampleTest',
'group' => 'test',
'groups' => ['test'],
'description' => 'Example test. * @',
'type' => 'PHPUnit-Unit',
],
// Classname.
'Drupal\Tests\ExampleSimpleTest',
'Drupal\Tests\ExampleTest',
// Doc block.
"/**
* Example test. * @
@ -131,14 +131,14 @@ class TestDiscoveryTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\Tests\ExampleSimpleTest',
'name' => 'Drupal\Tests\ExampleTest',
'group' => 'test1',
'groups' => ['test1', 'test2'],
'description' => 'Example test.',
'type' => 'PHPUnit-Unit',
],
// Classname.
'Drupal\Tests\ExampleSimpleTest',
'Drupal\Tests\ExampleTest',
// Doc block.
"/**
* Example test.
@ -153,14 +153,14 @@ class TestDiscoveryTest extends UnitTestCase {
$tests['many-group-annotations'] = [
// Expected result.
[
'name' => 'Drupal\Tests\ExampleSimpleTest',
'name' => 'Drupal\Tests\ExampleTest',
'group' => 'test1',
'groups' => ['test1', 'test2', 'another', 'more', 'many', 'enough', 'whoa'],
'description' => 'Example test.',
'type' => 'PHPUnit-Unit',
],
// Classname.
'Drupal\Tests\ExampleSimpleTest',
'Drupal\Tests\ExampleTest',
// Doc block.
"/**
* Example test.
@ -180,14 +180,14 @@ class TestDiscoveryTest extends UnitTestCase {
$tests[] = [
// Expected result.
[
'name' => 'Drupal\Tests\ExampleSimpleTest',
'name' => 'Drupal\Tests\ExampleTest',
'description' => 'Example test. And the summary line continues and there is no gap to the annotation.',
'type' => 'PHPUnit-Unit',
'group' => 'test',
'groups' => ['test'],
],
// Classname.
'Drupal\Tests\ExampleSimpleTest',
'Drupal\Tests\ExampleTest',
// Doc block.
"/**
* Example test. And the summary line continues and there is no gap to the
@ -475,7 +475,7 @@ EOF;
// analysis and already have an empty docblock. getTestInfo() will throw
// MissingGroupException because the annotation is empty.
$this->expectException(MissingGroupException::class);
TestDiscovery::getTestInfo('Drupal\Tests\simpletest\ThisTestDoesNotExistTest', '');
TestDiscovery::getTestInfo('Drupal\Tests\ThisTestDoesNotExistTest', '');
}
/**

View File

@ -21,10 +21,10 @@ trait RandomGeneratorTrait {
*
* Do not use this method when special characters are not possible (e.g., in
* machine or file names that have already been validated); instead, use
* \Drupal\simpletest\TestBase::randomMachineName(). If $length is greater
* than 3 the random string will include at least one ampersand ('&') and
* at least one greater than ('>') character to ensure coverage for special
* characters and avoid the introduction of random test failures.
* \Drupal\Tests\RandomGeneratorTrait::randomMachineName(). If $length is
* greater than 3 the random string will include at least one ampersand ('&')
* and at least one greater than ('>') character to ensure coverage for
* special characters and avoid the introduction of random test failures.
*
* @param int $length
* Length of random string to generate.
@ -79,7 +79,7 @@ trait RandomGeneratorTrait {
* Generates a unique random string containing letters and numbers.
*
* Do not use this method when testing unvalidated user input. Instead, use
* \Drupal\simpletest\TestBase::randomString().
* \Drupal\Tests\RandomGeneratorTrait::randomString().
*
* @param int $length
* Length of random string to generate.

View File

@ -1 +1 @@
<h1>SimpleTest HTML</h1>
<h1>Test HTML</h1>

View File

@ -1 +1 @@
<h1>SimpleTest HTML</h1>
<h1>Test HTML</h1>

View File

@ -1,3 +1,3 @@
<script>
alert('SimpleTest PHP was executed!');
alert('JavaScript was executed!');
</script>

View File

@ -1,3 +1,3 @@
<script>
alert('SimpleTest PHP was executed!');
</script>
alert('JavaScript was executed!');
</script>

View File

@ -1,4 +1,4 @@
<?php
// phpcs:ignoreFile
print 'SimpleTest PHP was executed!';
print 'PHP was executed!';
?>

View File

@ -1,3 +1,3 @@
<?php
// phpcs:ignoreFile
print 'SimpleTest PHP was executed!';
print 'PHP was executed!';

View File

@ -25,7 +25,7 @@ sites/*/services*.yml
sites/*/files
sites/*/private
# Ignore SimpleTest multi-site environment.
# Ignore multi-site test environment.
sites/simpletest
# If you prefer to store your .gitignore file in the sites/ folder, comment
@ -38,5 +38,5 @@ sites/simpletest
# */files
# */private
# Ignore SimpleTest multi-site environment.
# Ignore multi-site test environment.
# simpletest