Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295019

Email address of user 1 is placeholder-for-uid-1 during tests, which is not a well-formed mail address

$
0
0

In Drupal 8, in the function WebTestBase::setUp() sets up user 1 to have rational values:

<?php
    // Define information about the user 1 account.
    $this->root_user = new UserSession(array(
      'uid' => 1,
      'name' => 'admin',
      'mail' => 'admin@example.com',
      'pass_raw' => $this->randomName(),
    ));
?>

The same is not true in Drupal 7's DrupalWebTestCase::setUp(), which means that during tests, user 1 has the following values:

select uid, name, mail from simpletest508334users where uid=1;
+-----+-----------------------+-----------------------+
| uid | name                  | mail                  |
+-----+-----------------------+-----------------------+
|   1 | placeholder-for-uid-1 | placeholder-for-uid-1 |
+-----+-----------------------+-----------------------+
1 row in set (0.00 sec)

In most cases this will go unnoticed, but it is not unreasonable for modules to _assume_ that all users have a well-formed email address.

Proposed solution:

(1) Create a well-formed email address for user 1 during testing, as in D8
(2) Make sure the email address of user 1 is never placeholder-for-uid-1 to begin with, perhaps use placeholder-for-uid-1@example.com instead? (this second point being outside the scope of this issue though, perhaps)


Viewing all articles
Browse latest Browse all 295019

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>