Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated method assertEqual which is removed from Drupal:10.0.0 #180

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/src/Functional/ApiDocsJsonApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
10 changes: 5 additions & 5 deletions tests/src/Functional/SmartdocRoutingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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');
Expand All @@ -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');
}

}
2 changes: 1 addition & 1 deletion tests/src/Kernel/ApidocEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down