Checks that users with "translate own content" role only can translate own content.
function testTranslateOwnContentRole() {
// Create a Basic page in English and its translation in Spanish with user
// that has "translate own content" role.
$this
->drupalLogin($this->limited_translator);
$node = $this
->createPage($this
->randomName(), $this
->randomName(), 'en');
$this
->assertLinkByHref('node/' . $node->nid . '/translate', 0, 'User with "translate own content" role can see translate link');
$this
->drupalGet('node/' . $node->nid . '/translate');
$this
->assertResponse(200, 'User with "translate own content" role can get translate page');
$translation_es = $this
->createTranslation($node, $this
->randomName(), $this
->randomName(), 'es');
// Create a page as translator user.
$this
->drupalLogin($this->translator);
$node = $this
->createPage($this
->randomName(), $this
->randomName(), 'en');
// Change to limited_translator and check that translate links aren't shown.
$this
->drupalLogin($this->limited_translator);
$this
->assertNoLinkByHref('node/' . $node->nid . '/translate', 'User with "translate own content" role can\'t see translate link');
// Check if user with "translate own content" role can see translate page
// from other user's node.
$this
->drupalGet('node/' . $node->nid . '/translate');
$this
->assertResponse(403, 'User with "translate own content" role can\'t get translate page');
// Try to change to translate with "brute force".
$this
->drupalGet('node/add/page', array(
'query' => array(
'translation' => $node->nid,
'target' => 'es',
),
));
$this
->assertResponse(403, 'User with "translate own content" role can\'t get create translate page');
}