Problem
WebTestBase::setUp()
installs Drupal through the interactive installer, and creates a fake user object for uid 1 and makes that available as$this->root_user
, but the object does not contain a uid.- The lack of a uid breaks
WebTestBase::drupalCreateNode()
, which tries to use the uid of the currently logged in user (which may be $this->root_user).
Proposed solution
- Just add a ::$uid property with value 1 there.
- No need to (re)load the entire entity of uid 1 (performance). It's OK if
$this->root_user
is a mock stdClass object. - No need for adding tests for this.
Attachment | Size | Status | Test result | Operations |
---|---|---|---|---|
drupal8.test-root-user-uid.0.patch | 617 bytes | Idle | PASSED: [[SimpleTest]]: [MySQL] 49,315 pass(es). | View details | Re-test |