ViewsTest.php

Same filename in this branch
  1. 11.x core/modules/views/tests/src/Unit/ViewsTest.php
Same filename and directory in other branches
  1. 9 core/modules/views/tests/src/Unit/ViewsTest.php
  2. 8.9.x core/modules/views/tests/src/Unit/ViewsTest.php
  3. 10 core/modules/views/tests/src/Unit/ViewsTest.php

Namespace

Drupal\Tests\mysql\Kernel\mysql

File

core/modules/mysql/tests/src/Kernel/mysql/ViewsTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\mysql\Kernel\mysql;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\KernelTests\Core\Database\DriverSpecificDatabaseTestBase;
use Drupal\mysql\Plugin\views\query\MysqlCastSql;

/**
 * Tests views service.
 *
 * @group Database
 */
class ViewsTest extends DriverSpecificDatabaseTestBase {
  
  /**
   * Tests views service.
   */
  public function testViewsService() : void {
    $this->assertFalse($this->container
      ->has('views.cast_sql'));
    $this->enableModules([
      'views',
    ]);
    $this->assertInstanceOf(MysqlCastSql::class, $this->container
      ->get('views.cast_sql'));
    $this->assertFalse($this->container
      ->has('mysql.views.cast_sql'));
  }
  
  /**
   * {@inheritdoc}
   */
  public function register(ContainerBuilder $container) : void {
    parent::register($container);
    $this->assertSame($container->hasDefinition('mysql.views.cast_sql'), isset($container->getParameter('container.modules')['views']));
  }

}

Classes

Title Deprecated Summary
ViewsTest Tests views service.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.