stringValidator = TestEnvironment::newValidatorFactory()->newStringValidator();
}
public function testStandardTable_Cell_Row() {
$instance = new HtmlTable();
$instance->cell( 'Foo', [ 'rel' => 'some' ] );
$instance->row( [ 'class' => 'bar' ] );
$this->stringValidator->assertThatStringContains(
'
',
$instance->table()
);
}
public function testStandardTable_Header_Cell_Row() {
$instance = new HtmlTable();
$instance->header( 'Foo ' );
$instance->cell( 'Bar' );
$instance->row();
$this->stringValidator->assertThatStringContains(
'',
$instance->table()
);
}
public function testStandardTable_Header_Cell_Row_IsHtml() {
$instance = new HtmlTable();
$instance->header( 'Foo' );
$instance->cell( 'Bar' );
$instance->row();
$this->stringValidator->assertThatStringContains(
'',
$instance->table( [], false, true )
);
}
public function testTransposedTable_Cell_Row() {
$instance = new HtmlTable();
// We need a dedicated header definition to support a table transpose
$instance->header( 'Foo' );
$instance->header( 'Bar' );
$instance->cell( 'lala', [ 'class' => 'foo' ] );
$instance->row();
$instance->cell( 'lula', [ 'rel' => 'tuuu' ] );
$instance->cell( 'lila' );
$instance->row();
$this->stringValidator->assertThatStringContains(
[
'| Foo | ',
'lala | lula |
|---|
| Bar | ',
' | lila |
|---|
'
],
$instance->table( [], true )
);
}
public function testTransposedTable_Cell_Row_IsHtml() {
$instance = new HtmlTable();
// We need a dedicated header definition to support a table transpose
$instance->header( 'Foo' );
$instance->header( 'Bar' );
$instance->cell( 'lala', [ 'class' => 'foo' ] );
$instance->row();
$instance->cell( 'lula', [ 'rel' => 'tuuu' ] );
$instance->cell( 'lila' );
$instance->row();
$this->stringValidator->assertThatStringContains(
[
'| Foo | lala | ',
'lula |
|---|
| Bar | | lila |
',
'
'
],
$instance->table( [], true, true )
);
}
}