This code appears in several tests:

    // Grant the flag permissions to the authenticated role, so that both
    // users have the same roles and share the render cache.
    ... etc etc

In FlagSimpleTest, it serves a purpose. In the other tests it appears, it does nothing. Either it was copy-pasted over when writing tests, or those tests were meant to make use of it and not completed.

Either the tests need to be expanded to check the render cache, or the code should be removed.

Comments

socketwench’s picture

We do login as the user immediately after creating it so it doesn't seem pointless to me unless I'm missing something.

Also, I what were you thinking about testing the render cache? It's part of Drupal 8 core, so the only part of it we need to "test" is if the cache is invalidated properly on flagging and unflagging a node. This is done implicitly by the tests already.

If I could, I'd rip out nearly all of the tests and rewrite them in Behat. They'd be 10 times shorter and easier to maintain, but that's not quite ready yet in core.

socketwench’s picture

Status: Active » Closed (outdated)

I think this can be closed. When we refactored the flag tests to use FlagTestBase, this particular problem was cleaned up. The referenced code does still exist in the LinkType* tests.