This comes from #1904508: Convert JSON-LD tests to DrupalUnitTestBase, where I was converting a WebTest to a DrupalUnitTest. The test passed when run in the UI, but not when run by run-tests.sh. This is because it was using the global user object, which is different in those two cases.

Since this is difficult to debug, I suggest we simply do not provide access to the global user when doing UnitTests.

CommentFileSizeAuthor
#1 1905564-01-global-user.patch1.15 KBlinclark

Comments

Anonymous’s picture

Component: base system » simpletest.module
Status: Active » Needs review
StatusFileSize
new1.15 KB

I tested this in the browser to ensure it didn't break the interaction there, and it still works. It now gives an exception if you try to access the global user (which it didn't before) and points you to the line where the global user is used.

Status: Needs review » Needs work

The last submitted patch, 1905564-01-global-user.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review

#1: 1905564-01-global-user.patch queued for re-testing.

berdir’s picture

Status: Needs review » Closed (duplicate)

#1950684: Mock and protect $GLOBALS['user'] in DUTB tests changed the default global user to anonymous in DUBT tests, to enforce a common environment. I think this is no longer necessary/duplicating that effort. The fact that tests suddenly passt underlines that IMHO.