expectOnce('filter'); else $mock->expectNever('filter'); $mock->setReturnValue('filter', $result); return $mock; } function test_filter() { $def = new HTMLPurifier_URIDefinition(); $def->filters[] = $this->createFilterMock(); $def->filters[] = $this->createFilterMock(); $uri = $this->createURI('test'); $this->assertTrue($def->filter($uri, $this->config, $this->context)); } function test_filter_earlyAbortIfFail() { $def = new HTMLPurifier_URIDefinition(); $def->filters[] = $this->createFilterMock(true, false); $def->filters[] = $this->createFilterMock(false); // never called $uri = $this->createURI('test'); $this->assertFalse($def->filter($uri, $this->config, $this->context)); } }