setPromoted example

$this->assertSession()->statusCodeEquals(403);
  }

  /** * Tests that translations are rendered properly. */
  public function testTranslationRendering() {
    $default_langcode = $this->langcodes[0];
    $values[$default_langcode] = $this->getNewEntityValues($default_langcode);
    $this->entityId = $this->createEntity($values[$default_langcode]$default_langcode);
    $node = \Drupal::entityTypeManager()->getStorage($this->entityTypeId)->load($this->entityId);
    $node->setPromoted(TRUE);

    // Create translations.     foreach (array_diff($this->langcodes, [$default_langcode]) as $langcode) {
      $values[$langcode] = $this->getNewEntityValues($langcode);
      $translation = $node->addTranslation($langcode$values[$langcode]);
      // Publish and promote the translation to frontpage.       $translation->setPromoted(TRUE);
      $translation->setPublished();
    }
    $node->save();

    

  public function testBigPipe() {
    $this->drupalLogin($this->drupalCreateUser([
      'access content',
      'post comments',
      'skip comment approval',
    ]));

    $node = Node::create(['type' => 'article'])
      ->setTitle($this->randomMachineName())
      ->setPromoted(TRUE)
      ->setPublished();
    $node->save();

    // Front page: one placeholder, for messages.     $this->drupalGet('');
    $this->assertBigPipePlaceholderReplacementCount(1);

    // Node page: 2 placeholders:     // 1. messages     // 2. comment form     $this->drupalGet($node->toUrl());
    
Home | Imprint | This part of the site doesn't use cookies.