for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
use HexMakina\Marker\Element;
final class ElementTest extends TestCase
{
public function testCanBeCreatedFromValidTagName(): void
$this->assertInstanceOf(
Element::class,
new Element('div')
);
}
public function testCanBeUsedAsString(): void
$this->assertEquals(
'<div>test</div>',
Element::div('test')->__toString()
div()
HexMakina\Marker\Element
__callStatic
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
Element::/** @scrutinizer ignore-call */
div('test')->__toString()
public function testVoidElement(): void
'<hr/>',
Element::hr()->__toString()
hr()
hr()->__toString()
public function testVoidElementWithAttribute(): void
'<img src="test.jpg"/>',
Element::img(null, ['src' => 'test.jpg'])->__toString()
img()
img(null, ['src' => 'test.jpg'])->__toString()
(new Element('img', null, ['src' => 'test.jpg']))->__toString()
public function testCanHaveStringClassAttribute(): void
$element = new Element('div', 'with class', ['class' => 'test']);
'<div class="test">with class</div>',
$element->__toString()
public function testCanHaveArrayClassAttribute(): void
$element = new Element('div', 'Hello, World!', ['class' => ['foo', 'bar']]);
'<div class="foo bar">Hello, World!</div>',