You are here

public function NodeRevisionGenerateTest::createOlderNode in Node Revision Delete 8

Creates an older node.

Parameters

string $type: Node's type.

int $timestamp: Timestamp for the node creation date and revision date. One year ago by default.

Return value

\Drupal\Core\Entity\EntityInterface The created node.

Throws

\Exception

1 call to NodeRevisionGenerateTest::createOlderNode()
NodeRevisionGenerateTest::testGenerationForm in modules/node_revision_generate/tests/src/Functional/NodeRevisionGenerateTest.php
Tests the form, the permission and the link.

File

modules/node_revision_generate/tests/src/Functional/NodeRevisionGenerateTest.php, line 69

Class

NodeRevisionGenerateTest
Test the node_revision_generate_generate_revisions form.

Namespace

Drupal\Tests\node_revision_generate\Functional

Code

public function createOlderNode($type, $timestamp = 60 * 60 * 24 * 30 * 12) {
  return $this
    ->drupalCreateNode([
    'type' => $type,
    'created' => time() - $timestamp,
    'revision_timestamp' => time() - $timestamp,
  ]);
}