From 53de3bf9b008d3f381cfff800551b5896d6dfe2a Mon Sep 17 00:00:00 2001 From: Wellington Lopes Date: Fri, 21 Jan 2022 16:24:26 -0300 Subject: [PATCH] refactor: removed deprecated REQUEST_TIME on test file --- src/Tests/PublicationDateTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Tests/PublicationDateTest.php b/src/Tests/PublicationDateTest.php index c88569c..d5627d4 100644 --- a/src/Tests/PublicationDateTest.php +++ b/src/Tests/PublicationDateTest.php @@ -47,12 +47,13 @@ public function setUp() { * Test automatic saving of variables. */ public function testActionSaving() { + $requestTime = \Drupal::time()->getRequestTime(); // Create node to edit. $node = $this->drupalCreateNode(array('status' => 0)); $unpublished_node = node_load($node->id()); $this->assertTrue(empty($unpublished_node->published_at->value), 'Published date is initially empty'); - $this->assertTrue($unpublished_node->published_at->published_at_or_now == REQUEST_TIME, + $this->assertTrue($unpublished_node->published_at->published_at_or_now == $requestTime, 'Published at or now date is REQUEST_TIME'); // Publish the node. @@ -61,7 +62,7 @@ public function testActionSaving() { $published_node = node_load($node->id()); $this->assertTrue(is_numeric($published_node->published_at->value), 'Published date is integer/numberic once published'); - $this->assertTrue($published_node->published_at->value == REQUEST_TIME, + $this->assertTrue($published_node->published_at->value == $requestTime, 'Published date is REQUEST_TIME'); $this->assertTrue($unpublished_node->published_at->published_at_or_now == $published_node->published_at->value, 'Published at or now date equals published date'); @@ -146,7 +147,7 @@ public function testActionSavingOnForms() { t('Pubdate is maintained when republished')); // Set a custom time and make sure that it is stored correctly. - $ctime = REQUEST_TIME - 180; + $ctime = \Drupal::time()->getRequestTime() - 180; $edit['pubdate'] = format_date($ctime, 'custom', 'Y-m-d H:i:s O'); $this->drupalPost('node/' . $node->id() . '/edit', $edit, t('Save')); $this->drupalGet('node/' . $node->id() . '/edit');