3 class HTMLPurifier_IDAccumulatorTest
extends HTMLPurifier_Harness
8 // initialize the accumulator
9 $accumulator = new HTMLPurifier_IDAccumulator();
11 $this->assertTrue( $accumulator->add('id1'));
12 $this->assertTrue( $accumulator->add('id2'));
13 $this->assertFalse($accumulator->add('id1')); // repeated id
15 // you can also access the properties (they're public)
16 $this->assertTrue( isset($accumulator->ids
['id2']) );
20 public function testLoad()
22 $accumulator = new HTMLPurifier_IDAccumulator();
24 $accumulator->load(array('id1', 'id2', 'id3'));
26 $this->assertFalse($accumulator->add('id1')); // repeated id
27 $this->assertTrue($accumulator->add('id4'));
31 public function testBuild()
33 $this->config
->set('Attr.IDBlacklist', array('foo'));
34 $accumulator = HTMLPurifier_IDAccumulator
::build($this->config
, $this->context
);
35 $this->assertTrue( isset($accumulator->ids
['foo']) );