Skip to content
Snippets Groups Projects
Verified Commit f296e346 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3196937 by quietone, ayushmishra206, paulocs, guilhermevp, alexpott:...

Issue #3196937 by quietone, ayushmishra206, paulocs, guilhermevp, alexpott: Deprecate the string code path for values parameter in BlockContentTestBase::createBlockContentType
parent 1c67d3b5
No related branches found
No related tags found
19 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!8736Update the Documention As per the Function uses.,!8513Issue #3453786: DefaultSelection should document why values for target_bundles NULL and [] behave as they do,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #282621 passed with warnings
Pipeline: drupal

#282624

    ......@@ -57,7 +57,7 @@ abstract class BlockContentTestBase extends BrowserTestBase {
    protected function setUp(): void {
    parent::setUp();
    if ($this->autoCreateBasicBlockType) {
    $this->createBlockContentType('basic', TRUE);
    $this->createBlockContentType(['id' => 'basic'], TRUE);
    }
    $this->adminUser = $this->drupalCreateUser($this->permissions);
    ......@@ -95,9 +95,11 @@ protected function createBlockContent($title = FALSE, $bundle = 'basic', $save =
    * Creates a block type (bundle).
    *
    * @param array|string $values
    * The value to create the block content type. If $values is an array
    * it should be like: ['id' => 'foo', 'label' => 'Foo']. If $values
    * is a string, it will be considered that it represents the label.
    * (deprecated) The variable $values as string is deprecated. Provide as an
    * array as parameter. The value to create the block content type. If
    * $values is an array it should be like: ['id' => 'foo', 'label' => 'Foo'].
    * If $values is a string, it will be considered that it represents the
    * label.
    * @param bool $create_body
    * Whether or not to create the body field
    *
    ......@@ -105,6 +107,9 @@ protected function createBlockContent($title = FALSE, $bundle = 'basic', $save =
    * Created block type.
    */
    protected function createBlockContentType($values, $create_body = FALSE) {
    if (is_string($values)) {
    @trigger_error('Using the variable $values as string is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Provide an array as parameter. See https://www.drupal.org/node/3473739', E_USER_DEPRECATED);
    }
    if (is_array($values)) {
    if (!isset($values['id'])) {
    do {
    ......
    ......@@ -102,11 +102,11 @@ public function testBlockContentTypeCreation(): void {
    $this->assertEquals($block_type->language()->getId(), $default_langcode);
    // Create block types programmatically.
    $this->createBlockContentType('basic', TRUE);
    $this->createBlockContentType(['id' => 'basic'], TRUE);
    $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('block_content', 'basic');
    $this->assertTrue(isset($field_definitions['body']), "Body field for 'basic' block type created when using the testing API to create block content types.");
    $this->createBlockContentType('other');
    $this->createBlockContentType(['id' => 'other']);
    $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('block_content', 'other');
    $this->assertFalse(isset($field_definitions['body']), "Body field for 'other' block type not created when using the testing API to create block content types.");
    ......@@ -123,11 +123,11 @@ public function testBlockContentTypeCreation(): void {
    public function testBlockContentTypeEditing(): void {
    $this->drupalPlaceBlock('system_breadcrumb_block');
    // Now create an initial block-type.
    $this->createBlockContentType('basic', TRUE);
    $this->createBlockContentType(['id' => 'basic'], TRUE);
    $this->drupalLogin($this->adminUser);
    // We need two block types to prevent /block/add redirecting.
    $this->createBlockContentType('other');
    $this->createBlockContentType(['id' => 'other']);
    $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('block_content', 'other');
    $this->assertFalse(isset($field_definitions['body']), 'Body field was not created when using the API to create block content types.');
    ......@@ -174,10 +174,10 @@ public function testBlockContentTypeEditing(): void {
    */
    public function testBlockContentTypeDeletion(): void {
    // Now create an initial block-type.
    $this->createBlockContentType('basic', TRUE);
    $this->createBlockContentType(['id' => 'basic'], TRUE);
    // Create a block type programmatically.
    $type = $this->createBlockContentType('foo');
    $type = $this->createBlockContentType(['id' => 'foo']);
    $this->drupalLogin($this->adminUser);
    ......@@ -201,12 +201,12 @@ public function testBlockContentTypeDeletion(): void {
    */
    public function testsBlockContentAddTypes(): void {
    // Now create an initial block-type.
    $this->createBlockContentType('basic', TRUE);
    $this->createBlockContentType(['id' => 'basic'], TRUE);
    $this->drupalLogin($this->adminUser);
    // Create two block types programmatically.
    $this->createBlockContentType('foo');
    $this->createBlockContentType('bar');
    $this->createBlockContentType(['id' => 'foo']);
    $this->createBlockContentType(['id' => 'bar']);
    // Get the content block storage.
    $storage = $this->container
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment