function testIsNotSatisfied() { $r1 = new MockFullPageCacheRule(); $r2 = new MockFullPageCacheRule(); $r1->expectOnce('isSatisfiedBy', array($request = new lmbObject())); $r1->setReturnValue('isSatisfiedBy', false); $r2->expectNever('isSatisfiedBy'); $set = new lmbFullPageCacheRuleset(); $set->addRule($r1); $set->addRule($r2); $this->assertFalse($set->isSatisfiedBy($request)); }
function testFindRule() { $rule = new lmbFullPageCacheRule(); $r1 = new MockFullPageCacheRule(); $r2 = new MockFullPageCacheRule(); $r3 = new MockFullPageCacheRule(); $request = new lmbObject(); $r1->expectOnce('isSatisfiedBy', array($request)); $r1->setReturnValue('isSatisfiedBy', false, array($request)); $r2->expectOnce('isSatisfiedBy', array($request)); $r2->setReturnValue('isSatisfiedBy', true, array($request)); $r3->expectNever('isSatisfiedBy'); $this->policy->addRuleset($r1); $this->policy->addRuleset($r2); $this->policy->addRuleset($r3); $this->assertSame($r2, $this->policy->findRuleset($request)); }