function AttributeHelperTest::testMergeCollectionsStringWithAttributeArgumentException

Tests merge collections argument exception.

File

core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php, line 105

Class

AttributeHelperTest
Tests Drupal\Core\Template\AttributeHelper.

Namespace

Drupal\Tests\Core\Template

Code

public function testMergeCollectionsStringWithAttributeArgumentException() : void {
  $attributes = new Attribute([
    'class' => [
      'example-class',
    ],
  ]);
  $this->expectException(\InvalidArgumentException::class);
  $this->expectExceptionMessageIs('Invalid collection argument');
  // @phpstan-ignore argument.type
  AttributeHelper::mergeCollections('not an array', $attributes);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.