' . $value . '
'; $pattern = [ 'assertHtml($pattern, $input); $input = '
' . $value . '
' . $value . '
'; $pattern = [ 'assertHtml($pattern, $input); $input = '
' . $value . '
' . $value . '
'; $pattern = [ '['id' => $value], 'assertHtml($pattern, $input); } /** * test assertions fail when attributes are wrong. */ public function testBadAssertHtmlInvalidAttribute(): void { $input = 'My link'; $pattern = [ 'a' => ['hRef' => '/test.html', 'clAss' => 'active'], 'My link2', '/a', ]; try { $this->assertHtml($pattern, $input); $this->fail('Assertion should fail'); } catch (ExpectationFailedException $e) { $this->assertStringContainsString( 'Attribute did not match. Was expecting Attribute `clAss` == `active`', $e->getMessage() ); } } /** * test assertion failure on incomplete HTML */ public function testBadAssertHtmlMissingTags(): void { $input = 'My link'; $pattern = [ ' ['href' => '/test.html', 'class' => 'active'], 'My link', '/a', ]; try { $this->assertHtml($pattern, $input); } catch (ExpectationFailedException $e) { $this->assertStringContainsString( 'Item #1 / regex #0 failed: Open getMessage() ); } } }