Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Whatever...

  • Loading branch information...
commit a47597d92560d24cb00e17e336f2f50f796534b5 1 parent d18d60c
Michael Weinrich authored
View
5 src/Procrastinator/Executor/Decorator/SetTimeLimitDecorator.php
@@ -14,16 +14,17 @@ class SetTimeLimitDecorator extends ExecutorDecorator
*/
public function __construct(Executor $wrapped, $timeout)
{
- $this->timeout = (int)$timeout;
+ $this->timeout = (int) $timeout;
parent::__construct($wrapped);
}
/**
* @param Executable $manager
+ *
+ * remember: calling set_time_limit() restarts the timer at 0
*/
public function startExecution(Executable $manager)
{
- // remember: calling set_time_limit() restarts the timer at 0
set_time_limit($this->timeout);
parent::startExecution($manager);
View
51 tests/Procrastinator/Executor/Decorator/SetTimeLimitDecoratorTest.php
@@ -15,32 +15,55 @@ public function setUp()
{
$GLOBALS['fastcgi_finish_request'] = false;
- $this->executor = $this->getMockBuilder('Procrastinator\Executor\Executor')
- ->getMock();
+ $this->executor = $this
+ ->getMockBuilder('Procrastinator\Executor\Executor')
+ ->getMock();
$this->decorator = new SetTimeLimitDecorator($this->executor, 120);
- $this->executable = $this->getMockBuilder('Procrastinator\Executable')
- ->getMock();
- $this->deferred = $this->getMockBuilder('Procrastinator\Deferred\Deferred')
- ->getMock();
+ $this->executable = $this
+ ->getMockBuilder('Procrastinator\Executable')
+ ->getMock();
+ $this->deferred = $this
+ ->getMockBuilder('Procrastinator\Deferred\Deferred')
+ ->getMock();
}
public function testStartExecutionCallsFinishRequestAndThanWrapped()
{
- $this->assertSame(120, $this->decorator->getTimeout());
- $this->executor->expects($this->once())->method('startExecution')->with($this->executable);
- $this->decorator->startExecution($this->executable);
- $this->assertSame(120, $this->decorator->getTimeout());
+ $this
+ ->assertSame(120, $this->decorator->getTimeout());
+ $this
+ ->executor
+ ->expects($this->once())
+ ->method('startExecution')
+ ->with($this->executable);
+ $this
+ ->decorator
+ ->startExecution($this->executable);
+ $this
+ ->assertSame(120, $this->decorator->getTimeout());
}
public function testEndExecutionCallsWrapped()
{
- $this->executor->expects($this->once())->method('endExecution')->with($this->executable);
- $this->decorator->endExecution($this->executable);
+ $this
+ ->executor
+ ->expects($this->once())
+ ->method('endExecution')
+ ->with($this->executable);
+ $this
+ ->decorator
+ ->endExecution($this->executable);
}
public function testExecuteCallsWrapped()
{
- $this->executor->expects($this->once())->method('execute')->with($this->deferred);
- $this->decorator->execute($this->deferred);
+ $this
+ ->executor
+ ->expects($this->once())
+ ->method('execute')
+ ->with($this->deferred);
+ $this
+ ->decorator
+ ->execute($this->deferred);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.