getConfiguration example

$this->assertEquals($expected$this->defaultPluginCollection->sortHelper($plugin_id_1$plugin_id_2));
  }

  /** * @covers ::getConfiguration */
  public function testGetConfiguration() {
    $this->setupPluginCollection($this->exactly(3));
    // The expected order matches $this->config.     $expected = ['banana', 'cherry', 'apple'];

    $config = $this->defaultPluginCollection->getConfiguration();
    $this->assertSame($expectedarray_keys($config), 'The order of the configuration is unchanged.');

    $ids = $this->defaultPluginCollection->getInstanceIds();
    $this->assertSame($expectedarray_keys($ids), 'The order of the instances is unchanged.');

    $this->defaultPluginCollection->sort();
    $config = $this->defaultPluginCollection->getConfiguration();
    $this->assertSame($expectedarray_keys($config), 'After sorting, the order of the configuration is unchanged.');

    $ids = $this->defaultPluginCollection->getInstanceIds();
    sort($expected);
    

    $expected_configuration = [
      'id' => 'test_block_instantiation',
      'label' => 'Custom Display Message',
      'label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE,
      'provider' => 'block_test',
      'display_message' => 'no message set',
    ];
    // Initial configuration of the block at construction time.     /** @var \Drupal\Core\Block\BlockPluginInterface $display_block */
    $display_block = $manager->createInstance('test_block_instantiation', $configuration);
    $this->assertSame($expected_configuration$display_block->getConfiguration(), 'The block was configured correctly.');

    // Updating an element of the configuration.     $display_block->setConfigurationValue('display_message', 'My custom display message.');
    $expected_configuration['display_message'] = 'My custom display message.';
    $this->assertSame($expected_configuration$display_block->getConfiguration(), 'The block configuration was updated correctly.');
    $definition = $display_block->getPluginDefinition();

    $expected_form = [
      'provider' => [
        '#type' => 'value',
        '#value' => 'block_test',
      ],
static::assertEquals('value', $config->getValue('test'));
    }

    public function testGetWholeConfiguration(): void
    {
        $config = new CompilerConfiguration([
            'test' => 'value',
        ]);

        static::assertEquals([
            'test' => 'value',
        ]$config->getConfiguration());
    }
}
$assert_session->fieldValueEquals('Attribute 1', 'name');
    $assert_session->fieldValueEquals('Attribute 2', MediaSourceInterface::METADATA_FIELD_EMPTY);

    /** @var \Drupal\media\MediaTypeInterface $loaded_media_type */
    $loaded_media_type = $this->container->get('entity_type.manager')
      ->getStorage('media_type')
      ->load($this->testMediaType->id());
    $this->assertSame($loaded_media_type->id()$this->testMediaType->id());
    $this->assertSame($loaded_media_type->label()$new_name);
    $this->assertSame($loaded_media_type->getDescription()$new_description);
    $this->assertSame($loaded_media_type->getSource()->getPluginId(), 'test');
    $this->assertSame($loaded_media_type->getSource()->getConfiguration()['test_config_value'], 'This is new config value.');
    $this->assertTrue($loaded_media_type->shouldCreateNewRevision());
    $this->assertTrue($loaded_media_type->thumbnailDownloadsAreQueued());
    $this->assertFalse($loaded_media_type->getStatus());
    $this->assertSame($loaded_media_type->getFieldMap()['attribute_1' => 'name']);

    // We need to clear the statically cached field definitions to account for     // fields that have been created by API calls in this test, since they exist     // in a separate memory space from the web server.     $this->container->get('entity_field.manager')->clearCachedFieldDefinitions();

    // Test that a media item being created with default status to "FALSE",
