button = new DquotesButton('serendipity[body]');
}
/**
* @test
* @dataProvider getNamedEntities
*/
public function render($type, $openTag, $closeTag, $namedEntity)
{
$this->button->setType($type);
$html = sprintf(
'',
$openTag,
$closeTag,
$namedEntity
);
$expected = ' ' . $html . PHP_EOL;
$this->assertEquals($expected, $this->button->render());
}
/**
* Data provider for named entities
*
* @return array
*/
public function getNamedEntities()
{
return array(
array('type1', '“', '”', '“ ”'),
array('type2', '„', '“', '„ “'),
array('type3', '„', '”', '„ ”'),
array('type4', '”', '”', '” ”'),
array('type5', '“', '„', '“ „'),
array('type6', '« ', ' »', '« »'),
array('type7', '»', '«', '» «'),
array('type8', '»', '»', '» »'),
);
}
/**
* @test
*/
public function renderInLegacyMode()
{
$this->button->setIsLegacyMode(true);
$this->button->setType('type1');
$expected = ' ' . PHP_EOL;
$this->assertEquals($expected, $this->button->render());
}
/**
* @test
*/
public function renderInLegacyModeNoNamedEnts()
{
$this->button->setIsLegacyMode(true);
$this->button->setUseNamedEnts(false);
$this->button->setType('type1');
$expected = ' ' . PHP_EOL;
$this->assertEquals($expected, $this->button->render());
}
}