function MediaLibraryStateTest::testMethods
Same name in other branches
- 9 core/modules/media_library/tests/src/Kernel/MediaLibraryStateTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryStateTest::testMethods()
- 10 core/modules/media_library/tests/src/Kernel/MediaLibraryStateTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryStateTest::testMethods()
- 11.x core/modules/media_library/tests/src/Kernel/MediaLibraryStateTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryStateTest::testMethods()
Tests the media library state methods.
File
-
core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryStateTest.php, line 65
Class
- MediaLibraryStateTest
- Tests the media library state value object.
Namespace
Drupal\Tests\media_library\KernelCode
public function testMethods() {
$opener_id = 'test';
$allowed_media_type_ids = [
'document',
'image',
];
$selected_media_type_id = 'image';
$remaining_slots = 2;
$state = MediaLibraryState::create($opener_id, $allowed_media_type_ids, $selected_media_type_id, $remaining_slots);
$this->assertSame($opener_id, $state->getOpenerId());
$this->assertSame($allowed_media_type_ids, $state->getAllowedTypeIds());
$this->assertSame($selected_media_type_id, $state->getSelectedTypeId());
$this->assertSame($remaining_slots, $state->getAvailableSlots());
$this->assertTrue($state->hasSlotsAvailable());
$state = MediaLibraryState::create($opener_id, $allowed_media_type_ids, $selected_media_type_id, 0);
$this->assertFalse($state->hasSlotsAvailable());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.