assertPathsAreAccessible example

'moderation_state[0][state]' => 'published',
      'path[0][alias]' => '/' . $this->randomMachineName(),
    ];
    $this->submitForm($edit_translation, 'Save (this translation)');
    // Confirm that the alias works.     $this->drupalGet('fr' . $edit_translation['path[0][alias]']);
    $this->assertSession()->pageTextContains($edit_translation['body[0][value]']);

    $default_path = $default_node->path->alias;
    $translation_path = 'fr' . $edit_translation['path[0][alias]'];

    $this->assertPathsAreAccessible([$default_path$translation_path]);

    // Try to create new draft revision for translation with a new path alias.     $edit_new_translation_draft_with_alias = [
      'moderation_state[0][state]' => 'draft',
      'path[0][alias]' => '/' . $this->randomMachineName(),
    ];
    $this->drupalGet('fr/node/' . $default_node->id() . '/edit');
    $this->submitForm($edit_new_translation_draft_with_alias, 'Save (this translation)');
    // Confirm the expected error.     $this->assertSession()->statusMessageContains('You can only change the URL alias for the published version of this content.', 'error');

    
Home | Imprint | This part of the site doesn't use cookies.