-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[!!!][TASK] Provide a step number on instantiation of Incident class
Additionally, the step number cannot be null anymore and must be a positive integer. Otherwise an exception is thrown.
- Loading branch information
1 parent
592a79a
commit 10ffab1
Showing
9 changed files
with
142 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the JobRouter Client. | ||
* https://github.com/brotkrueml/jobrouter-client | ||
* | ||
* Copyright (c) 2019-2022 Chris Müller | ||
* | ||
* For the full copyright and license information, please view the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Brotkrueml\JobRouterClient\Exception; | ||
|
||
final class InvalidStepNumberException extends \DomainException implements ExceptionInterface | ||
{ | ||
public static function forStepNumber(int $stepNumber): self | ||
{ | ||
return new self( | ||
\sprintf( | ||
'The given step number "%d" is invalid, it must be an integer greater than 0', | ||
$stepNumber | ||
), | ||
1671041151 | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the JobRouter Client. | ||
* https://github.com/brotkrueml/jobrouter-client | ||
* | ||
* Copyright (c) 2019-2022 Chris Müller | ||
* | ||
* For the full copyright and license information, please view the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Brotkrueml\JobRouterClient\Tests\Unit\Exception; | ||
|
||
use Brotkrueml\JobRouterClient\Exception\InvalidStepNumberException; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class InvalidStepNumberExceptionTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function forStepNumber(): void | ||
{ | ||
$actual = InvalidStepNumberException::forStepNumber(0); | ||
|
||
self::assertSame('The given step number "0" is invalid, it must be an integer greater than 0', $actual->getMessage()); | ||
self::assertSame(1671041151, $actual->getCode()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters