Prepended constants with C_ to avoid reserved words as per https://www.php.net/manual...
[htmlpurifier/darkodev.git] / tests / HTMLPurifier / IDAccumulatorTest.php
blob530654874b6de17d1fdc601f8e5feb7af0339420
1 <?php
3 class HTMLPurifier_IDAccumulatorTest extends HTMLPurifier_Harness
6 public function test()
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']) );
40 // vim: et sw=4 sts=4