obj = new HTMLPurifier_ChildDef_Custom('(a,b?,c*,d+,(a,b)*)'); $this->assertEqual($this->obj->elements, array('a' => true, 'b' => true, 'c' => true, 'd' => true)); $this->assertResult('', false); $this->assertResult('', false); $this->assertResult(''); $this->assertResult('Dobfoo'. 'foo'); } public function testNesting() { $this->obj = new HTMLPurifier_ChildDef_Custom('(a,b,(c|d))+'); $this->assertEqual($this->obj->elements, array('a' => true, 'b' => true, 'c' => true, 'd' => true)); $this->assertResult('', false); $this->assertResult(''); $this->assertResult('', false); } public function testNestedEitherOr() { $this->obj = new HTMLPurifier_ChildDef_Custom('b,(a|(c|d))+'); $this->assertEqual($this->obj->elements, array('a' => true, 'b' => true, 'c' => true, 'd' => true)); $this->assertResult('', false); $this->assertResult(''); $this->assertResult(''); $this->assertResult(''); $this->assertResult('', false); } public function testNestedQuantifier() { $this->obj = new HTMLPurifier_ChildDef_Custom('(b,c+)*'); $this->assertEqual($this->obj->elements, array('b' => true, 'c' => true)); $this->assertResult(''); $this->assertResult(''); $this->assertResult(''); $this->assertResult(''); $this->assertResult('', false); } public function testEitherOr() { $this->obj = new HTMLPurifier_ChildDef_Custom('a|b'); $this->assertEqual($this->obj->elements, array('a' => true, 'b' => true)); $this->assertResult('', false); $this->assertResult(''); $this->assertResult(''); $this->assertResult('', false); } public function testCommafication() { $this->obj = new HTMLPurifier_ChildDef_Custom('a,b'); $this->assertEqual($this->obj->elements, array('a' => true, 'b' => true)); $this->assertResult(''); $this->assertResult('', false); } public function testPcdata() { $this->obj = new HTMLPurifier_ChildDef_Custom('#PCDATA,a'); $this->assertEqual($this->obj->elements, array('#PCDATA' => true, 'a' => true)); $this->assertResult('foo'); $this->assertResult('', false); } public function testWhitespace() { $this->obj = new HTMLPurifier_ChildDef_Custom('a'); $this->assertEqual($this->obj->elements, array('a' => true)); $this->assertResult('foo', false); $this->assertResult(''); $this->assertResult(' '); } } // vim: et sw=4 sts=4