public function EntityReferenceFileUploadTest::testFileUpload in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field/src/Tests/EntityReference/EntityReferenceFileUploadTest.php \Drupal\field\Tests\EntityReference\EntityReferenceFileUploadTest::testFileUpload()
Tests that the autocomplete input element does not cause ajax fatal.
File
- core/
modules/ field/ src/ Tests/ EntityReference/ EntityReferenceFileUploadTest.php, line 116 - Contains \Drupal\field\Tests\EntityReference\EntityReferenceFileUploadTest.
Class
- EntityReferenceFileUploadTest
- Tests an autocomplete widget with file upload.
Namespace
Drupal\field\Tests\EntityReferenceCode
public function testFileUpload() {
$user1 = $this
->drupalCreateUser(array(
'access content',
"create {$this->referencingType} content",
));
$this
->drupalLogin($user1);
$test_file = current($this
->drupalGetTestFiles('text'));
$edit['files[file_field_0]'] = drupal_realpath($test_file->uri);
$this
->drupalPostForm('node/add/' . $this->referencingType, $edit, 'Upload');
$this
->assertResponse(200);
$edit = array(
'title[0][value]' => $this
->randomMachineName(),
'test_field[0][target_id]' => $this->nodeId,
);
$this
->drupalPostForm(NULL, $edit, 'Save');
$this
->assertResponse(200);
}