Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor3/web/modules/contrib/visitors/tests/src/Unit/

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/modules/contrib/visitors/tests/src/Unit/HookEntityDeleteTest.php

<?php

namespace Drupal\Tests\visitors\Unit;

use Drupal\Tests\UnitTestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;

require_once __DIR__ . '/../../../visitors.module';

/**
 * Tests hook_entity_delete().
 *
 * @group visitors
 */
class HookEntityDeleteTest extends UnitTestCase {

  /**
   * The counter service.
   *
   * @var \Drupal\visitors\VisitorsCounterInterface|\PHPUnit\Framework\MockObject\MockObject
   */
  protected $counter;

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();

    $container = new ContainerBuilder();

    $string_translation = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface');
    $container->set('string_translation', $string_translation);

    $this->counter = $this->createMock('Drupal\visitors\VisitorsCounterInterface');
    $container->set('visitors.counter', $this->counter);

    \Drupal::setContainer($container);
  }

  /**
   * Tests hook_entity_delete().
   */
  public function testConfigEntity(): void {
    $node_type = $this->createMock('Drupal\node\NodeTypeInterface');
    $node_type->expects($this->once())
      ->method('id')
      ->willReturn('page');
    $this->counter->expects($this->never())
      ->method('deleteViews');

    visitors_entity_delete($node_type);
  }

  /**
   * Tests hook_entity_delete().
   */
  public function testNodeEntity(): void {
    $node = $this->createMock('Drupal\node\NodeInterface');
    $node->expects($this->once())
      ->method('getEntityTypeId')
      ->willReturn('node');
    $node->expects($this->once())
      ->method('id')
      ->willReturn(1);

    $this->counter->expects($this->once())
      ->method('deleteViews')
      ->with('node', 1);

    visitors_entity_delete($node);
  }

}

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