diff --git a/tests/src/Functional/TokenFieldUiTest.php b/tests/src/Functional/TokenFieldUiTest.php index 8f93d6f..4158303 100644 --- a/tests/src/Functional/TokenFieldUiTest.php +++ b/tests/src/Functional/TokenFieldUiTest.php @@ -261,22 +261,22 @@ class TokenFieldUiTest extends TokenTestBase { // Test one of the image style's token info for cardinality 1 image field. $token_info = $token_service->getTokenInfo('node-field_image', 'thumbnail'); - $this->assertEqual('Thumbnail (100×100)', $token_info['name']); - $this->assertEqual('Represents the image in the given image style.', $token_info['description']); + $this->assertEquals('Thumbnail (100×100)', $token_info['name']); + $this->assertEquals('Represents the image in the given image style.', $token_info['description']); // Test one of the image style's token info for a multivalued image field. $token_info = $token_service->getTokenInfo('node-multivalued_field_image', 'medium'); - $this->assertEqual('Medium (220×220)', $token_info['name']); - $this->assertEqual('Represents the image in the given image style.', $token_info['description']); + $this->assertEquals('Medium (220×220)', $token_info['name']); + $this->assertEquals('Represents the image in the given image style.', $token_info['description']); // Test few of the image styles' properties token info. $token_info = $token_service->getTokenInfo('image_with_image_style', 'mimetype'); - $this->assertEqual('MIME type', $token_info['name']); - $this->assertEqual('The MIME type (image/png, image/bmp, etc.) of the image.', $token_info['description']); + $this->assertEquals('MIME type', $token_info['name']); + $this->assertEquals('The MIME type (image/png, image/bmp, etc.) of the image.', $token_info['description']); $token_info = $token_service->getTokenInfo('image_with_image_style', 'filesize'); - $this->assertEqual('File size', $token_info['name']); - $this->assertEqual('The file size of the image.', $token_info['description']); + $this->assertEquals('File size', $token_info['name']); + $this->assertEquals('The file size of the image.', $token_info['description']); } } diff --git a/tests/src/Functional/TokenMenuTest.php b/tests/src/Functional/TokenMenuTest.php index 28c000d..a77f19c 100644 --- a/tests/src/Functional/TokenMenuTest.php +++ b/tests/src/Functional/TokenMenuTest.php @@ -167,7 +167,7 @@ class TokenMenuTest extends TokenTestBase { 'menu[title]' => 'Test preview', ], t('Save')); $node = $this->drupalGetNodeByTitle('Node menu title test'); - $this->assertEqual('This is a Test preview token to the menu link title', $node->body->value); + $this->assertEquals('This is a Test preview token to the menu link title', $node->body->value); // Disable the menu link, save the node and verify that the menu link is // no longer displayed. @@ -190,7 +190,7 @@ class TokenMenuTest extends TokenTestBase { $options = array_filter($options, function (NodeElement $element) { return strpos($element->getText(), 'Test preview') !== FALSE; }); - $this->assertEqual(1, count($options)); + $this->assertCount(1, $options); $this->drupalPostForm(NULL, [ 'title[0][value]' => 'Node menu title parent path test', 'body[0][value]' => 'This is a [node:menu-link:parent:url:path] token to the menu link parent', @@ -199,7 +199,7 @@ class TokenMenuTest extends TokenTestBase { 'menu[menu_parent]' => 'main-menu:' . $parent_link->getPluginId(), ], t('Save')); $node = $this->drupalGetNodeByTitle('Node menu title parent path test'); - $this->assertEqual('This is a /admin/config token to the menu link parent', $node->body->value); + $this->assertEquals('This is a /admin/config token to the menu link parent', $node->body->value); // Now edit the node and update the parent and title. $this->drupalPostForm('node/' . $node->id() . '/edit', [ @@ -208,7 +208,7 @@ class TokenMenuTest extends TokenTestBase { 'body[0][value]' => 'This is a [node:menu-link:parent:url:path] token to the menu link parent', ], t('Save')); $node = $this->drupalGetNodeByTitle('Node menu title edit parent path test', TRUE); - $this->assertEqual(sprintf('This is a /node/%d token to the menu link parent', $loaded_node->id()), $node->body->value); + $this->assertEquals(sprintf('This is a /node/%d token to the menu link parent', $loaded_node->id()), $node->body->value); // Make sure that the previous node edit didn't result in two menu-links // being created by the computed menu-link ER field. @@ -222,7 +222,7 @@ class TokenMenuTest extends TokenTestBase { $options = array_filter($options, function (NodeElement $item) { return strpos($item->getText(), 'Child link') !== FALSE; }); - $this->assertEqual(1, count($options)); + $this->assertCount(1, $options); // Now add a new node with no menu. $this->drupalGet('node/add/page'); @@ -242,7 +242,7 @@ class TokenMenuTest extends TokenTestBase { 'menu[menu_parent]' => 'main-menu:' . $parent_link->getPluginId(), ], t('Save')); $node = $this->drupalGetNodeByTitle('Node menu adding menu later test', TRUE); - $this->assertEqual('This is a /admin/config token to the menu link parent', $node->body->value); + $this->assertEquals('This is a /admin/config token to the menu link parent', $node->body->value); // And make sure the menu link exists with the right URI. $link = menu_ui_get_menu_link_defaults($node); $this->assertTrue(!empty($link['entity_id'])); diff --git a/tests/src/Functional/TokenTestTrait.php b/tests/src/Functional/TokenTestTrait.php index e4d758a..9927e69 100644 --- a/tests/src/Functional/TokenTestTrait.php +++ b/tests/src/Functional/TokenTestTrait.php @@ -31,7 +31,7 @@ trait TokenTestTrait { $this->assertTrue(preg_match('/^' . $expected . '$/', $replacements[$token]), t("Token value for @token was '@actual', matching regular expression pattern '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $replacements[$token], '@expected' => $expected])); } else { - $this->assertEqual($replacements[$token], $expected, t("Token value for @token was '@actual', expected value '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $replacements[$token], '@expected' => $expected])); + $this->assertEquals($expected, $replacements[$token], t("Token value for @token was '@actual', expected value '@expected'.", ['@type' => $type, '@token' => $token, '@actual' => $replacements[$token], '@expected' => $expected])); } } diff --git a/tests/src/Functional/Tree/TreeTest.php b/tests/src/Functional/Tree/TreeTest.php index 6b80e51..8d902dc 100644 --- a/tests/src/Functional/Tree/TreeTest.php +++ b/tests/src/Functional/Tree/TreeTest.php @@ -96,7 +96,7 @@ class TreeTest extends TokenTestBase { // Request with show_restricted set to TRUE to show restricted tokens and // check for them. $this->drupalGet($this->getTokenTreeUrl(['token_types' => ['user'], 'show_restricted' => TRUE])); - $this->assertEqual('MISS', $this->drupalGetHeader('x-drupal-dynamic-cache'), 'Cache was not hit'); + $this->assertEquals('MISS', $this->drupalGetHeader('x-drupal-dynamic-cache'), 'Cache was not hit'); $this->assertTokenInTree('[user:one-time-login-url]', 'user'); $this->assertTokenInTree('[user:original:cancel-url]', 'user--original'); } diff --git a/tests/src/Kernel/FieldTest.php b/tests/src/Kernel/FieldTest.php index 1d0b2de..0ac82fc 100644 --- a/tests/src/Kernel/FieldTest.php +++ b/tests/src/Kernel/FieldTest.php @@ -262,12 +262,12 @@ class FieldTest extends KernelTestBase { // Test the test_list token metadata. $tokenService = \Drupal::service('token'); $token_info = $tokenService->getTokenInfo('node', 'test_list'); - $this->assertEqual($token_info['name'], 'test_list'); - $this->assertEqual($token_info['module'], 'token'); - $this->assertEqual($token_info['type'], 'list'); + $this->assertEquals('test_list', $token_info['name']); + $this->assertEquals('token', $token_info['module']); + $this->assertEquals('list', $token_info['type']); $typeInfo = $tokenService->getTypeInfo('list'); - $this->assertEqual($typeInfo['name'], 'List of test_list values'); - $this->assertEqual($typeInfo['type'], 'list'); + $this->assertEquals('List of test_list values', $typeInfo['name']); + $this->assertEquals('list', $typeInfo['type']); // Create a node type that does not have test_field field. $node_type = NodeType::create([ @@ -306,9 +306,9 @@ class FieldTest extends KernelTestBase { // Test the token info of the text field of the artcle content type. $token_info = $tokenService->getTokenInfo('node', 'test_field'); - $this->assertEqual($token_info['name'], 'Test field', 'The token info name is correct.'); - $this->assertEqual($token_info['description'], 'Text (formatted) field.', 'The token info description is correct.'); - $this->assertEqual($token_info['module'], 'token', 'The token info module is correct.'); + $this->assertEquals('Test field', $token_info['name'], 'The token info name is correct.'); + $this->assertEquals('Text (formatted) field.', $token_info['description'], 'The token info description is correct.'); + $this->assertEquals('token', $token_info['module'], 'The token info module is correct.'); // Now create two more content types that share the field but the last // of them sets a different label. This should show an alternative label @@ -338,17 +338,17 @@ class FieldTest extends KernelTestBase { $field->save(); $token_info = $tokenService->getTokenInfo('node', 'test_field'); - $this->assertEqual($token_info['name'], 'Test field', 'The token info name is correct.'); - $this->assertEqual((string) $token_info['description'], 'Text (formatted) field. Also known as Different test field.', 'When a field is used in several bundles with different labels, this is noted at the token info description.'); - $this->assertEqual($token_info['module'], 'token', 'The token info module is correct.'); - $this->assertEqual($token_info['type'], 'node-test_field', 'The field property token info type is correct.'); + $this->assertEquals('Test field', $token_info['name'], 'The token info name is correct.'); + $this->assertEquals('Text (formatted) field. Also known as Different test field.', (string) $token_info['description'], 'When a field is used in several bundles with different labels, this is noted at the token info description.'); + $this->assertEquals('token', $token_info['module'], 'The token info module is correct.'); + $this->assertEquals('node-test_field', $token_info['type'], 'The field property token info type is correct.'); // Test field property token info. $token_info = $tokenService->getTokenInfo('node-test_field', 'value'); - $this->assertEqual($token_info['name'], 'Text', 'The field property token info name is correct.'); + $this->assertEquals('Text', $token_info['name'], 'The field property token info name is correct.'); // This particular field property description happens to be empty. - $this->assertEqual((string) $token_info['description'], '', 'The field property token info description is correct.'); - $this->assertEqual($token_info['module'], 'token', 'The field property token info module is correct.'); + $this->assertEquals('', (string) $token_info['description'], 'The field property token info description is correct.'); + $this->assertEquals('token', $token_info['module'], 'The field property token info module is correct.'); } /** diff --git a/tests/src/Kernel/UnitTest.php b/tests/src/Kernel/UnitTest.php index c031e6b..ee0f725 100644 --- a/tests/src/Kernel/UnitTest.php +++ b/tests/src/Kernel/UnitTest.php @@ -103,7 +103,7 @@ class UnitTest extends KernelTestBase { sort($invalid_tokens); sort($test['invalid tokens']); - $this->assertEqual($invalid_tokens, $test['invalid tokens'], 'Invalid tokens detected properly: ' . implode(', ', $invalid_tokens)); + $this->assertEquals($test['invalid tokens'], $invalid_tokens, 'Invalid tokens detected properly: ' . implode(', ', $invalid_tokens)); } }