You are here

function FileFieldTestBase::uploadNodeFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Tests/FileFieldTestBase.php \Drupal\file\Tests\FileFieldTestBase::uploadNodeFile()

Uploads a file to a node.

Parameters

\Drupal\file\FileInterface $file: The File to be uploaded.

string $field_name: The name of the field on which the files should be saved.

$nid_or_type: A numeric node id to upload files to an existing node, or a string indicating the desired bundle for a new node.

bool $new_revision: The revision number.

array $extras: Additional values when a new node is created.

Return value

int The node id.

16 calls to FileFieldTestBase::uploadNodeFile()
FileFieldAttributesTest::setUp in core/modules/rdf/src/Tests/FileFieldAttributesTest.php
Sets up a Drupal site for running functional and integration tests.
FileFieldDisplayTest::testDefaultFileFieldDisplay in core/modules/file/src/Tests/FileFieldDisplayTest.php
Tests default display of File Field.
FileFieldDisplayTest::testNodeDisplay in core/modules/file/src/Tests/FileFieldDisplayTest.php
Tests normal formatter display on node display.
FileFieldFormatterAccessTest::testFileAccessHandler in core/modules/file/src/Tests/FileFieldFormatterAccessTest.php
Tests the custom access handler is invoked.
FileFieldPathTest::testUploadPath in core/modules/file/src/Tests/FileFieldPathTest.php
Tests the normal formatter display on node display.

... See full list

File

core/modules/file/src/Tests/FileFieldTestBase.php, line 166
Contains \Drupal\file\Tests\FileFieldTestBase.

Class

FileFieldTestBase
Provides methods specifically for testing File module's field handling.

Namespace

Drupal\file\Tests

Code

function uploadNodeFile(FileInterface $file, $field_name, $nid_or_type, $new_revision = TRUE, array $extras = array()) {
  return $this
    ->uploadNodeFiles([
    $file,
  ], $field_name, $nid_or_type, $new_revision, $extras);
}