protected function FileMetadataManagerTestBase::countMetadataKeys in File metadata manager 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/FileMetadataManagerTestBase.php \Drupal\Tests\file_mdm\Kernel\FileMetadataManagerTestBase::countMetadataKeys()
Returns the count of metadata keys found in the file.
Parameters
\Drupal\file_mdm\FileMetadataInterface $file_md: The FileMetadata object.
string $metadata_id: The file metadata plugin id.
mixed $options: (optional) Allows specifying additional options to control the list of metadata keys returned.
Return value
int The count of metadata keys found in the file.
8 calls to FileMetadataManagerTestBase::countMetadataKeys()
- FileMetadataExifTest::testExifPlugin in file_mdm_exif/
tests/ src/ Kernel/ FileMetadataExifTest.php - Test EXIF plugin.
- FileMetadataExifTest::testJpegExifSaveToFile in file_mdm_exif/
tests/ src/ Kernel/ FileMetadataExifTest.php - Test writing metadata to JPEG file.
- FileMetadataFontTest::testFontPlugin in file_mdm_font/
tests/ src/ Kernel/ FileMetadataFontTest.php - Test 'font' plugin.
- FileMetadataManagerTest::testFileMetadata in tests/
src/ Kernel/ FileMetadataManagerTest.php - Tests using the 'getimagesize' plugin.
- FileMetadataManagerTest::testFileMetadataCaching in tests/
src/ Kernel/ FileMetadataManagerTest.php - Test caching.
File
- tests/
src/ Kernel/ FileMetadataManagerTestBase.php, line 35
Class
- FileMetadataManagerTestBase
- Base test class for File Metadata Manager.
Namespace
Drupal\Tests\file_mdm\KernelCode
protected function countMetadataKeys(FileMetadataInterface $file_md, $metadata_id, $options = NULL) {
$supported_keys = $file_md
->getSupportedKeys($metadata_id, $options);
$count = 0;
foreach ($supported_keys as $key) {
if ($file_md
->getMetadata($metadata_id, $key)) {
$count++;
}
}
return $count;
}