Test content entity source anonymous access.
public function testEntitySourceAnonymousAccess() {
// Create translatable node.
$node = $this
->createTranslatableNode('page', 'en');
$job = $this
->createJob('en', 'de');
$job->translator = $this->default_translator
->id();
$job
->save();
$job_item = tmgmt_job_item_create('content', $node
->getEntityTypeId(), $node
->id(), array(
'tjid' => $job
->id(),
));
$job_item
->save();
// Anonymous view of content entities.
$node
->setUnpublished();
$node
->save();
$this
->drupalLogout();
$url = $job_item
->getSourceUrl();
$this
->drupalGet($url);
$this
->assertSession()
->statusCodeEquals(200);
\Drupal::configFactory()
->getEditable('tmgmt.settings')
->set('anonymous_access', FALSE)
->save();
$this
->drupalGet($url);
$this
->assertSession()
->statusCodeEquals(403);
\Drupal::configFactory()
->getEditable('tmgmt.settings')
->set('anonymous_access', TRUE)
->save();
$this
->drupalGet($url);
$this
->assertSession()
->statusCodeEquals(200);
$job
->aborted();
$this
->drupalGet($url);
$this
->assertSession()
->statusCodeEquals(403);
}