You are here

private function DefaultFieldComparatorWebTestCase::createFile in Changed Fields API 7.3

Same name and namespace in other branches
  1. 7.2 tests/default_field_comparator.test \DefaultFieldComparatorWebTestCase::createFile()

Helper method for file creation.

Parameters

string $file_path: File path.

Return value

mixed Object if file was created FALSE otherwise.b

5 calls to DefaultFieldComparatorWebTestCase::createFile()
DefaultFieldComparatorWebTestCase::testFileField in tests/default_field_comparator.test
Check comparison of file field.
DefaultFieldComparatorWebTestCase::testFileFieldDescription in tests/default_field_comparator.test
Check comparison of file field (with additional description property).
DefaultFieldComparatorWebTestCase::testFileFieldDisplay in tests/default_field_comparator.test
Check comparison of file field (with additional display property).
DefaultFieldComparatorWebTestCase::testImageAlt in tests/default_field_comparator.test
Check comparison of image field (with additional alt property).
DefaultFieldComparatorWebTestCase::testImageTitle in tests/default_field_comparator.test
Check comparison of image field (with additional title property).

File

tests/default_field_comparator.test, line 95
Test default field comparator.

Class

DefaultFieldComparatorWebTestCase
Class DefaultFieldComparatorWebTestCase.

Code

private function createFile($file_path) {
  $file = (object) [
    'uid' => 1,
    'uri' => $file_path,
    'filemime' => file_get_mimetype($file_path),
    'status' => 1,
    'display' => 1,
  ];
  return (array) file_copy($file, 'public://');
}