You are here

public function AttributeHelperTest::testMergeCollectionsArgumentException in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::testMergeCollectionsArgumentException()
  2. 9 core/tests/Drupal/Tests/Core/Template/AttributeHelperTest.php \Drupal\Tests\Core\Template\AttributeHelperTest::testMergeCollectionsArgumentException()

@covers ::mergeCollections

File

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

Class

AttributeHelperTest
@coversDefaultClass \Drupal\Core\Template\AttributeHelper @group Template

Namespace

Drupal\Tests\Core\Template

Code

public function testMergeCollectionsArgumentException() {
  $attributes = new Attribute([
    'class' => [
      'example-class',
    ],
  ]);
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('Invalid collection argument');
  AttributeHelper::mergeCollections($attributes, 'not an array');
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('Invalid collection argument');
  AttributeHelper::mergeCollections('not an array', $attributes);
}