2009-02-21 07:58:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_AttrTransform_NameSyncTest extends HTMLPurifier_AttrTransformHarness
|
|
|
|
{
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2009-02-21 07:58:30 +00:00
|
|
|
parent::setUp();
|
|
|
|
$this->obj = new HTMLPurifier_AttrTransform_NameSync();
|
|
|
|
$this->accumulator = new HTMLPurifier_IDAccumulator();
|
|
|
|
$this->context->register('IDAccumulator', $this->accumulator);
|
2009-03-14 23:18:02 +00:00
|
|
|
$this->config->set('Attr.EnableID', true);
|
2009-02-21 07:58:30 +00:00
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testEmpty()
|
|
|
|
{
|
2009-02-21 07:58:30 +00:00
|
|
|
$this->assertResult( array() );
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testAllowSame()
|
|
|
|
{
|
2009-02-21 07:58:30 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('name' => 'free', 'id' => 'free')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testAllowDifferent()
|
|
|
|
{
|
2009-02-21 07:58:30 +00:00
|
|
|
$this->assertResult(
|
|
|
|
array('name' => 'tryit', 'id' => 'thisgood')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function testCheckName()
|
|
|
|
{
|
2009-02-21 07:58:30 +00:00
|
|
|
$this->accumulator->add('notok');
|
|
|
|
$this->assertResult(
|
|
|
|
array('name' => 'notok', 'id' => 'ok'),
|
|
|
|
array('id' => 'ok')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|