Closed (fixed)
Project:
Drupal core
Version:
8.6.x-dev
Component:
comment.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Apr 2017 at 11:39 UTC
Updated:
28 Jul 2018 at 21:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
jonathan1055 commentedUpdated the issue summary as I think you copied the wrong issue number. You meant that this is a follow-up from #2866513: Convert web tests to browser tests for comment module not #2809467: Convert \Drupal\comment\Tests\CommentPagerTest to BrowserTestBase
Comment #4
ApacheEx commentedFirst of all, I've exactly the same errors like it was discussed here: #2795049: Convert web tests to browser tests for history module.
The request gets 403, it is happening because the Guzzle request is from an unauthenticated (anon) user.
As a solution, I used the same code for
getHttpClient. I'm not sure if there is a better solution for now. Any ideas?Comment #6
dawehnerLet's use
assertSamehereDo we want to wait on #2911915: Add getHttpClient() to BrowserTestBase?
Comment #7
borisson_Fixed #6.1, the second point is not something I think we should wait for.
Comment #9
ApacheEx commentedHere is updated patch.
Changes:
1) Make right order of method getHttpClient
2) use BTB getHttpClient instead of
$this->getSession()->getDriver()->getClient()->getClient()I think that's all what can we do here.
Comment #10
borisson_Looks great, I don't think I can RTBC this as I've also supplied a patch.
Comment #11
dawehnerIs there a reason we don't move this to the parent method? It feels sensible to inherit the cookies automatically
Comment #12
ApacheEx commentedlet's wait when #2983504: Add a way to easily set the cookies in a request done using the Guzzle client lands and update the patch again
Comment #13
ApacheEx commentedYay, it lands. Patch is much cleaner now.
Comment #14
dawehnerNitpick: You should be able to call
$this->buildUrl, it should prepare the url into a string which can be used.It is overall much nicer, I agree.
Comment #15
ApacheEx commentedNice tip. Thanks.
I've updated a patch.
Comment #16
lendudeThis looks so much cleaner then the webtest version, very nice.
Comment #17
alexpottCommitted and pushed f45132741a to 8.7.x and 99de45529d to 8.6.x. Thanks!