diff --git a/app/Commands/Incident/ReportIncidentCommand.php b/app/Commands/Incident/ReportIncidentCommand.php index a4bcda9e4..0d840b707 100644 --- a/app/Commands/Incident/ReportIncidentCommand.php +++ b/app/Commands/Incident/ReportIncidentCommand.php @@ -116,7 +116,7 @@ final class ReportIncidentCommand * * @return void */ - public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, $template_vars) + public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null) { $this->name = $name; $this->status = $status; diff --git a/app/Commands/Incident/UpdateIncidentCommand.php b/app/Commands/Incident/UpdateIncidentCommand.php index 7517b7eca..1b565570a 100644 --- a/app/Commands/Incident/UpdateIncidentCommand.php +++ b/app/Commands/Incident/UpdateIncidentCommand.php @@ -125,7 +125,7 @@ final class UpdateIncidentCommand * * @return void */ - public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, $template_vars) + public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null) { $this->incident = $incident; $this->name = $name; diff --git a/app/Commands/Invite/ClaimInviteCommand.php b/app/Commands/Invite/ClaimInviteCommand.php index 7e49c0f70..9b89624b9 100644 --- a/app/Commands/Invite/ClaimInviteCommand.php +++ b/app/Commands/Invite/ClaimInviteCommand.php @@ -11,23 +11,25 @@ namespace CachetHQ\Cachet\Commands\Invite; +use CachetHQ\Cachet\Models\Invite; + final class ClaimInviteCommand { /** * The invte to mark as claimed. * - * @var \CachetHQ\Cachet\Model\Invite + * @var \CachetHQ\Cachet\Models\Invite */ public $invite; /** * Create a new claim invite command instance. * - * @param \CachetHQ\Cachet\Model\Invite $invite + * @param \CachetHQ\Cachet\Models\Invite $invite * * @return void */ - public function __construct($invite) + public function __construct(Invite $invite) { $this->invite = $invite; } diff --git a/app/Commands/Subscriber/UnsubscribeSubscriberCommand.php b/app/Commands/Subscriber/UnsubscribeSubscriberCommand.php index b46e2b0bb..a5392fb7d 100644 --- a/app/Commands/Subscriber/UnsubscribeSubscriberCommand.php +++ b/app/Commands/Subscriber/UnsubscribeSubscriberCommand.php @@ -25,7 +25,7 @@ final class UnsubscribeSubscriberCommand /** * Create a unsubscribe subscriber command instance. * - * @param string $subscriber + * @param \CachetHQ\Cachet\Models\Subscriber $subscriber * * @return void */ diff --git a/app/Commands/Subscriber/VerifySubscriberCommand.php b/app/Commands/Subscriber/VerifySubscriberCommand.php index 51ca7fa3a..fa4aa63e4 100644 --- a/app/Commands/Subscriber/VerifySubscriberCommand.php +++ b/app/Commands/Subscriber/VerifySubscriberCommand.php @@ -25,7 +25,7 @@ final class VerifySubscriberCommand /** * Create a verify subscriber command instance. * - * @param string $subscriber + * @param \CachetHQ\Cachet\Models\Subscriber $subscriber * * @return void */ diff --git a/app/Commands/User/GenerateApiTokenCommand.php b/app/Commands/User/GenerateApiTokenCommand.php index 5b79428b5..742b9140e 100644 --- a/app/Commands/User/GenerateApiTokenCommand.php +++ b/app/Commands/User/GenerateApiTokenCommand.php @@ -11,6 +11,8 @@ namespace CachetHQ\Cachet\Commands\User; +use CachetHQ\Cachet\Models\User; + final class GenerateApiTokenCommand { /** @@ -27,7 +29,7 @@ final class GenerateApiTokenCommand * * @return void */ - public function __construct($user) + public function __construct(User $user) { $this->user = $user; } diff --git a/app/Commands/User/InviteTeamMemberCommand.php b/app/Commands/User/InviteTeamMemberCommand.php index 7090fe289..4807132fd 100644 --- a/app/Commands/User/InviteTeamMemberCommand.php +++ b/app/Commands/User/InviteTeamMemberCommand.php @@ -32,11 +32,11 @@ final class InviteTeamMemberCommand /** * Create a new invite team member command instance. * - * @param array $email + * @param string[] $email * * @return void */ - public function __construct($emails) + public function __construct(array $emails) { $this->emails = $emails; } diff --git a/tests/Commands/Invite/ClaimInviteCommandTest.php b/tests/Commands/Invite/ClaimInviteCommandTest.php new file mode 100644 index 000000000..f8252ee67 --- /dev/null +++ b/tests/Commands/Invite/ClaimInviteCommandTest.php @@ -0,0 +1,41 @@ + + */ +class ClaimInviteCommandTest extends AbstractTestCase +{ + use CommandTrait; + + protected function getObjectAndParams() + { + $params = ['invite' => new Invite()]; + $object = new ClaimInviteCommand($params['invite']); + + return compact('params', 'object'); + } + + protected function getHandlerClass() + { + return ClaimInviteCommandHandler::class; + } +} diff --git a/tests/Commands/User/InviteTeamMemberCommandTest.php b/tests/Commands/User/InviteTeamMemberCommandTest.php new file mode 100644 index 000000000..0a787d316 --- /dev/null +++ b/tests/Commands/User/InviteTeamMemberCommandTest.php @@ -0,0 +1,45 @@ + + */ +class InviteTeamMemberCommandTest extends AbstractTestCase +{ + use CommandTrait; + + protected function getObjectAndParams() + { + $params = ['emails' => ['foo@example.com']]; + $object = new InviteTeamMemberCommand($params['emails']); + + return compact('params', 'object'); + } + + protected function objectHasRules() + { + return true; + } + + protected function getHandlerClass() + { + return InviteTeamMemberCommandHandler::class; + } +} diff --git a/tests/Commands/User/SignupUserCommandTest.php b/tests/Commands/User/SignupUserCommandTest.php new file mode 100644 index 000000000..6f4b8182d --- /dev/null +++ b/tests/Commands/User/SignupUserCommandTest.php @@ -0,0 +1,56 @@ + + */ +class SignupUserCommandTest extends AbstractTestCase +{ + use CommandTrait; + + protected function getObjectAndParams() + { + $params = [ + 'username' => 'Test', + 'password' => 'fooey', + 'email' => 'test@test.com', + 'level' => 1, + ]; + + $object = new SignupUserCommand( + $params['username'], + $params['password'], + $params['email'], + $params['level'] + ); + + return compact('params', 'object'); + } + + protected function objectHasRules() + { + return true; + } + + protected function getHandlerClass() + { + return SignupUserCommandHandler::class; + } +}