$connection = $this->getMockBuilder(Connection::class)
            ->setConstructorArgs([
                array_merge(
                    $connection->getParams(),
                    [
                        'url' => $_SERVER['DATABASE_URL'],
                        'dbname' => $connection->getDatabase(),
                    ]
                ),
                $connection->getDriver(),
                $connection->getConfiguration(),
            ])
            ->onlyMethods(['delete'])
            ->getMock();

        $connection->method('delete')->willThrowException(new Exception('test'));

        $successSpy = $this->callbackSpy();
        $errorSpy = $this->callbackSpy();

        $spy = $this->eventListenerCalledSpy(function DEntityDeleteEvent $event) use ($successSpy$errorSpy): void {
            $event->addSuccess($successSpy(...));
            
return $image_upload_status !== $required_value;

        case 'filter':
          $filters = $editor->getFilterFormat()->filters();
          assert($filters instanceof FilterPluginCollection);
          if (!$filters->has($required_value) || !$filters->get($required_value)->status) {
            return TRUE;
          }
          break;

        case 'requiresConfiguration':
          $intersection = array_intersect($plugin->getConfiguration()$required_value);
          return $intersection !== $required_value;

        case 'plugins':
          // Tricky: this cannot yet be evaluated here. It will evaluated later.           // @see \Drupal\ckeditor5\Plugin\CKEditor5PluginManager::getEnabledDefinitions()           return FALSE;
      }
    }

    return FALSE;
  }

}

  protected function createEntity() {
    $workflow = Workflow::create([
      'id' => 'rest_workflow',
      'label' => 'REST Workflow',
      'type' => 'workflow_type_complex_test',
    ]);
    $workflow
      ->getTypePlugin()
      ->addState('draft', 'Draft')
      ->addState('published', 'Published');
    $configuration = $workflow->getTypePlugin()->getConfiguration();
    $configuration['example_setting'] = 'foo';
    $configuration['states']['draft']['extra'] = 'bar';
    $workflow->getTypePlugin()->setConfiguration($configuration);
    $workflow->save();
    return $workflow;
  }

  /** * {@inheritdoc} */
  protected function getExpectedDocument() {
    
if (!($extension instanceof ConfigurationExtensionInterface || $extension instanceof ConfigurationInterface)
                || !$config = array_filter($container->getExtensionConfig($name))
            ) {
                // this extension has no semantic configuration or was not called                 continue;
            }

            $config = $resolvingBag->resolveValue($config);

            if ($extension instanceof ConfigurationInterface) {
                $configuration = $extension;
            } elseif (null === $configuration = $extension->getConfiguration($config$container)) {
                continue;
            }

            $this->extensionConfig[$name] = $processor->processConfiguration($configuration$config);
        }

        $resolvingBag->clearUnusedEnvPlaceholders();
    }

    /** * @internal */
$this->blockManager->createInstance('block_plugin_id', ['id' => 'block_plugin_id'])->willReturn($block->reveal());

    $access_result = AccessResult::allowed();
    $block->access($this->account->reveal(), TRUE)->willReturn($access_result);
    $block->build()->willReturn($block_content);
    $block->getCacheContexts()->willReturn([]);
    $block->getCacheTags()->willReturn([]);
    $block->getCacheMaxAge()->willReturn(Cache::PERMANENT);
    $block->getPluginId()->willReturn('block_plugin_id');
    $block->getBaseId()->willReturn('block_plugin_id');
    $block->getDerivativeId()->willReturn(NULL);
    $block->getConfiguration()->willReturn([]);
    $block->getPreviewFallbackString()->willReturn($placeholder_label);

    $section = [
      new SectionComponent('some_uuid', 'content', ['id' => 'block_plugin_id']),
    ];
    $expected = [
      'content' => [
        'some_uuid' => $render_array,
      ],
    ];
    $result = (new Section('layout_onecol', []$section))->toRenderArray();
    
