SchedulerMetaInformationTest.php in Scheduler 8
File
tests/src/Functional/SchedulerMetaInformationTest.php
View source
<?php
namespace Drupal\Tests\scheduler\Functional;
class SchedulerMetaInformationTest extends SchedulerBrowserTestBase {
public function testMetaInformation() {
$this
->drupalLogin($this->schedulerUser);
$published_node = $this
->drupalCreateNode([
'type' => $this->type,
'status' => TRUE,
]);
$this
->drupalGet('node/' . $published_node
->id());
$this
->assertNull($this
->drupalGetHeader('X-Robots-Tag'), 'X-Robots-Tag is not present when no unpublish date is set.');
$unpublish_date = strtotime('+1 day');
$edit = [
'unpublish_on[0][value][date]' => $this->dateFormatter
->format($unpublish_date, 'custom', 'Y-m-d'),
'unpublish_on[0][value][time]' => $this->dateFormatter
->format($unpublish_date, 'custom', 'H:i:s'),
];
$this
->drupalPostForm('node/' . $published_node
->id() . '/edit', $edit, 'Save');
$this
->drupalGet('node/' . $published_node
->id());
$this
->assertSession()
->responseHeaderEquals('X-Robots-Tag', 'unavailable_after: ' . date(DATE_RFC850, $unpublish_date));
}
}