class FileMetadataExifTest in File metadata manager 8
Same name and namespace in other branches
- 8.2 file_mdm_exif/tests/src/Kernel/FileMetadataExifTest.php \Drupal\Tests\file_mdm_exif\Kernel\FileMetadataExifTest
Tests that File Metadata EXIF plugin works properly.
@group File Metadata
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses AssertContentTrait, AssertLegacyTrait, AssertHelperTrait, ConfigTestTrait, PhpunitCompatibilityTrait, RandomGeneratorTrait, TestRequirementsTrait
- class \Drupal\Tests\file_mdm\Kernel\FileMetadataManagerTestBase
- class \Drupal\Tests\file_mdm_exif\Kernel\FileMetadataExifTest
- class \Drupal\Tests\file_mdm\Kernel\FileMetadataManagerTestBase
Expanded class hierarchy of FileMetadataExifTest
File
- file_mdm_exif/
tests/ src/ Kernel/ FileMetadataExifTest.php, line 16
Namespace
Drupal\Tests\file_mdm_exif\KernelView source
class FileMetadataExifTest extends FileMetadataManagerTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = [
'system',
'simpletest',
'file_mdm',
'file_mdm_exif',
'file_test',
'image_effects',
];
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this
->installConfig([
'file_mdm_exif',
]);
}
/**
* Test EXIF plugin.
*/
public function testExifPlugin() {
// Prepare a copy of test files.
file_unmanaged_copy(drupal_get_path('module', 'simpletest') . '/files/image-test.jpg', 'public://', FILE_EXISTS_REPLACE);
file_unmanaged_copy(drupal_get_path('module', 'simpletest') . '/files/image-test.png', 'public://', FILE_EXISTS_REPLACE);
file_unmanaged_copy(drupal_get_path('module', 'file_mdm') . '/tests/files/test-exif.jpeg', 'public://', FILE_EXISTS_REPLACE);
file_unmanaged_copy(drupal_get_path('module', 'file_mdm') . '/tests/files/test-exif.jpeg', 'temporary://', FILE_EXISTS_REPLACE);
// The image files that will be tested.
$image_files = [
[
// Pass a path instead of the URI.
'uri' => drupal_get_path('module', 'file_mdm') . '/tests/files/test-exif.jpeg',
'count_keys' => 48,
'test_keys' => [
[
'Orientation',
8,
],
[
'orientation',
8,
],
[
'OrIeNtAtIoN',
8,
],
[
'ShutterSpeedValue',
[
106,
32,
],
],
[
'ApertureValue',
[
128,
32,
],
],
[
[
'exif',
'aperturevalue',
],
[
128,
32,
],
],
[
[
2,
'aperturevalue',
],
[
128,
32,
],
],
[
[
'exif',
0x9202,
],
[
128,
32,
],
],
[
[
2,
0x9202,
],
[
128,
32,
],
],
],
],
[
// Pass a URI.
'uri' => 'public://test-exif.jpeg',
'count_keys' => 48,
'test_keys' => [
[
'Orientation',
8,
],
[
'ShutterSpeedValue',
[
106,
32,
],
],
],
],
[
// Remote storage file. Let the file be copied to a local temp copy.
'uri' => 'dummy-remote://test-exif.jpeg',
'copy_to_temp' => TRUE,
'count_keys' => 48,
'test_keys' => [
[
'Orientation',
8,
],
[
'ShutterSpeedValue',
[
106,
32,
],
],
],
],
[
// JPEG Image with GPS data.
'uri' => drupal_get_path('module', 'file_mdm') . '/tests/files/1024-2006_1011_093752.jpg',
'count_keys' => 59,
'test_keys' => [
[
'Orientation',
1,
],
[
'FocalLength',
[
8513,
256,
],
],
[
'GPSLatitudeRef',
'S',
],
[
'GPSLatitude',
[
[
33,
1,
],
[
51,
1,
],
[
2191,
100,
],
],
],
[
'GPSLongitudeRef',
'E',
],
[
'GPSLongitude',
[
[
151,
1,
],
[
13,
1,
],
[
1173,
100,
],
],
],
],
],
[
// JPEG Image with no EXIF data.
'uri' => 'public://image-test.jpg',
'count_keys' => 0,
'test_keys' => [],
],
[
// TIFF image.
'uri' => drupal_get_path('module', 'file_mdm') . '/tests/files/sample-1.tiff',
'count_keys' => 11,
'test_keys' => [
[
'Orientation',
1,
],
[
'BitsPerSample',
[
8,
8,
8,
8,
],
],
],
],
[
// PNG should not have any data.
'uri' => 'public://image-test.png',
'count_keys' => 0,
'test_keys' => [],
],
];
$fmdm = $this->container
->get('file_metadata_manager');
// Walk through test files.
foreach ($image_files as $image_file) {
$file_metadata = $fmdm
->uri($image_file['uri']);
if (!$file_metadata) {
$this
->fail("File not found: {$image_file['uri']}");
continue;
}
if (isset($image_file['copy_to_temp'])) {
$file_metadata
->copyUriToTemp();
}
$this
->assertEquals($image_file['count_keys'], $this
->countMetadataKeys($file_metadata, 'exif'));
foreach ($image_file['test_keys'] as $test) {
$entry = $file_metadata
->getMetadata('exif', $test[0]);
$this
->assertEquals($test[1], $entry ? $entry['value'] : NULL);
}
}
// Test loading metadata from an in-memory object.
$file_metadata_from = $fmdm
->uri($image_files[0]['uri']);
$metadata = $file_metadata_from
->getMetadata('exif');
$new_file_metadata = $fmdm
->uri('public://test-output.jpeg');
$new_file_metadata
->loadMetadata('exif', $metadata);
$this
->assertEquals($image_files[0]['count_keys'], $this
->countMetadataKeys($new_file_metadata, 'exif'));
foreach ($image_files[0]['test_keys'] as $test) {
$entry = $file_metadata
->getMetadata('exif', $test[0]);
$this
->assertEquals($test[1], $new_file_metadata
->getMetadata('exif', $test[0])['value']);
}
// Test removing metadata.
$fmdm
->release($image_files[0]['uri']);
$this
->assertFalse($fmdm
->has($image_files[0]['uri']));
$file_metadata = $fmdm
->uri($image_files[0]['uri']);
$this
->assertEquals($image_files[0]['count_keys'], $this
->countMetadataKeys($file_metadata, 'exif'));
$this
->assertTrue($file_metadata
->removeMetadata('exif', 'shutterspeedValue'));
$this
->assertTrue($file_metadata
->removeMetadata('exif', 'apertureValue'));
$this
->assertFalse($file_metadata
->removeMetadata('exif', 'bar'));
$this
->assertEquals($image_files[0]['count_keys'] - 2, $this
->countMetadataKeys($file_metadata, 'exif'));
$this
->assertNull($file_metadata
->getMetadata('exif', 'shutterspeedValue'));
$this
->assertNull($file_metadata
->getMetadata('exif', 'apertureValue'));
$this
->assertNotNull($file_metadata
->getMetadata('exif', 'orientation'));
}
/**
* Test writing metadata to JPEG file.
*/
public function testJpegExifSaveToFile() {
$fmdm = $this->container
->get('file_metadata_manager');
// Copy test file to public://.
file_unmanaged_copy(drupal_get_path('module', 'image_effects') . '/tests/images/portrait-painting.jpg', 'public://', FILE_EXISTS_REPLACE);
$file_uri = 'public://portrait-painting.jpg';
$file_metadata = $fmdm
->uri($file_uri);
// Check values via exif_read_data before operations.
$data = @exif_read_data($file_uri);
$this
->assertEquals(8, $data['Orientation']);
$this
->assertFalse(isset($data['Artist']));
$this
->assertEquals('Canon', $data['Make']);
$this
->assertEquals(800, $data['ISOSpeedRatings']);
// Change the Orientation tag from IFD0.
$this
->assertEquals(8, $file_metadata
->getMetadata('exif', 'orientation')['value']);
$this
->assertTrue($file_metadata
->setMetadata('exif', 'orientation', 4));
$this
->assertEquals(4, $file_metadata
->getMetadata('exif', 'orientation')['value']);
// Add the Artist tag to IFD0.
$this
->assertEquals(48, $this
->countMetadataKeys($file_metadata, 'exif'));
$this
->assertNull($file_metadata
->getMetadata('exif', 'artist'));
$artist_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag('artist');
$artist = new PelEntryAscii($artist_tag['tag'], 'shot by foo!');
$file_metadata
->setMetadata('exif', 'artist', $artist);
$this
->assertEquals('shot by foo!', $file_metadata
->getMetadata('exif', 'artist')['value']);
$this
->assertEquals(49, $this
->countMetadataKeys($file_metadata, 'exif'));
// Setting an unknown tag leads to failure.
$this
->assertFalse($file_metadata
->setMetadata('exif', 'bar', 'qux'));
// Remove the Make tag from IFD0.
$this
->assertEquals('Canon', $file_metadata
->getMetadata('exif', 'make')['value']);
$this
->assertTrue($file_metadata
->removeMetadata('exif', 'make'));
$this
->assertNull($file_metadata
->getMetadata('exif', 'make'));
$this
->assertEquals(48, $this
->countMetadataKeys($file_metadata, 'exif'));
// Add the ImageDescription tag to IFD1.
$this
->assertNull($file_metadata
->getMetadata('exif', [
1,
'imagedescription',
]));
$desc_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag([
1,
'imagedescription',
]);
$desc = new PelEntryAscii($desc_tag['tag'], 'awesome!');
$file_metadata
->setMetadata('exif', [
1,
'imagedescription',
], $desc);
$this
->assertEquals('awesome!', $file_metadata
->getMetadata('exif', [
1,
'imagedescription',
])['value']);
$this
->assertEquals(49, $this
->countMetadataKeys($file_metadata, 'exif'));
// Remove the Compression tag from IFD1.
$this
->assertEquals(6, $file_metadata
->getMetadata('exif', [
1,
'compression',
])['value']);
$this
->assertTrue($file_metadata
->removeMetadata('exif', [
1,
'compression',
]));
$this
->assertNull($file_metadata
->getMetadata('exif', [
1,
'compression',
]));
$this
->assertEquals(48, $this
->countMetadataKeys($file_metadata, 'exif'));
// Add the BrightnessValue tag to EXIF.
$this
->assertNull($file_metadata
->getMetadata('exif', [
'exif',
'brightnessvalue',
]));
$brightness_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag([
'exif',
'brightnessvalue',
]);
$brightness = new PelEntrySRational($brightness_tag['tag'], [
12,
4,
]);
$file_metadata
->setMetadata('exif', [
'exif',
'brightnessvalue',
], $brightness);
$this
->assertEquals('12/4', $file_metadata
->getMetadata('exif', [
'exif',
'brightnessvalue',
])['text']);
$this
->assertEquals(49, $this
->countMetadataKeys($file_metadata, 'exif'));
// Remove the ISOSpeedRatings tag from EXIF.
$this
->assertEquals(800, $file_metadata
->getMetadata('exif', [
'exif',
'isospeedratings',
])['value']);
$this
->assertTrue($file_metadata
->removeMetadata('exif', [
'exif',
'isospeedratings',
]));
$this
->assertNull($file_metadata
->getMetadata('exif', [
'exif',
'isospeedratings',
]));
$this
->assertEquals(48, $this
->countMetadataKeys($file_metadata, 'exif'));
// Add the RelatedImageFileFormat tag to INTEROP.
$this
->assertNull($file_metadata
->getMetadata('exif', [
'interop',
'RelatedImageFileFormat',
]));
$ff_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag([
'interop',
'RelatedImageFileFormat',
]);
$ff = new PelEntryAscii($ff_tag['tag'], 'qux');
$file_metadata
->setMetadata('exif', [
'interop',
'RelatedImageFileFormat',
], $ff);
$this
->assertEquals('qux', $file_metadata
->getMetadata('exif', [
'interop',
'RelatedImageFileFormat',
])['text']);
$this
->assertEquals(49, $this
->countMetadataKeys($file_metadata, 'exif'));
// Remove the InteroperabilityIndex tag from INTEROP.
$this
->assertEquals('R98', $file_metadata
->getMetadata('exif', [
'interop',
'InteroperabilityIndex',
])['value']);
$this
->assertTrue($file_metadata
->removeMetadata('exif', [
'interop',
'InteroperabilityIndex',
]));
$this
->assertNull($file_metadata
->getMetadata('exif', [
'interop',
'InteroperabilityIndex',
]));
$this
->assertEquals(48, $this
->countMetadataKeys($file_metadata, 'exif'));
// Add Longitude/Latitude tags to GPS.
$this
->assertNull($file_metadata
->getMetadata('exif', 'GPSLatitudeRef'));
$this
->assertNull($file_metadata
->getMetadata('exif', 'GPSLatitude'));
$this
->assertNull($file_metadata
->getMetadata('exif', 'GPSLongitudeRef'));
$this
->assertNull($file_metadata
->getMetadata('exif', 'GPSLongitude'));
$atr_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag('GPSLatitudeRef');
$at_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag('GPSLatitude');
$otr_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag('GPSLongitudeRef');
$ot_tag = $this->container
->get('file_mdm_exif.tag_mapper')
->resolveKeyToIfdAndTag('GPSLongitude');
$atr = new PelEntryAscii($atr_tag['tag'], 'N');
$at = new PelEntryRational($at_tag['tag'], [
46,
1,
], [
37,
1,
], [
59448,
10000,
]);
$otr = new PelEntryAscii($otr_tag['tag'], 'E');
$ot = new PelEntryRational($ot_tag['tag'], [
12,
1,
], [
17,
1,
], [
488112,
10000,
]);
$file_metadata
->setMetadata('exif', 'GPSLatitudeRef', $atr);
$file_metadata
->setMetadata('exif', 'GPSLatitude', $at);
$file_metadata
->setMetadata('exif', 'GPSLongitudeRef', $otr);
$file_metadata
->setMetadata('exif', 'GPSLongitude', $ot);
$this
->assertEquals('N', $file_metadata
->getMetadata('exif', 'GPSLatitudeRef')['text']);
$this
->assertNotNull($file_metadata
->getMetadata('exif', 'GPSLatitude')['text']);
$this
->assertEquals('E', $file_metadata
->getMetadata('exif', 'GPSLongitudeRef')['text']);
$this
->assertNotNull($file_metadata
->getMetadata('exif', 'GPSLongitude')['text']);
$this
->assertEquals(52, $this
->countMetadataKeys($file_metadata, 'exif'));
// Save metadata to file.
$this
->assertTrue($file_metadata
->saveMetadataToFile('exif'));
// Check results via exif_read_data.
$data = @exif_read_data($file_uri);
$this
->assertEquals(4, $data['Orientation']);
$this
->assertEquals('shot by foo!', $data['Artist']);
$this
->assertFalse(isset($data['Make']));
$this
->assertEquals('12/4', $data['BrightnessValue']);
$this
->assertFalse(isset($data['ISOSpeedRatings']));
$this
->assertEquals('qux', $data['RelatedFileFormat']);
$this
->assertFalse(isset($data['InterOperabilityIndex']));
$this
->assertEquals('N', $data['GPSLatitudeRef']);
$this
->assertEquals([
'46/1',
'37/1',
'59448/10000',
], $data['GPSLatitude']);
$this
->assertEquals('E', $data['GPSLongitudeRef']);
$this
->assertEquals([
'12/1',
'17/1',
'488112/10000',
], $data['GPSLongitude']);
// Test writing metadata to a file that has no EXIF info.
file_unmanaged_copy(drupal_get_path('module', 'simpletest') . '/files/image-2.jpg', 'public://', FILE_EXISTS_REPLACE);
$test_2 = $fmdm
->uri('public://image-2.jpg');
$this
->assertEquals(0, $this
->countMetadataKeys($test_2, 'exif'));
// Load EXIF metadata from previous file processed.
$test_2
->loadMetadata('exif', $file_metadata
->getMetadata('exif'));
// Save metadata to file.
$this
->assertTrue($test_2
->saveMetadataToFile('exif'));
$this
->assertEquals(52, $this
->countMetadataKeys($test_2, 'exif'));
// Check results via exif_read_data.
$data = @exif_read_data('public://image-2.jpg');
$this
->assertEquals(4, $data['Orientation']);
$this
->assertEquals('shot by foo!', $data['Artist']);
$this
->assertEquals('12/4', $data['BrightnessValue']);
$this
->assertEquals('qux', $data['RelatedFileFormat']);
$this
->assertEquals('N', $data['GPSLatitudeRef']);
$this
->assertEquals([
'46/1',
'37/1',
'59448/10000',
], $data['GPSLatitude']);
$this
->assertEquals('E', $data['GPSLongitudeRef']);
$this
->assertEquals([
'12/1',
'17/1',
'488112/10000',
], $data['GPSLongitude']);
// Check that after save, file metadata is retrieved from file first time,
// then from cache in further requests.
$file_metadata = NULL;
$this
->assertTrue($fmdm
->release($file_uri));
$file_metadata = $fmdm
->uri($file_uri);
$this
->assertEquals(52, $this
->countMetadataKeys($file_metadata, 'exif'));
$this
->assertSame(FileMetadataInterface::LOADED_FROM_FILE, $file_metadata
->isMetadataLoaded('exif'));
$file_metadata = NULL;
$this
->assertTrue($fmdm
->release($file_uri));
$file_metadata = $fmdm
->uri($file_uri);
$this
->assertEquals(52, $this
->countMetadataKeys($file_metadata, 'exif'));
$this
->assertSame(FileMetadataInterface::LOADED_FROM_CACHE, $file_metadata
->isMetadataLoaded('exif'));
}
/**
* Test writing metadata to TIFF file.
*/
public function testTiffExifSaveToFile() {
$fmdm = $this->container
->get('file_metadata_manager');
// Copy test file to public://.
file_unmanaged_copy(drupal_get_path('module', 'file_mdm') . '/tests/files/sample-1.tiff', 'public://', FILE_EXISTS_REPLACE);
$file_uri = 'public://sample-1.tiff';
$file_metadata = $fmdm
->uri($file_uri);
// Check values via exif_read_data before operations.
$data = @exif_read_data($file_uri);
$this
->assertEquals(1, $data['Orientation']);
$this
->assertEquals(2, $data['PhotometricInterpretation']);
// Change tags from IFD0.
$this
->assertEquals(1, $file_metadata
->getMetadata('exif', 'orientation')['value']);
$this
->assertTrue($file_metadata
->setMetadata('exif', 'orientation', 4));
$this
->assertEquals(4, $file_metadata
->getMetadata('exif', 'orientation')['value']);
$this
->assertEquals(2, $file_metadata
->getMetadata('exif', 'PhotometricInterpretation')['value']);
$this
->assertTrue($file_metadata
->setMetadata('exif', 'PhotometricInterpretation', 4));
$this
->assertEquals(4, $file_metadata
->getMetadata('exif', 'PhotometricInterpretation')['value']);
// Save metadata to file.
$this
->assertTrue($file_metadata
->saveMetadataToFile('exif'));
// Check results via exif_read_data.
$data = @exif_read_data($file_uri);
$this
->assertEquals(4, $data['Orientation']);
$this
->assertEquals(4, $data['PhotometricInterpretation']);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssertContentTrait:: |
protected | property | The current raw content. | |
AssertContentTrait:: |
protected | property | The drupalSettings value from the current raw $content. | |
AssertContentTrait:: |
protected | property | The XML structure parsed from the current raw $content. | 1 |
AssertContentTrait:: |
protected | property | The plain-text content of raw $content (text nodes). | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page with a given Xpath result. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is found. | |
AssertContentTrait:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist or its value does not match, by XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href is not found in the main region. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page does not exist. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the perl regex pattern is not found in raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text is NOT found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) does not contains the text. | |
AssertContentTrait:: |
protected | function | Pass if the page title is not the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found MORE THAN ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option with the visible text exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the Perl regex pattern is found in the raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) contains the text. | |
AssertContentTrait:: |
protected | function | Helper for assertText and assertNoText. | |
AssertContentTrait:: |
protected | function | Asserts that a Perl regex pattern is found in the plain-text content. | |
AssertContentTrait:: |
protected | function | Asserts themed output. | |
AssertContentTrait:: |
protected | function | Pass if the page title is the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found ONLY ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
AssertContentTrait:: |
protected | function | Builds an XPath query. | |
AssertContentTrait:: |
protected | function | Helper: Constructs an XPath for the given set of attributes and value. | |
AssertContentTrait:: |
protected | function | Searches elements using a CSS selector in the raw content. | |
AssertContentTrait:: |
protected | function | Get all option elements, including nested options, in a select. | |
AssertContentTrait:: |
protected | function | Gets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Gets the current raw content. | |
AssertContentTrait:: |
protected | function | Get the selected value from a select field. | |
AssertContentTrait:: |
protected | function | Retrieves the plain-text content from the current raw content. | |
AssertContentTrait:: |
protected | function | Get the current URL from the cURL handler. | 1 |
AssertContentTrait:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
AssertContentTrait:: |
protected | function | Removes all white-space between HTML tags from the raw content. | |
AssertContentTrait:: |
protected | function | Sets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Sets the raw content (e.g. HTML). | |
AssertContentTrait:: |
protected | function | Performs an xpath search on the contents of the internal browser. | |
AssertHelperTrait:: |
protected static | function | Casts MarkupInterface objects into strings. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertSame() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotSame() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead. | |
AssertLegacyTrait:: |
protected | function | ||
ConfigTestTrait:: |
protected | function | Returns a ConfigImporter object to import test configuration. | |
ConfigTestTrait:: |
protected | function | Copies configuration objects from source storage to target storage. | |
FileMetadataExifTest:: |
public static | property |
Modules to enable. Overrides KernelTestBase:: |
|
FileMetadataExifTest:: |
public | function |
Overrides FileMetadataManagerTestBase:: |
|
FileMetadataExifTest:: |
public | function | Test EXIF plugin. | |
FileMetadataExifTest:: |
public | function | Test writing metadata to JPEG file. | |
FileMetadataExifTest:: |
public | function | Test writing metadata to TIFF file. | |
FileMetadataManagerTestBase:: |
protected | function | Returns the count of metadata keys found in the file. | |
KernelTestBase:: |
protected | property | Back up and restore any global variables that may be changed by tests. | |
KernelTestBase:: |
protected | property | Back up and restore static class properties that may be changed by tests. | |
KernelTestBase:: |
protected | property | Contains a few static class properties for performance. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | @todo Move into Config test base class. | 7 |
KernelTestBase:: |
protected static | property | An array of config object names that are excluded from schema checking. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Do not forward any global state from the parent process to the processes that run the actual tests. | |
KernelTestBase:: |
protected | property | The app root. | |
KernelTestBase:: |
protected | property | Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Set to TRUE to strict check all configuration saved. | 6 |
KernelTestBase:: |
protected | property | The virtual filesystem root directory. | |
KernelTestBase:: |
protected | function | 1 | |
KernelTestBase:: |
protected | function | Bootstraps a basic test environment. | |
KernelTestBase:: |
private | function | Bootstraps a kernel for a test. | |
KernelTestBase:: |
protected | function | Configuration accessor for tests. Returns non-overridden configuration. | |
KernelTestBase:: |
protected | function | Disables modules for this test. | |
KernelTestBase:: |
protected | function | Enables modules for this test. | |
KernelTestBase:: |
protected | function | Gets the config schema exclusions for this test. | |
KernelTestBase:: |
protected | function | Returns the Database connection info to be used for this test. | 1 |
KernelTestBase:: |
public | function | ||
KernelTestBase:: |
private | function | Returns Extension objects for $modules to enable. | |
KernelTestBase:: |
private static | function | Returns the modules to enable for this test. | |
KernelTestBase:: |
protected | function | Initializes the FileCache component. | |
KernelTestBase:: |
protected | function | Installs default configuration for a given list of modules. | |
KernelTestBase:: |
protected | function | Installs the storage schema for a specific entity type. | |
KernelTestBase:: |
protected | function | Installs database tables from a module schema definition. | |
KernelTestBase:: |
protected | function | Returns whether the current test method is running in a separate process. | |
KernelTestBase:: |
protected | function | ||
KernelTestBase:: |
public | function |
Registers test-specific services. Overrides ServiceProviderInterface:: |
26 |
KernelTestBase:: |
protected | function | Renders a render array. | 1 |
KernelTestBase:: |
protected | function | Sets the install profile and rebuilds the container to update it. | |
KernelTestBase:: |
protected | function | Sets an in-memory Settings variable. | |
KernelTestBase:: |
public static | function | 1 | |
KernelTestBase:: |
protected | function | Sets up the filesystem, so things like the file directory. | 2 |
KernelTestBase:: |
protected | function | Stops test execution. | |
KernelTestBase:: |
protected | function | 6 | |
KernelTestBase:: |
public | function | @after | |
KernelTestBase:: |
protected | function | Dumps the current state of the virtual filesystem to STDOUT. | |
KernelTestBase:: |
public | function | BC: Automatically resolve former KernelTestBase class properties. | |
KernelTestBase:: |
public | function | Prevents serializing any properties. | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
RandomGeneratorTrait:: |
protected | property | The random generator. | |
RandomGeneratorTrait:: |
protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait:: |
protected | function | Generates a unique random string containing letters and numbers. | 1 |
RandomGeneratorTrait:: |
public | function | Generates a random PHP object. | |
RandomGeneratorTrait:: |
public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
RandomGeneratorTrait:: |
public | function | Callback for random string validation. | |
StorageCopyTrait:: |
protected static | function | Copy the configuration from one storage to another and remove stale items. | |
TestRequirementsTrait:: |
private | function | Checks missing module requirements. | |
TestRequirementsTrait:: |
protected | function | Check module requirements for the Drupal use case. | 1 |
TestRequirementsTrait:: |
protected static | function | Returns the Drupal root directory. |