assertID example

/** * Tests printing of an attribute. */
  public function testPrint() {
    $attribute = new Attribute(['class' => ['example-class'], 'id' => 'example-id', 'enabled' => TRUE]);

    $content = $this->randomMachineName();
    $html = '<div' . (string) $attribute . '>' . $content . '</div>';
    $this->assertClass('example-class', $html);
    $this->assertNoClass('example-class2', $html);

    $this->assertID('example-id', $html);
    $this->assertNoID('example-id2', $html);

    $this->assertStringContainsString('enabled', $html);
  }

  /** * @covers ::createAttributeValue * @dataProvider providerTestAttributeValues */
  public function testAttributeValues(array $attributes$expected) {
    $this->assertEquals($expected(new Attribute($attributes))->__toString());
  }
Home | Imprint | This part of the site doesn't use cookies.