class FieldInstanceSettingsTest
Same name in this branch
- 10 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldInstanceSettingsTest
Same name in other branches
- 9 core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldInstanceSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d6\FieldInstanceSettingsTest
- 9 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldInstanceSettingsTest
- 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldInstanceSettingsTest
- 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldInstanceSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d6\FieldInstanceSettingsTest
- 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldInstanceSettingsTest.php \Drupal\Tests\field\Unit\Plugin\migrate\process\d7\FieldInstanceSettingsTest
@coversDefaultClass \Drupal\field\Plugin\migrate\process\d6\FieldInstanceSettings @group field
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait
- class \Drupal\Tests\field\Unit\Plugin\migrate\process\d6\FieldInstanceSettingsTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of FieldInstanceSettingsTest
File
-
core/
modules/ field/ tests/ src/ Unit/ Plugin/ migrate/ process/ d6/ FieldInstanceSettingsTest.php, line 19
Namespace
Drupal\Tests\field\Unit\Plugin\migrate\process\d6View source
class FieldInstanceSettingsTest extends UnitTestCase {
/**
* @covers \Drupal\Core\Field\BaseFieldDefinition::getSettings
*
* @dataProvider getSettingsProvider
*/
public function testGetSettings($field_type, $instance_settings, $expected) : void {
$instance_settings = unserialize($instance_settings);
$migration = $this->createMock(MigrationInterface::class);
$plugin = new FieldInstanceSettings([], 'd6_field_field_settings', []);
$executable = $this->createMock(MigrateExecutableInterface::class);
$row = $this->getMockBuilder(Row::class)
->disableOriginalConstructor()
->getMock();
$result = $plugin->transform([
$field_type,
$instance_settings,
NULL,
], $executable, $row, 'foo');
$this->assertSame($expected, $result);
}
/**
* Provides field settings for testGetSettings().
*/
public static function getSettingsProvider() {
return [
'imagefield size set' => [
'imagefield_widget',
'a:14:{s:15:"file_extensions";s:11:"gif jpg png";s:9:"file_path";N;s:18:"progress_indicator";N;s:21:"max_filesize_per_file";s:3:"10M";s:21:"max_filesize_per_node";N;s:14:"max_resolution";N;s:14:"min_resolution";N;s:3:"alt";N;s:10:"custom_alt";i:1;s:5:"title";N;s:12:"custom_title";i:1;s:10:"title_type";N;s:13:"default_image";N;s:17:"use_default_image";N;}',
[
'file_extensions' => 'gif jpg png',
'file_directory' => NULL,
'max_filesize' => '10MB',
'alt_field' => NULL,
'alt_field_required' => 1,
'title_field' => NULL,
'title_field_required' => 1,
'max_resolution' => '',
'min_resolution' => '',
],
],
'imagefield size NULL' => [
'imagefield_widget',
'a:14:{s:15:"file_extensions";s:11:"gif jpg png";s:9:"file_path";N;s:18:"progress_indicator";N;s:21:"max_filesize_per_file";N;s:21:"max_filesize_per_node";N;s:14:"max_resolution";N;s:14:"min_resolution";N;s:3:"alt";N;s:10:"custom_alt";i:1;s:5:"title";N;s:12:"custom_title";i:1;s:10:"title_type";N;s:13:"default_image";N;s:17:"use_default_image";N;}',
[
'file_extensions' => 'gif jpg png',
'file_directory' => NULL,
'max_filesize' => '',
'alt_field' => NULL,
'alt_field_required' => 1,
'title_field' => NULL,
'title_field_required' => 1,
'max_resolution' => '',
'min_resolution' => '',
],
],
];
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|---|
FieldInstanceSettingsTest::getSettingsProvider | public static | function | Provides field settings for testGetSettings(). | ||
FieldInstanceSettingsTest::testGetSettings | public | function | @covers \Drupal\Core\Field\BaseFieldDefinition::getSettings | ||
PhpUnitWarnings::$deprecationWarnings | private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | ||
PhpUnitWarnings::addWarning | public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | ||
RandomGeneratorTrait::getRandomGenerator | protected | function | Gets the random generator for the utility methods. | ||
RandomGeneratorTrait::randomMachineName | protected | function | Generates a unique random string containing letters and numbers. | ||
RandomGeneratorTrait::randomObject | public | function | Generates a random PHP object. | ||
RandomGeneratorTrait::randomString | public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | ||
RandomGeneratorTrait::randomStringValidate | Deprecated | public | function | Callback for random string validation. | |
UnitTestCase::$root | protected | property | The app root. | 1 | |
UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | ||
UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | ||
UnitTestCase::getConfigStorageStub | public | function | Returns a stub config storage that returns the supplied configuration. | ||
UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | ||
UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | ||
UnitTestCase::setUp | protected | function | 357 | ||
UnitTestCase::setUpBeforeClass | public static | function | |||
UnitTestCase::__get | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.