-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #638 from tienvx/log-new-bug
Log new bug
- Loading branch information
Showing
87 changed files
with
459 additions
and
401 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Tienvx\Bundle\MbtBundle\Message; | ||
|
||
class CreateBugMessage implements MessageInterface | ||
{ | ||
public function __construct( | ||
protected int $taskId, | ||
protected array $steps, | ||
protected string $message | ||
) { | ||
} | ||
|
||
public function getTaskId(): int | ||
{ | ||
return $this->taskId; | ||
} | ||
|
||
public function getSteps(): array | ||
{ | ||
return $this->steps; | ||
} | ||
|
||
public function getMessage(): string | ||
{ | ||
return $this->message; | ||
} | ||
} |
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
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,45 @@ | ||
<?php | ||
|
||
namespace Tienvx\Bundle\MbtBundle\MessageHandler; | ||
|
||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface; | ||
use Tienvx\Bundle\MbtBundle\Entity\Bug; | ||
use Tienvx\Bundle\MbtBundle\Exception\UnexpectedValueException; | ||
use Tienvx\Bundle\MbtBundle\Message\CreateBugMessage; | ||
use Tienvx\Bundle\MbtBundle\Model\BugInterface; | ||
use Tienvx\Bundle\MbtBundle\Model\TaskInterface; | ||
use Tienvx\Bundle\MbtBundle\Repository\TaskRepositoryInterface; | ||
use Tienvx\Bundle\MbtBundle\Service\ConfigInterface; | ||
|
||
class CreateBugMessageHandler implements MessageHandlerInterface | ||
{ | ||
public function __construct( | ||
protected ConfigInterface $config, | ||
protected TaskRepositoryInterface $taskRepository | ||
) { | ||
} | ||
|
||
public function __invoke(CreateBugMessage $message): void | ||
{ | ||
$task = $this->taskRepository->find($message->getTaskId()); | ||
|
||
if (!$task instanceof TaskInterface) { | ||
throw new UnexpectedValueException(sprintf( | ||
'Can not create bug for task %d: task not found', | ||
$message->getTaskId() | ||
)); | ||
} | ||
|
||
$this->taskRepository->addBug($task, $this->createBug($message->getSteps(), $message->getMessage())); | ||
} | ||
|
||
public function createBug(array $steps, string $message): BugInterface | ||
{ | ||
$bug = new Bug(); | ||
$bug->setTitle($this->config->getDefaultBugTitle()); | ||
$bug->setSteps($steps); | ||
$bug->setMessage($message); | ||
|
||
return $bug; | ||
} | ||
} |
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
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
Oops, something went wrong.