You are here

public function AttributesTest::testAttributeValueBaseCopy in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Common/AttributesTest.php \Drupal\Tests\Core\Common\AttributesTest::testAttributeValueBaseCopy()

Test AttributeValueBase copy.

File

core/tests/Drupal/Tests/Core/Common/AttributesTest.php, line 77
Contains \Drupal\Tests\Core\Common\AttributesTest.

Class

AttributesTest
Tests the Drupal\Core\Template\Attribute functionality.

Namespace

Drupal\Tests\Core\Common

Code

public function testAttributeValueBaseCopy() {
  $original_attributes = new Attribute([
    'checked' => TRUE,
    'class' => [
      'who',
      'is',
      'on',
    ],
    'id' => 'first',
  ]);
  $attributes['selected'] = $original_attributes['checked'];
  $attributes['id'] = $original_attributes['id'];
  $attributes = new Attribute($attributes);
  $this
    ->assertSame((string) $original_attributes, ' checked class="who is on" id="first"', 'Original boolean value used with original name.');
  $this
    ->assertSame((string) $attributes, ' selected id="first"', 'Original boolean value used with new name.');
}