// Since we don't yet inject the database connection, we need to use a
// reflection hack to set it in the plugin instance.
$reflector = new \ReflectionObject($plugin); $property = $reflector->getProperty('database'); $property->setValue($plugin, $this->getDatabase($source_data));
/**
* Get the protected config data out of a MemoryStorage.
*
* @param \Drupal\Core\Config\MemoryStorage $storage
* The config storage to extract the data from.
*
* @return array
*/ protectedstaticfunctiontoArray(MemoryStorage $storage){ $reflection = new \ReflectionObject($storage); $property = $reflection->getProperty('config');
/**
* Generate random data in a config storage.
*
* @param \Drupal\Core\Config\StorageInterface $storage
* The storage to populate with random data.
* @param bool $collections
* Add random collections or not.
*/
$r = new \ReflectionObject($command); $m = $r->getMethod('mergeApplicationDefinition'); $m->invoke($command); $this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); $this->assertTrue($command->getDefinition()->hasArgument('bar'), '->mergeApplicationDefinition() merges the application arguments and the command arguments'); $this->assertTrue($command->getDefinition()->hasOption('foo'), '->mergeApplicationDefinition() merges the application options and the command options'); $this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition() merges the application options and the command options');
$m->invoke($command); $this->assertEquals(3, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments and options'); }
/**
* Returns the bundle name (the class short name).
*/ finalpublicfunctiongetName(): string {
use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption;
protectedstaticfunctioncreateEphemeralPairedEditor(EditorInterface $editor, FilterFormatInterface $filter_format): EditorInterface { $paired_editor = clone$editor; // If the editor is still being configured, the configuration may not yet be
// valid. Explicitly mark the ephemeral paired editor as new to allow other
// code to treat this accordingly.
// @see \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::getProvidedElements()
$paired_editor->enforceIsNew(TRUE); $reflector = new \ReflectionObject($paired_editor); $property = $reflector->getProperty('filterFormat'); $property->setValue($paired_editor, clone$filter_format); return$paired_editor; }
/**
* Maps Text Editor config object property paths to form names.
*
* @param string $property_path
* A config object property path.
* @param array $subform
* The subform being checked.
*
* @return string
* The corresponding form name in the subform.
*/
/**
* Asserts there on no public properties on the object instance.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @internal
*/ protectedfunctionassertNoPublicProperties(EntityTypeInterface $entity_type): void { $reflection = new \ReflectionObject($entity_type); $this->assertEmpty($reflection->getProperties(\ReflectionProperty::IS_PUBLIC)); }