Unverified Commit 221b7aed authored by alexpott's avatar alexpott
Browse files

Issue #3108006 by mondrake, ravi.shankar, longwave: Replace...

Issue #3108006 by mondrake, ravi.shankar, longwave: Replace assertInternalType() calls with dedicated methods
parent bcbb6975
......@@ -41,7 +41,7 @@ protected function setUp() {
*/
protected function assertDisplay($id, $component_id) {
$component = EntityViewDisplay::load($id)->getComponent($component_id);
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('hidden', $component['label']);
}
......
......@@ -41,7 +41,7 @@ protected function setUp() {
*/
protected function assertDisplay($id, $component_id) {
$component = EntityFormDisplay::load($id)->getComponent($component_id);
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('text_textarea_with_summary', $component['type']);
}
......
......@@ -52,7 +52,7 @@ public function testGetConfig($language_list, $expected_number) {
$config = $this->plugin->getConfig($editor);
$this->assertInternalType('array', $config);
$this->assertIsArray($config);
$this->assertTrue(in_array('ar:Arabic:rtl', $config['language_list']));
$this->assertTrue(in_array('zh-hans:Chinese, Simplified', $config['language_list']));
$this->assertTrue(in_array('en:English', $config['language_list']));
......
......@@ -44,7 +44,7 @@ protected function setUp() {
*/
protected function assertDisplay($id, $component_id) {
$component = EntityViewDisplay::load($id)->getComponent($component_id);
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('hidden', $component['label']);
$this->assertSame('comment_default', $component['type']);
$this->assertSame(20, $component['weight']);
......
......@@ -38,7 +38,7 @@ protected function setUp() {
*/
protected function assertSubjectVisible($id) {
$component = EntityFormDisplay::load($id)->getComponent('subject');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('string_textfield', $component['type']);
$this->assertSame(10, $component['weight']);
}
......
......@@ -43,7 +43,7 @@ protected function setUp() {
*/
protected function assertDisplay($id, $component_id) {
$component = EntityFormDisplay::load($id)->getComponent($component_id);
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('comment_default', $component['type']);
$this->assertSame(20, $component['weight']);
}
......
......@@ -42,7 +42,7 @@ protected function setUp() {
*/
protected function assertDisplay($id, $component_id) {
$component = EntityViewDisplay::load($id)->getComponent($component_id);
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('hidden', $component['label']);
$this->assertSame('comment_default', $component['type']);
$this->assertSame(20, $component['weight']);
......
......@@ -35,7 +35,7 @@ protected function setUp() {
*/
protected function assertSubjectVisible($id) {
$component = EntityFormDisplay::load($id)->getComponent('subject');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('string_textfield', $component['type']);
$this->assertSame(10, $component['weight']);
}
......
......@@ -42,7 +42,7 @@ protected function setUp() {
*/
protected function assertDisplay($id, $component_id) {
$component = EntityFormDisplay::load($id)->getComponent($component_id);
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('comment_default', $component['type']);
$this->assertSame(20, $component['weight']);
}
......
......@@ -206,7 +206,7 @@ public function testEntityDisplaySettings() {
// reference field.
$display = EntityViewDisplay::load('node.employee.default');
$component = $display->getComponent('field_company');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('entity_reference_label', $component['type']);
// The default node reference formatter shows the referenced node's title
// as a link.
......@@ -214,14 +214,14 @@ public function testEntityDisplaySettings() {
$display = EntityViewDisplay::load('node.employee.teaser');
$component = $display->getComponent('field_company');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('entity_reference_label', $component['type']);
// The plain node reference formatter shows the referenced node's title,
// unlinked.
$this->assertFalse($component['settings']['link']);
$component = $display->getComponent('field_commander');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('entity_reference_label', $component['type']);
// The default user reference formatter links to the referenced user.
$this->assertTrue($component['settings']['link']);
......
......@@ -107,22 +107,22 @@ public function testWidgetSettings() {
$component = $display_repository->getFormDisplay('node', 'employee', 'default')
->getComponent('field_company');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('options_select', $component['type']);
$component = $display_repository->getFormDisplay('node', 'employee', 'default')
->getComponent('field_company_2');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('options_buttons', $component['type']);
$component = $display_repository->getFormDisplay('node', 'employee', 'default')
->getComponent('field_company_3');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('entity_reference_autocomplete_tags', $component['type']);
$component = $display_repository->getFormDisplay('node', 'employee', 'default')
->getComponent('field_commander');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$this->assertSame('options_select', $component['type']);
}
......
......@@ -29,7 +29,7 @@ public function testTransformImageSettings() {
->getMock();
$value = $plugin->transform([[], ['type' => 'image_image'], ['data' => '']], $executable, $row, 'foo');
$this->assertInternalType('array', $value['default_image']);
$this->assertIsArray($value['default_image']);
$this->assertSame('', $value['default_image']['alt']);
$this->assertSame('', $value['default_image']['title']);
$this->assertNull($value['default_image']['width']);
......
......@@ -36,7 +36,7 @@ public function testTransformImageSettings() {
]);
$value = $plugin->transform([], $executable, $row, 'foo');
$this->assertInternalType('array', $value);
$this->assertIsArray($value);
$this->assertSame('', $value['default_image']['uuid']);
}
......
......@@ -101,7 +101,7 @@ public function testMediaOEmbedVideoSource() {
$display = \Drupal::service('entity_display.repository')->getViewDisplay('media', $media_type_id);
$this->assertFalse($display->isNew());
$component = $display->getComponent('field_media_oembed_video');
$this->assertInternalType('array', $component);
$this->assertIsArray($component);
$component['settings']['max_width'] = 240;
$display->setComponent('field_media_oembed_video', $component);
$this->assertSame(SAVED_UPDATED, $display->save());
......
......@@ -43,7 +43,7 @@ public function testBadHashParameter($hash) {
->get('controller_resolver')
->getControllerFromDefinition('\Drupal\media\Controller\OEmbedIframeController::render');
$this->assertInternalType('callable', $controller);
$this->assertIsCallable($controller);
$this->expectException('\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException');
$this->expectExceptionMessage('This resource is not available');
......
......@@ -239,7 +239,7 @@ protected function assertViewDisplay($type_id, $image_style) {
$this->assertSame(['thumbnail'], array_keys($view_display->getComponents()));
// Assert the thumbnail image style.
$thumbnail = $view_display->getComponent('thumbnail');
$this->assertInternalType('array', $thumbnail);
$this->assertIsArray($thumbnail);
$this->assertSame($image_style, $thumbnail['settings']['image_style']);
}
......
......@@ -90,7 +90,7 @@ public function testSuccessfulReuse($source_path, $destination_path) {
clearstatcache(TRUE, $destination_path);
$timestamp = (new \SplFileInfo($file_reuse))->getMTime();
$this->assertInternalType('int', $timestamp);
$this->assertIsInt($timestamp);
// We need to make sure the modified timestamp on the file is sooner than
// the attempted migration.
......
......@@ -19,7 +19,7 @@ class TimezoneTest extends KernelTestBase {
public function testSystemTimeZones() {
// Test the default parameters for system_time_zones().
$result = system_time_zones();
$this->assertInternalType('array', $result);
$this->assertIsArray($result);
$this->assertArrayHasKey('Africa/Dar_es_Salaam', $result);
$this->assertEquals('Africa/Dar es Salaam', $result['Africa/Dar_es_Salaam']);
......@@ -27,7 +27,7 @@ public function testSystemTimeZones() {
$result = system_time_zones(NULL, TRUE);
// Check a two-level time zone.
$this->assertInternalType('array', $result);
$this->assertIsArray($result);
$this->assertArrayHasKey('Africa', $result);
$this->assertArrayHasKey('Africa/Dar_es_Salaam', $result['Africa']);
$this->assertEquals('Dar es Salaam', $result['Africa']['Africa/Dar_es_Salaam']);
......
......@@ -87,7 +87,7 @@ public function testUsesGroupBy() {
*/
public function testDefineOptions() {
$options = $this->plugin->defineOptions();
$this->assertInternalType('array', $options);
$this->assertIsArray($options);
$this->assertArrayHasKey('destination', $options);
}
......
......@@ -64,7 +64,7 @@ public function testPageController() {
$route_match = RouteMatch::createFromRequest($request);
$output = $this->pageController->handle($route_match->getParameter('view_id'), $route_match->getParameter('display_id'), $route_match);
$this->assertInternalType('array', $output);
$this->assertIsArray($output);
$this->assertEquals($build, $output);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment