Commit 286c1b57 authored by catch's avatar catch
Browse files

Issue #3130811 by mondrake, jungle, longwave, ravi.shankar: Remove redundant...

Issue #3130811 by mondrake, jungle, longwave, ravi.shankar: Remove redundant $message from assert(Not)InstanceOf calls
parent 8e265e8f
......@@ -88,7 +88,7 @@ protected function setUp() {
protected function assertEntity($id, $label, $mail, $password, $created, $access, $login, $blocked, $entity_langcode, $prefered_langcode, $timezone, $init, $roles, $field_integer, $field_file_target_id = FALSE, $has_picture = FALSE) {
/** @var \Drupal\user\UserInterface $user */
$user = User::load($id);
$this->assertTrue($user instanceof UserInterface);
$this->assertInstanceOf(UserInterface::class, $user);
$this->assertSame($label, $user->label());
$this->assertSame($mail, $user->getEmail());
$this->assertSame($password, $user->getPassword());
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\views\Functional\Handler;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\Tests\views\Functional\ViewTestBase;
use Drupal\views\Plugin\views\filter\NumericFilter;
......@@ -111,12 +110,7 @@ public function testHandlers() {
foreach ($object_types as $type) {
if (isset($view->{$type})) {
foreach ($view->{$type} as $handler) {
$this->assertTrue($handler instanceof HandlerBase, new FormattableMarkup(
'@type handler of class %class is an instance of HandlerBase',
[
'@type' => $type,
'%class' => get_class($handler),
]));
$this->assertInstanceOf(HandlerBase::class, $handler);
}
}
}
......
......@@ -382,7 +382,7 @@ public function testAccess() {
foreach ($views_data['access_callback'] as $type => $info) {
if (!in_array($type, ['title', 'help'])) {
$this->assertTrue($view->field['access_callback'] instanceof HandlerBase, 'Make sure the user got access to the access_callback field ');
$this->assertInstanceOf(HandlerBase::class, $view->field['access_callback']);
$this->assertFalse(isset($view->field['access_callback_arguments']), 'Make sure the user got no access to the access_callback_arguments field ');
}
}
......@@ -397,7 +397,7 @@ public function testAccess() {
foreach ($views_data['access_callback'] as $type => $info) {
if (!in_array($type, ['title', 'help'])) {
$this->assertFalse(isset($view->field['access_callback']), 'Make sure the user got no access to the access_callback field ');
$this->assertTrue($view->field['access_callback_arguments'] instanceof HandlerBase, 'Make sure the user got access to the access_callback_arguments field ');
$this->assertInstanceOf(HandlerBase::class, $view->field['access_callback_arguments']);
}
}
}
......
......@@ -68,7 +68,7 @@ public function testArgumentDefaultPlugin() {
$id = $view->addHandler('default', 'argument', 'views_test_data', 'name', $options);
$view->initHandlers();
$plugin = $view->argument[$id]->getPlugin('argument_default');
$this->assertTrue($plugin instanceof ArgumentDefaultTestPlugin, 'The correct argument default plugin is used.');
$this->assertInstanceOf(ArgumentDefaultTestPlugin::class, $plugin);
// Check that the value of the default argument is as expected.
$this->assertEqual($view->argument[$id]->getDefaultArgument(), 'John', 'The correct argument default value is returned.');
......
......@@ -86,7 +86,7 @@ public function testBlockContext() {
// Check if context was correctly propagated to the block.
$definition = $this->container->get('plugin.manager.block')
->getDefinition('views_block:test_view_block_with_context-block_1');
$this->assertTrue($definition['context_definitions']['nid'] instanceof ContextDefinitionInterface);
$this->assertInstanceOf(ContextDefinitionInterface::class, $definition['context_definitions']['nid']);
/** @var \Drupal\Core\Plugin\Context\ContextDefinitionInterface $context */
$context = $definition['context_definitions']['nid'];
$this->assertEqual($context->getDataType(), 'entity:node', 'Context definition data type is correct.');
......@@ -133,21 +133,21 @@ public function testBlockContext() {
// based on the numeric plugin and the other based on numeric validation.
$definition = $this->container->get('plugin.manager.block')
->getDefinition('views_block:test_view_block_with_context-block_2');
$this->assertTrue($definition['context_definitions']['created'] instanceof ContextDefinitionInterface);
$this->assertInstanceOf(ContextDefinitionInterface::class, $definition['context_definitions']['created']);
/** @var \Drupal\Core\Plugin\Context\ContextDefinitionInterface $context */
$context = $definition['context_definitions']['created'];
$this->assertEqual($context->getDataType(), 'integer', 'Context definition data type is correct.');
$this->assertEqual($context->getLabel(), 'Content: Authored on', 'Context definition label is correct.');
$this->assertFalse($context->isRequired(), 'Context is not required.');
$this->assertTrue($definition['context_definitions']['vid'] instanceof ContextDefinitionInterface);
$this->assertInstanceOf(ContextDefinitionInterface::class, $definition['context_definitions']['vid']);
/** @var \Drupal\Core\Plugin\Context\ContextDefinitionInterface $context */
$context = $definition['context_definitions']['vid'];
$this->assertEqual($context->getDataType(), 'integer', 'Context definition data type is correct.');
$this->assertEqual($context->getLabel(), 'Content: Revision ID', 'Context definition label is correct.');
$this->assertFalse($context->isRequired(), 'Context is not required.');
$this->assertTrue($definition['context_definitions']['title'] instanceof ContextDefinitionInterface);
$this->assertInstanceOf(ContextDefinitionInterface::class, $definition['context_definitions']['title']);
/** @var \Drupal\Core\Plugin\Context\ContextDefinitionInterface $context */
$context = $definition['context_definitions']['title'];
$this->assertEqual($context->getDataType(), 'string', 'Context definition data type is correct.');
......
......@@ -94,7 +94,7 @@ public function testDisplayPlugin() {
$view->setDisplay('display_test_1');
$this->assertTrue($view->display_handler instanceof DisplayTestPlugin, 'The correct display handler instance is on the view object.');
$this->assertInstanceOf(DisplayTestPlugin::class, $view->display_handler);
// Check the test option.
$this->assertIdentical($view->display_handler->getOption('test_option'), '');
......
......@@ -61,7 +61,7 @@ protected function viewsData() {
public function testFilterQuery() {
// Check that we can find the test filter plugin.
$plugin = $this->container->get('plugin.manager.views.filter')->createInstance('test_filter');
$this->assertTrue($plugin instanceof FilterPlugin, 'Test filter plugin found.');
$this->assertInstanceOf(FilterPlugin::class, $plugin);
$view = Views::getView('test_filter');
$view->initDisplay();
......
......@@ -229,8 +229,8 @@ public function testSimpleExecute() {
$executable = Views::getView('test_field_field_test');
$executable->execute();
$this->assertTrue($executable->field['id'] instanceof EntityField);
$this->assertTrue($executable->field['field_test'] instanceof EntityField);
$this->assertInstanceOf(EntityField::class, $executable->field['id']);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test']);
$this->assertIdenticalResultset($executable,
[
......@@ -299,9 +299,9 @@ public function testFieldAlias() {
$executable = Views::getView('test_field_alias_test');
$executable->execute();
$this->assertTrue($executable->field['id'] instanceof EntityField);
$this->assertTrue($executable->field['name'] instanceof EntityField);
$this->assertTrue($executable->field['name_alias'] instanceof EntityField);
$this->assertInstanceOf(EntityField::class, $executable->field['id']);
$this->assertInstanceOf(EntityField::class, $executable->field['name']);
$this->assertInstanceOf(EntityField::class, $executable->field['name_alias']);
$this->assertIdenticalResultset($executable,
[
......@@ -348,10 +348,10 @@ public function testComplexExecute() {
$timezones[] = $user->getTimeZone();
}
$this->assertTrue($executable->field['field_test_multiple'] instanceof EntityField);
$this->assertTrue($executable->field['field_test_multiple_1'] instanceof EntityField);
$this->assertTrue($executable->field['field_test_multiple_2'] instanceof EntityField);
$this->assertTrue($executable->field['timezone'] instanceof EntityField);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple']);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple_1']);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple_2']);
$this->assertInstanceOf(EntityField::class, $executable->field['timezone']);
$this->assertIdenticalResultset($executable,
[
......@@ -421,8 +421,8 @@ public function testRevisionExecute() {
$executable = Views::getView('test_field_field_revision_test');
$executable->execute();
$this->assertTrue($executable->field['name'] instanceof EntityField);
$this->assertTrue($executable->field['field_test'] instanceof EntityField);
$this->assertInstanceOf(EntityField::class, $executable->field['name']);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test']);
$this->assertIdenticalResultset($executable,
[
......@@ -475,12 +475,12 @@ public function testRevisionComplexExecute() {
$timezones[] = $user->getTimeZone();
}
$this->assertTrue($executable->field['id'] instanceof EntityField);
$this->assertTrue($executable->field['revision_id'] instanceof EntityField);
$this->assertTrue($executable->field['timezone'] instanceof EntityField);
$this->assertTrue($executable->field['field_test_multiple'] instanceof EntityField);
$this->assertTrue($executable->field['field_test_multiple_1'] instanceof EntityField);
$this->assertTrue($executable->field['field_test_multiple_2'] instanceof EntityField);
$this->assertInstanceOf(EntityField::class, $executable->field['id']);
$this->assertInstanceOf(EntityField::class, $executable->field['revision_id']);
$this->assertInstanceOf(EntityField::class, $executable->field['timezone']);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple']);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple_1']);
$this->assertInstanceOf(EntityField::class, $executable->field['field_test_multiple_2']);
$this->assertIdenticalResultset($executable,
[
......
......@@ -76,7 +76,7 @@ public function testViewsGetHandler() {
'field' => 'job',
];
$handler = $this->container->get('plugin.manager.views.filter')->getHandler($item, 'standard');
$this->assertTrue($handler instanceof Standard);
$this->assertInstanceOf(Standard::class, $handler);
// @todo Reinstate these tests when the debug() in views_get_handler() is
// restored.
......
......@@ -57,7 +57,7 @@ public function testArgumentValidatorPlugin() {
$this->assertTrue($argument->validateArgument($test_value), 'The right argument validates.');
$plugin = $argument->getPlugin('argument_validator');
$this->assertTrue($plugin instanceof ArgumentValidatorTestPlugin, 'The correct argument validator plugin is used.');
$this->assertInstanceOf(ArgumentValidatorTestPlugin::class, $plugin);
$this->assertFalse($plugin->validateArgument($this->randomMachineName()), 'A random value does not validate.');
$this->assertTrue($plugin->validateArgument($test_value), 'The right argument validates.');
}
......
......@@ -108,7 +108,7 @@ public function testTimeResultCaching() {
public function testTimeResultCachingWithFilter() {
// Check that we can find the test filter plugin.
$plugin = $this->container->get('plugin.manager.views.filter')->createInstance('test_filter');
$this->assertTrue($plugin instanceof FilterPlugin, 'Test filter plugin found.');
$this->assertInstanceOf(FilterPlugin::class, $plugin);
$view = Views::getView('test_filter');
$view->initDisplay();
......
......@@ -35,7 +35,7 @@ public function testDisplayExtenders() {
$this->assertEqual(count($view->display_handler->getExtenders()), 1, 'Make sure that only one extender is initialized.');
$display_extender = $view->display_handler->getExtenders()['display_extender_test'];
$this->assertTrue($display_extender instanceof DisplayExtenderTestData, 'Make sure the right class got initialized.');
$this->assertInstanceOf(DisplayExtenderTestData::class, $display_extender);
$view->preExecute();
$this->assertTrue($display_extender->testState['preExecute'], 'Make sure the display extender was able to react on preExecute.');
......
......@@ -94,13 +94,13 @@ public function testGetPlugin() {
$view->initDisplay();
$display_handler = $view->display_handler;
$this->assertTrue($display_handler->getPlugin('access') instanceof AccessPluginBase, 'An access plugin instance was returned.');
$this->assertTrue($display_handler->getPlugin('cache') instanceof CachePluginBase, 'A cache plugin instance was returned.');
$this->assertTrue($display_handler->getPlugin('exposed_form') instanceof ExposedFormPluginInterface, 'An exposed_form plugin instance was returned.');
$this->assertTrue($display_handler->getPlugin('pager') instanceof PagerPluginBase, 'A pager plugin instance was returned.');
$this->assertTrue($display_handler->getPlugin('query') instanceof QueryPluginBase, 'A query plugin instance was returned.');
$this->assertTrue($display_handler->getPlugin('row') instanceof RowPluginBase, 'A row plugin instance was returned.');
$this->assertTrue($display_handler->getPlugin('style') instanceof StylePluginBase, 'A style plugin instance was returned.');
$this->assertInstanceOf(AccessPluginBase::class, $display_handler->getPlugin('access'));
$this->assertInstanceOf(CachePluginBase::class, $display_handler->getPlugin('cache'));
$this->assertInstanceOf(ExposedFormPluginInterface::class, $display_handler->getPlugin('exposed_form'));
$this->assertInstanceOf(PagerPluginBase::class, $display_handler->getPlugin('pager'));
$this->assertInstanceOf(QueryPluginBase::class, $display_handler->getPlugin('query'));
$this->assertInstanceOf(RowPluginBase::class, $display_handler->getPlugin('row'));
$this->assertInstanceOf(StylePluginBase::class, $display_handler->getPlugin('style'));
// Test that nothing is returned when an invalid type is requested.
$this->assertNull($display_handler->getPlugin('invalid'), 'NULL was returned for an invalid instance');
// Test that nothing was returned for an instance with no 'type' in options.
......
......@@ -63,7 +63,7 @@ public function testBase() {
'adjusted' => TRUE,
];
$join = $this->manager->createInstance($this->pluginId, $configuration);
$this->assertTrue($join instanceof FieldOrLanguageJoin);
$this->assertInstanceOf(FieldOrLanguageJoin::class, $join);
$this->assertNull($join->extra);
$this->assertTrue($join->adjusted);
......@@ -196,7 +196,7 @@ protected function buildJoin($view, $configuration, $table_alias) {
$query = \Drupal::database()->select('node');
$join = $this->manager->createInstance('field_or_language_join', $configuration);
$this->assertInstanceOf(FieldOrLanguageJoin::class, $join, 'The correct join class got loaded.');
$this->assertInstanceOf(FieldOrLanguageJoin::class, $join);
$table = ['alias' => $table_alias];
$join->buildJoin($query, $table, $view->query);
......
......@@ -54,7 +54,7 @@ public function testExamplePlugin() {
'field' => 'uid',
];
$join = $this->manager->createInstance('join_test', $configuration);
$this->assertTrue($join instanceof JoinTestPlugin, 'The correct join class got loaded.');
$this->assertInstanceOf(JoinTestPlugin::class, $join);
$rand_int = rand(0, 1000);
$join->setJoinValue($rand_int);
......@@ -88,7 +88,7 @@ public function testBasePlugin() {
'adjusted' => TRUE,
];
$join = $this->manager->createInstance('standard', $configuration);
$this->assertTrue($join instanceof JoinPluginBase, 'The correct join class got loaded.');
$this->assertInstanceOf(JoinPluginBase::class, $join);
$this->assertNull($join->extra, 'The field extra was not overridden.');
$this->assertTrue($join->adjusted, 'The field adjusted was set correctly.');
......
......@@ -44,7 +44,7 @@ public function _testInitQuery() {
$view->setDisplay();
$view->initQuery();
$this->assertInstanceOf(QueryTestPlugin::class, $view->query, 'Make sure the right query plugin got instantiated.');
$this->assertInstanceOf(QueryTestPlugin::class, $view->query);
}
public function _testQueryExecute() {
......
......@@ -100,9 +100,9 @@ protected function setUpFixtures() {
*/
public function testFactoryService() {
$factory = $this->container->get('views.executable');
$this->assertTrue($factory instanceof ViewExecutableFactory, 'A ViewExecutableFactory instance was returned from the container.');
$this->assertInstanceOf(ViewExecutableFactory::class, $factory);
$view = View::load('test_executable_displays');
$this->assertTrue($factory->get($view) instanceof ViewExecutable, 'A ViewExecutable instance was returned from the factory.');
$this->assertInstanceOf(ViewExecutable::class, $factory->get($view));
}
/**
......@@ -112,8 +112,8 @@ public function testInitMethods() {
$view = Views::getView('test_destroy');
$view->initDisplay();
$this->assertTrue($view->display_handler instanceof DefaultDisplay, 'Make sure a reference to the current display handler is set.');
$this->assertTrue($view->displayHandlers->get('default') instanceof DefaultDisplay, 'Make sure a display handler is created for each display.');
$this->assertInstanceOf(DefaultDisplay::class, $view->display_handler);
$this->assertInstanceOf(DefaultDisplay::class, $view->displayHandlers->get('default'));
$view->destroy();
$view->initHandlers();
......@@ -129,15 +129,15 @@ public function testInitMethods() {
}
// initHandlers() should create display handlers automatically as well.
$this->assertTrue($view->display_handler instanceof DefaultDisplay, 'Make sure a reference to the current display handler is set.');
$this->assertTrue($view->displayHandlers->get('default') instanceof DefaultDisplay, 'Make sure a display handler is created for each display.');
$this->assertInstanceOf(DefaultDisplay::class, $view->display_handler);
$this->assertInstanceOf(DefaultDisplay::class, $view->displayHandlers->get('default'));
$view_hash = spl_object_hash($view);
$display_hash = spl_object_hash($view->display_handler);
// Test the initStyle() method.
$view->initStyle();
$this->assertTrue($view->style_plugin instanceof DefaultStyle, 'Make sure a reference to the style plugin is set.');
$this->assertInstanceOf(DefaultStyle::class, $view->style_plugin);
// Test the plugin has been invited and view have references to the view and
// display handler.
$this->assertEqual(spl_object_hash($view->style_plugin->view), $view_hash);
......@@ -145,7 +145,7 @@ public function testInitMethods() {
// Test the initQuery method().
$view->initQuery();
$this->assertTrue($view->query instanceof Sql, 'Make sure a reference to the query is set');
$this->assertInstanceOf(Sql::class, $view->query);
$this->assertEqual(spl_object_hash($view->query->view), $view_hash);
$this->assertEqual(spl_object_hash($view->query->displayHandler), $display_hash);
......@@ -153,23 +153,23 @@ public function testInitMethods() {
// Test the plugin get methods.
$display_plugin = $view->getDisplay();
$this->assertTrue($display_plugin instanceof DefaultDisplay, 'An instance of DefaultDisplay was returned.');
$this->assertTrue($view->display_handler instanceof DefaultDisplay, 'The display_handler property has been set.');
$this->assertInstanceOf(DefaultDisplay::class, $display_plugin);
$this->assertInstanceOf(DefaultDisplay::class, $view->display_handler);
$this->assertIdentical($display_plugin, $view->getDisplay(), 'The same display plugin instance was returned.');
$style_plugin = $view->getStyle();
$this->assertTrue($style_plugin instanceof DefaultStyle, 'An instance of DefaultStyle was returned.');
$this->assertTrue($view->style_plugin instanceof DefaultStyle, 'The style_plugin property has been set.');
$this->assertInstanceOf(DefaultStyle::class, $style_plugin);
$this->assertInstanceOf(DefaultStyle::class, $view->style_plugin);
$this->assertIdentical($style_plugin, $view->getStyle(), 'The same style plugin instance was returned.');
$pager_plugin = $view->getPager();
$this->assertTrue($pager_plugin instanceof PagerPluginBase, 'An instance of PagerPluginBase was returned.');
$this->assertTrue($view->pager instanceof PagerPluginBase, 'The pager property has been set.');
$this->assertInstanceOf(PagerPluginBase::class, $pager_plugin);
$this->assertInstanceOf(PagerPluginBase::class, $view->pager);
$this->assertIdentical($pager_plugin, $view->getPager(), 'The same pager plugin instance was returned.');
$query_plugin = $view->getQuery();
$this->assertTrue($query_plugin instanceof QueryPluginBase, 'An instance of QueryPluginBase was returned.');
$this->assertTrue($view->query instanceof QueryPluginBase, 'The query property has been set.');
$this->assertInstanceOf(QueryPluginBase::class, $query_plugin);
$this->assertInstanceOf(QueryPluginBase::class, $view->query);
$this->assertIdentical($query_plugin, $view->getQuery(), 'The same query plugin instance was returned.');
}
......@@ -218,11 +218,11 @@ public function testDisplays() {
// Tests Drupal\views\ViewExecutable::initDisplay().
$view->initDisplay();
$this->assertTrue($view->displayHandlers instanceof DisplayPluginCollection, 'The displayHandlers property has the right class.');
$this->assertInstanceOf(DisplayPluginCollection::class, $view->displayHandlers);
// Tests the classes of the instances.
$this->assertTrue($view->displayHandlers->get('default') instanceof DefaultDisplay);
$this->assertTrue($view->displayHandlers->get('page_1') instanceof Page);
$this->assertTrue($view->displayHandlers->get('page_2') instanceof Page);
$this->assertInstanceOf(DefaultDisplay::class, $view->displayHandlers->get('default'));
$this->assertInstanceOf(Page::class, $view->displayHandlers->get('page_1'));
$this->assertInstanceOf(Page::class, $view->displayHandlers->get('page_2'));
// After initializing the default display is the current used display.
$this->assertEqual($view->current_display, 'default');
......@@ -253,14 +253,14 @@ public function testDisplays() {
// display.
$view->setDisplay('page_1');
$view->initStyle();
$this->assertTrue($view->style_plugin instanceof DefaultStyle);
$this->assertTrue($view->rowPlugin instanceof Fields);
$this->assertInstanceOf(DefaultStyle::class, $view->style_plugin);
$this->assertInstanceOf(Fields::class, $view->rowPlugin);
$view->setDisplay('page_2');
$view->initStyle();
$this->assertTrue($view->style_plugin instanceof Grid);
$this->assertInstanceOf(Grid::class, $view->style_plugin);
// @todo Change this rowPlugin type too.
$this->assertTrue($view->rowPlugin instanceof Fields);
$this->assertInstanceOf(Fields::class, $view->rowPlugin);
// Test the newDisplay() method.
$view = $this->container->get('entity_type.manager')->getStorage('view')->create(['id' => 'test_executable_displays']);
......@@ -270,14 +270,14 @@ public function testDisplays() {
$executable->newDisplay('page');
$executable->newDisplay('display_test');
$this->assertTrue($executable->displayHandlers->get('default') instanceof DefaultDisplay);
$this->assertInstanceOf(DefaultDisplay::class, $executable->displayHandlers->get('default'));
$this->assertFalse(isset($executable->displayHandlers->get('default')->default_display));
$this->assertTrue($executable->displayHandlers->get('page_1') instanceof Page);
$this->assertTrue($executable->displayHandlers->get('page_1')->default_display instanceof DefaultDisplay);
$this->assertTrue($executable->displayHandlers->get('page_2') instanceof Page);
$this->assertTrue($executable->displayHandlers->get('page_2')->default_display instanceof DefaultDisplay);
$this->assertTrue($executable->displayHandlers->get('display_test_1') instanceof DisplayTest);
$this->assertTrue($executable->displayHandlers->get('display_test_1')->default_display instanceof DefaultDisplay);
$this->assertInstanceOf(Page::class, $executable->displayHandlers->get('page_1'));
$this->assertInstanceOf(DefaultDisplay::class, $executable->displayHandlers->get('page_1')->default_display);
$this->assertInstanceOf(Page::class, $executable->displayHandlers->get('page_2'));
$this->assertInstanceOf(DefaultDisplay::class, $executable->displayHandlers->get('page_2')->default_display);
$this->assertInstanceOf(DisplayTest::class, $executable->displayHandlers->get('display_test_1'));
$this->assertInstanceOf(DefaultDisplay::class, $executable->displayHandlers->get('display_test_1')->default_display);
}
/**
......@@ -316,7 +316,7 @@ public function testPropertyMethods() {
$this->assertIdentical($view->getBaseTables(), $expected);
// Test response methods.
$this->assertTrue($view->getResponse() instanceof Response, 'New response object returned.');
$this->assertInstanceOf(Response::class, $view->getResponse());
$new_response = new Response();
$view->setResponse($new_response);
$this->assertIdentical(spl_object_hash($view->getResponse()), spl_object_hash($new_response), 'New response object correctly set.');
......@@ -489,7 +489,7 @@ public function testSerialization() {
/** @var \Drupal\views\ViewExecutable $unserialized */
$unserialized = unserialize($serialized);
$this->assertTrue($unserialized instanceof ViewExecutable);
$this->assertInstanceOf(ViewExecutable::class, $unserialized);
$this->assertIdentical($view->storage->id(), $unserialized->storage->id(), 'The expected storage entity was loaded on the unserialized view.');
$this->assertIdentical($unserialized->current_display, 'page_1', 'The expected display was set on the unserialized view.');
$this->assertIdentical($unserialized->args, ['test'], 'The expected argument was set on the unserialized view.');
......
......@@ -63,7 +63,7 @@ public function testConfigurationEntityCRUD() {
$this->controller = $this->container->get('entity_type.manager')->getStorage('view');
// Confirm that an info array has been returned.
$this->assertTrue($this->entityType instanceof EntityTypeInterface, 'The View info array is loaded.');
$this->assertInstanceOf(EntityTypeInterface::class, $this->entityType);
// CRUD tests.
$this->loadTests();
......@@ -83,7 +83,7 @@ protected function loadTests() {
// Confirm that an actual view object is loaded and that it returns all of
// expected properties.
$this->assertTrue($view instanceof View, 'Single View instance loaded.');
$this->assertInstanceOf(View::class, $view);
foreach ($this->configProperties as $property) {
$this->assertTrue($view->get($property) !== NULL, new FormattableMarkup('Property: @property loaded onto View.', ['@property' => $property]));
}
......@@ -117,7 +117,7 @@ protected function createTests() {
// Create a new View instance with empty values.
$created = $this->controller->create([]);
$this->assertTrue($created instanceof View, 'Created object is a View.');
$this->assertInstanceOf(View::class, $created);
// Check that the View contains all of the properties.
foreach ($this->configProperties as $property) {
$this->assertTrue(property_exists($created, $property), new FormattableMarkup('Property: @property created on View.', ['@property' => $property]));
......@@ -129,7 +129,7 @@ protected function createTests() {
unset($values['uuid']);
$created = $this->controller->create($values);
$this->assertTrue($created instanceof View, 'Created object is a View.');
$this->assertInstanceOf(View::class, $created);
// Check that the View contains all of the properties.
$properties = $this->configProperties;
// Remove display from list.
......@@ -162,7 +162,7 @@ protected function displayTests() {
$executable = $view->getExecutable();
$executable->initDisplay();
$this->assertTrue($executable->displayHandlers->get($new_id) instanceof Page, 'New page display "test" uses the right display plugin.');
$this->assertInstanceOf(Page::class, $executable->displayHandlers->get($new_id));
// To save this with a new ID, we should use createDuplicate().
$view = $view->createDuplicate();
......@@ -316,7 +316,7 @@ public function testCreateDuplicate() {
$view = Views::getView('test_view_storage');
$copy = $view->storage->createDuplicate();
$this->assertTrue($copy instanceof View, 'The copied object is a View.');
$this->assertInstanceOf(View::class, $copy);
// Check that the original view and the copy have different UUIDs.
$this->assertNotIdentical($view->storage->uuid(), $copy->uuid(), 'The copied view has a new UUID.');
......
......@@ -63,7 +63,7 @@ public function testCreateView() {
$this->wizard->validateView($form, $form_state);
$view = $this->wizard->createView($form, $form_state);
$this->assertTrue($view instanceof ViewUI, 'The created view is a ViewUI object.');
$this->assertInstanceOf(ViewUI::class, $view);
$this->assertEqual($view->get('id'), $random_id);
$this->assertEqual($view->get('label'), $random_label);
$this->assertEqual($view->get('description'), $random_description);
......
......@@ -194,7 +194,7 @@ public function testAjaxView() {
->with('/test-page?type=article');
$response = $this->viewAjaxController->ajaxView($request);
$this->assertTrue($response instanceof ViewAjaxResponse);
$this->assertInstanceOf(ViewAjaxResponse::class, $response);
$this->assertSame($response->getView(), $executable);
......@@ -234,7 +234,7 @@ public function testAjaxViewWithArguments() {
->with('page_1', ['arg1', 'arg2']);
$response = $this->viewAjaxController->ajaxView($request);
$this->assertTrue($response instanceof ViewAjaxResponse);
$this->assertInstanceOf(ViewAjaxResponse::class, $response);
$this->assertViewResultCommand($response);
}
......@@ -255,7 +255,7 @@ public function testAjaxViewWithEmptyArguments() {
->with('page_1', $this->identicalTo(['arg1', NULL]));
$response = $this->viewAjaxController->ajaxView($request);
$this->assertTrue($response instanceof ViewAjaxResponse);
$this->assertInstanceOf(ViewAjaxResponse::class, $response);
$this->assertViewResultCommand($response);