From 0859ec792a90115c31f9c4435f57f0906306e2ef Mon Sep 17 00:00:00 2001 From: Shishir Suvarna Date: Thu, 31 Mar 2022 17:23:00 +0530 Subject: [PATCH] Fix deprecated method assertEqual() --- tests/src/Functional/ApiDocsJsonApi.php | 2 +- tests/src/Functional/SmartdocRoutingTest.php | 10 +++++----- tests/src/Kernel/ApidocEntityTest.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/src/Functional/ApiDocsJsonApi.php b/tests/src/Functional/ApiDocsJsonApi.php index 269d13a..bf93597 100644 --- a/tests/src/Functional/ApiDocsJsonApi.php +++ b/tests/src/Functional/ApiDocsJsonApi.php @@ -214,7 +214,7 @@ protected function verifyAccess(AccountInterface $account, array $apidocs_expect return strcmp($a['attributes']['title'], $b['attributes']['title']); }); for ($i = 0; $i < count($apidocs_response); $i++) { - $this->assertEqual($apidocs_expected[$i]->label(), $apidocs_response[$i]['attributes']['title']); + $this->assertEquals($apidocs_expected[$i]->label(), $apidocs_response[$i]['attributes']['title']); } // Make sure the count is the same. $this->assertCount(count($apidocs_expected), $apidocs_response, 'Count of API Docs returned does not match count of expected.'); diff --git a/tests/src/Functional/SmartdocRoutingTest.php b/tests/src/Functional/SmartdocRoutingTest.php index 7ff03d5..d01e8cf 100755 --- a/tests/src/Functional/SmartdocRoutingTest.php +++ b/tests/src/Functional/SmartdocRoutingTest.php @@ -79,12 +79,12 @@ protected function setUp(): void { * Tests the route subscriber will redirect from smartdoc routes. */ public function testNotFoundSubscriber() { - $this->assertEqual($this->apidoc->id(), 1); + $this->assertEquals($this->apidoc->id(), 1); // This needs to run before the alias can be picked up? $this->apidoc->toUrl()->toString(); $alias = \Drupal::service('path_alias.manager')->getAliasByPath('/node/1', $this->apidoc->language()->getId()); - $this->assertEqual($alias, '/api/1'); + $this->assertEquals($alias, '/api/1'); $assert = $this->assertSession(); @@ -95,7 +95,7 @@ public function testNotFoundSubscriber() { static::assertEmpty($this->getSession()->getResponseHeader('location')); // Test the canonical route uses the /api/* path alias. - $this->assertEqual(parse_url($this->getSession()->getCurrentUrl(), PHP_URL_PATH), '/api/1'); + $this->assertEquals(parse_url($this->getSession()->getCurrentUrl(), PHP_URL_PATH), '/api/1'); // Tests the node alias response. $this->drupalGet('/api/1'); @@ -107,8 +107,8 @@ public function testNotFoundSubscriber() { $response = $this->getHttpClient()->request('GET', $url->toString(), [ 'allow_redirects' => FALSE, ]); - $this->assertEqual($response->getStatusCode(), 302); - $this->assertEqual($response->getHeader('location')[0], '/api/1'); + $this->assertEquals($response->getStatusCode(), 302); + $this->assertEquals($response->getHeader('location')[0], '/api/1'); } } diff --git a/tests/src/Kernel/ApidocEntityTest.php b/tests/src/Kernel/ApidocEntityTest.php index d22a579..b38e53b 100755 --- a/tests/src/Kernel/ApidocEntityTest.php +++ b/tests/src/Kernel/ApidocEntityTest.php @@ -104,7 +104,7 @@ public function testEntity() { // This needs to run before the alias can be picked up? $entity->toUrl()->toString(); $alias = \Drupal::service('path_alias.manager')->getAliasByPath('/node/' . $entity->id(), $entity->language()->getId()); - $this->assertEqual($alias, '/api/' . $entity->id()); + $this->assertEquals($alias, '/api/' . $entity->id()); $entity->delete(); $this->assertNull($this->nodeStorage->load($entity_id));