3 class HTMLPurifier_AttrDef_SwitchTest
extends HTMLPurifier_AttrDefHarness
6 protected $with, $without;
8 public function setUp()
11 generate_mock_once('HTMLPurifier_AttrDef');
12 $this->with
= new HTMLPurifier_AttrDefMock();
13 $this->without
= new HTMLPurifier_AttrDefMock();
14 $this->def
= new HTMLPurifier_AttrDef_Switch('tag', $this->with
, $this->without
);
17 public function testWith()
19 $token = new HTMLPurifier_Token_Start('tag');
20 $this->context
->register('CurrentToken', $token);
21 $this->with
->expectOnce('validate');
22 $this->with
->returns('validate', 'foo');
23 $this->assertDef('bar', 'foo');
26 public function testWithout()
28 $token = new HTMLPurifier_Token_Start('other-tag');
29 $this->context
->register('CurrentToken', $token);
30 $this->without
->expectOnce('validate');
31 $this->without
->returns('validate', 'foo');
32 $this->assertDef('bar', 'foo');