class ViewsLegacyTest
Tests deprecated views functionality.
@group views @group legacy
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Kernel\ViewsLegacyTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ViewsLegacyTest
File
-
core/
modules/ views/ tests/ src/ Kernel/ ViewsLegacyTest.php, line 16
Namespace
Drupal\Tests\views\KernelView source
class ViewsLegacyTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'views',
];
/**
* Tests the Time cache plugin.
*/
public function testTimeCache() {
$request = Request::createFromGlobals();
$this->expectDeprecation('The request object must not be passed to Drupal\\views\\Plugin\\views\\cache\\Time::__construct(). It is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/3154016');
$plugin = new Time([], 'time', \Drupal::service('plugin.manager.views.cache')->getDefinition('time'), \Drupal::service('date.formatter'), $request);
$view = $this->prophesize(ViewExecutable::class);
$view->getRequest()
->willReturn($request);
$plugin->view = $view->reveal();
$this->assertInstanceOf(Request::class, $plugin->request);
$this->expectDeprecation('The request property of Drupal\\views\\Plugin\\views\\cache\\Time is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/3154016');
$this->assertSame($request, $plugin->request);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.