createCommentType example

$this->drupalPlaceBlock('page_title_block');

    $this->adminUser = $this->drupalCreateUser($this->permissions);
  }

  /** * Tests creating a comment type programmatically and via a form. */
  public function testCommentTypeCreation() {
    // Create a comment type programmatically.     $type = $this->createCommentType('other');

    $comment_type = CommentType::load('other');
    $this->assertInstanceOf(CommentType::class$comment_type);

    // Log in a test user.     $this->drupalLogin($this->adminUser);

    // Ensure that the new comment type admin page can be accessed.     $this->drupalGet('admin/structure/comment/manage/' . $type->id());
    $this->assertSession()->statusCodeEquals(200);

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