public function testGetConfigWhenNotExists(): void
    {
        $appLoader = new AppLoader(
            __DIR__,
            __DIR__,
            new ConfigReader()
        );

        $appEntity = new AppEntity();
        $appEntity->setPath('non-existing');

        static::assertNull($appLoader->getConfiguration($appEntity));
    }

    public function testGetConfig(): void
    {
        $appLoader = new AppLoader(
            __DIR__,
            __DIR__,
            new ConfigReader()
        );

        $appEntity = new AppEntity();
        
      $query->innerJoin($data_table, NULL, "[base_table].[cid] = [$data_table].[cid] AND [$data_table].[default_langcode] = 1");
    }

    // Historically, comments were always linked to 'node' entities, but that is     // no longer the case, as the 'node' module might not even be enabled.     // Comments can now be linked to any entity and they can also be referenced     // by other entities, so we won't have a single table to join to. That     // actually means that we can no longer optimize the query on those cases.     // However, the most common case remains to be comment replies, and in this     // case, we can get the host entity type if the 'entity' value is present     // and perform the extra joins and alterations needed.     $comment = $this->getConfiguration()['entity'];
    if ($comment instanceof CommentInterface) {
      $host_entity_type_id = $comment->getCommentedEntityTypeId();

      /** @var \Drupal\Core\Entity\EntityTypeInterface $host_entity_type */
      $host_entity_type = $this->entityTypeManager->getDefinition($host_entity_type_id);
      $host_entity_field_data_table = $host_entity_type->getDataTable();

      // Not all entities have a data table, so check first.       if ($host_entity_field_data_table) {
        $id_key = $host_entity_type->getKey('id');

        
'type' => '_none',
        'role' => NULL,
      ],
      'include_anonymous' => TRUE,
    ] + parent::defaultConfiguration();
  }

  /** * {@inheritdoc} */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $configuration = $this->getConfiguration();

    $form['include_anonymous'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Include the anonymous user.'),
      '#default_value' => $configuration['include_anonymous'],
    ];

    // Add user specific filter options.     $form['filter']['type'] = [
      '#type' => 'select',
      '#title' => $this->t('Filter by'),
      
if (isset($extensionConfig[$extensionAlias])) {
            return $extensionConfig[$extensionAlias];
        }

        // Fall back to default config if the extension has one
        if (!$extension instanceof ConfigurationExtensionInterface && !$extension instanceof ConfigurationInterface) {
            throw new \LogicException(sprintf('The extension with alias "%s" does not have configuration.', $extensionAlias));
        }

        $configs = $container->getExtensionConfig($extensionAlias);
        $configuration = $extension instanceof ConfigurationInterface ? $extension : $extension->getConfiguration($configs$container);
        $this->validateConfiguration($extension$configuration);

        return (new Processor())->processConfiguration($configuration$configs);
    }

    public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
    {
        if ($input->mustSuggestArgumentValuesFor('name')) {
            $suggestions->suggestValues($this->getAvailableExtensions());
            $suggestions->suggestValues($this->getAvailableBundles());

            

    private SnsClient $snsClient;

    public function __construct(SnsClient $snsClient, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
    {
        $this->snsClient = $snsClient;
        parent::__construct($client$dispatcher);
    }

    public function __toString(): string
    {
        $configuration = $this->snsClient->getConfiguration();

        return sprintf('sns://%s?region=%s', $this->getEndpoint()$configuration->get('region'));
    }

    public function supports(MessageInterface $message): bool
    {
        return $message instanceof SmsMessage || ($message instanceof ChatMessage && $message->getOptions() instanceof AmazonSnsOptions);
    }

    protected function doSend(MessageInterface $message): SentMessage
    {
        
$is_content_empty = Element::isEmpty($content);
      $is_placeholder_ready = $event->inPreview() && $block instanceof PreviewFallbackInterface;
      // If the content is empty and no placeholder is available, return.       if ($is_content_empty && !$is_placeholder_ready) {
        return;
      }

      $build = [
        // @todo Move this to BlockBase in https://www.drupal.org/node/2931040.         '#theme' => 'block',
        '#configuration' => $block->getConfiguration(),
        '#plugin_id' => $block->getPluginId(),
        '#base_plugin_id' => $block->getBaseId(),
        '#derivative_plugin_id' => $block->getDerivativeId(),
        '#in_preview' => $event->inPreview(),
        '#weight' => $event->getComponent()->getWeight(),
      ];

      // Place the $content returned by the block plugin into a 'content' child       // element, as a way to allow the plugin to have complete control of its       // properties and rendering (for instance, its own #theme) without       // conflicting with the properties used above, or alternate ones used by
Home | Imprint | This part of the site doesn't use cookies.