16 return $this->getMockBuilder(
'Guzzle\Plugin\Backoff\AbstractBackoffStrategy')
17 ->setMethods(array(
'getDelay',
'makesDecision'))
18 ->getMockForAbstractClass();
23 $request =
new Request(
'GET',
'http://www.foo.com');
25 $mock->expects($this->atLeastOnce())->method(
'getDelay')->will($this->returnValue(
null));
26 $this->assertEquals(0, $mock->getBackoffPeriod(0, $request));
31 $request =
new Request(
'GET',
'http://www.foo.com');
33 $mock->expects($this->atLeastOnce())->method(
'getDelay')->will($this->returnValue(
false));
34 $this->assertEquals(
false, $mock->getBackoffPeriod(0, $request));
39 $request =
new Request(
'GET',
'http://www.foo.com');
41 $mock->expects($this->atLeastOnce())->method(
'getDelay')->will($this->returnValue(
null));
42 $mock->expects($this->any())->method(
'makesDecision')->will($this->returnValue(
false));
45 $mock2->expects($this->atLeastOnce())->method(
'getDelay')->will($this->returnValue(10));
46 $mock2->expects($this->atLeastOnce())->method(
'makesDecision')->will($this->returnValue(
true));
47 $mock->setNext($mock2);
49 $this->assertEquals(10, $mock->getBackoffPeriod(0, $request));
54 $request =
new Request(
'GET',
'http://www.foo.com');
56 $this->assertFalse($s->getBackoffPeriod(0, $request));
64 $this->assertSame($b, $a->getNext());
76 $this->assertEquals(10, $a->getBackoffPeriod(2,
new Request(
'GET',
'http://www.foo.com')));
84 $this->assertSame(0, $a->getBackoffPeriod(2,
new Request(
'GET',
'http://www.foo.com')));