Skip to content
Snippets Groups Projects
Commit 24a533ab authored by catch's avatar catch
Browse files

Issue #3177922 by BR0kEN, dpi, catch, jonathanshaw: DelayedRequeueException...

Issue #3177922 by BR0kEN, dpi, catch, jonathanshaw: DelayedRequeueException should call parent, and optionally allow providing default args
parent c5eada74
No related branches found
No related tags found
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!16Draft: Resolve #2081585 "History storage"
......@@ -29,9 +29,16 @@ class DelayedRequeueException extends \RuntimeException {
* Constructs a DelayedRequeueException.
*
* @param int $delay
* The desired delay interval for this item.
* The desired delay interval for this item (in seconds).
* @param string $message
* The error message.
* @param int $code
* The error code.
* @param \Throwable|null $previous
* The previous throwable used for the exception chaining.
*/
public function __construct(int $delay = 0) {
public function __construct(int $delay = 0, string $message = '', int $code = 0, \Throwable $previous = NULL) {
parent::__construct($message, $code, $previous);
if ($delay > 0) {
$this->delay = $delay;
}
......
<?php
namespace Drupal\Tests\Core\Queue;
use Drupal\Core\Queue\DelayedRequeueException;
use Drupal\Tests\UnitTestCase;
/**
* Tests queue exceptions.
*
* @group Queue
*/
class QueueExceptionsTest extends UnitTestCase {
/**
* Tests that the `DelayedRequeueException` calls parent constructor.
*/
public function testDelayedRequeueExceptionCallsParentConstructor(): void {
$without_previous = new DelayedRequeueException(50, 'Delay the processing.');
static::assertSame(50, $without_previous->getDelay());
static::assertSame('Delay the processing.', $without_previous->getMessage());
static::assertSame(0, $without_previous->getCode());
static::assertNull($without_previous->getPrevious());
$with_previous = new DelayedRequeueException(100, 'Increase the delay.', 200, $without_previous);
static::assertSame(100, $with_previous->getDelay());
static::assertSame('Increase the delay.', $with_previous->getMessage());
static::assertSame(200, $with_previous->getCode());
static::assertSame($without_previous, $with_previous->getPrevious());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment