From 7d27c61abe416df7d40ca48e3d4a6774c57539f9 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 18 Mar 2017 09:14:16 +0000 Subject: [PATCH 1/4] Rename ComponentStatusWasUpdated --- ...tedEvent.php => ComponentStatusWasChangedEvent.php} | 10 +++++----- .../Component/UpdateComponentCommandHandler.php | 4 ++-- .../SendComponentUpdateEmailNotificationHandler.php | 6 +++--- app/Foundation/Providers/EventServiceProvider.php | 2 +- ...Test.php => ComponentStatusWasChangedEventTest.php} | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) rename app/Bus/Events/Component/{ComponentStatusWasUpdatedEvent.php => ComponentStatusWasChangedEvent.php} (89%) rename tests/Bus/Events/Component/{ComponentStatusWasUpdatedEventTest.php => ComponentStatusWasChangedEventTest.php} (87%) diff --git a/app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php b/app/Bus/Events/Component/ComponentStatusWasChangedEvent.php similarity index 89% rename from app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php rename to app/Bus/Events/Component/ComponentStatusWasChangedEvent.php index 14b877770fa6..4c987409b653 100644 --- a/app/Bus/Events/Component/ComponentStatusWasUpdatedEvent.php +++ b/app/Bus/Events/Component/ComponentStatusWasChangedEvent.php @@ -16,21 +16,21 @@ use CachetHQ\Cachet\Models\User; /** - * This is the component status was updated event. + * This is the component status was changed event. * * @author James Brooks */ -final class ComponentStatusWasUpdatedEvent implements ActionInterface, ComponentEventInterface +final class ComponentStatusWasChangedEvent implements ActionInterface, ComponentEventInterface { /** - * The user who updated the component. + * The user who changed the component. * * @var \CachetHQ\Cachet\Models\User */ public $user; /** - * The component that was updated. + * The component that was changed. * * @var \CachetHQ\Cachet\Models\Component */ @@ -84,7 +84,7 @@ public function __construct(User $user, Component $component, $original_status, */ public function __toString() { - return 'Component status was updated.'; + return 'Component status was changed.'; } /** diff --git a/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php b/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php index 17d371655afc..736ff23cce44 100644 --- a/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Component/UpdateComponentCommandHandler.php @@ -12,7 +12,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component; use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand; -use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent; +use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent; use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent; use CachetHQ\Cachet\Models\Component; use Illuminate\Contracts\Auth\Guard; @@ -50,7 +50,7 @@ public function handle(UpdateComponentCommand $command) $component = $command->component; $originalStatus = $component->status; - event(new ComponentStatusWasUpdatedEvent($this->auth->user(), $component, $originalStatus, $command->status, $command->silent)); + event(new ComponentStatusWasChangedEvent($this->auth->user(), $component, $originalStatus, $command->status, $command->silent)); $component->update($this->filter($command)); diff --git a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php index 6c7de880ce8a..33c77fb29618 100644 --- a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php @@ -11,7 +11,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Events\Component; -use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent; +use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Subscriber; use CachetHQ\Cachet\Notifications\Component\ComponentStatusChangedNotification; @@ -40,11 +40,11 @@ public function __construct(Subscriber $subscriber) /** * Handle the event. * - * @param \CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent $event + * @param \CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent $event * * @return void */ - public function handle(ComponentStatusWasUpdatedEvent $event) + public function handle(ComponentStatusWasChangedEvent $event) { $component = $event->component; diff --git a/app/Foundation/Providers/EventServiceProvider.php b/app/Foundation/Providers/EventServiceProvider.php index 941abb96e3f5..fed96eec54b9 100644 --- a/app/Foundation/Providers/EventServiceProvider.php +++ b/app/Foundation/Providers/EventServiceProvider.php @@ -39,7 +39,7 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasUpdatedEvent' => [ // ], - 'CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent' => [ + 'CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent' => [ 'CachetHQ\Cachet\Bus\Handlers\Events\Component\SendComponentUpdateEmailNotificationHandler', ], 'CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent' => [ diff --git a/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php b/tests/Bus/Events/Component/ComponentStatusWasChangedEventTest.php similarity index 87% rename from tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php rename to tests/Bus/Events/Component/ComponentStatusWasChangedEventTest.php index 6417ba8cc34c..43fc7df5e42a 100644 --- a/tests/Bus/Events/Component/ComponentStatusWasUpdatedEventTest.php +++ b/tests/Bus/Events/Component/ComponentStatusWasChangedEventTest.php @@ -11,18 +11,18 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\Component; -use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasUpdatedEvent; +use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\User; use Illuminate\Foundation\Testing\DatabaseMigrations; use MailThief\Testing\InteractsWithMail; /** - * This is the component status was updated event test. + * This is the component status was changed event test. * * @author James Brooks */ -class ComponentStatusWasUpdatedEventTest extends AbstractComponentEventTestCase +class ComponentStatusWasChangedEventTest extends AbstractComponentEventTestCase { use DatabaseMigrations, InteractsWithMail; @@ -40,7 +40,7 @@ public function testComponentUpdateEmailWasSent() $subscriber->subscriptions()->create(['component_id' => $component->id]); - $this->app['events']->fire(new ComponentStatusWasUpdatedEvent($user, $component, 1, 2, false)); + $this->app['events']->fire(new ComponentStatusWasChangedEvent($user, $component, 1, 2, false)); $this->seeMessageFor($subscriber->email); $this->seeMessageWithSubject(trans('notifications.component.status_update.mail.subject')); @@ -65,7 +65,7 @@ protected function getObjectAndParams() 'new_status' => 2, 'silent' => false, ]; - $object = new ComponentStatusWasUpdatedEvent( + $object = new ComponentStatusWasChangedEvent( $params['user'], $params['component'], $params['original_status'], From a55575656d97aef34ba90d5963cf009a24a586e9 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 18 Mar 2017 09:30:36 +0000 Subject: [PATCH 2/4] Rename Bus Add to Create --- ...Command.php => CreateComponentCommand.php} | 7 ++++++- ...nd.php => CreateComponentGroupCommand.php} | 4 ++-- ...ricCommand.php => CreateMetricCommand.php} | 8 ++++++- ...mmand.php => CreateMetricPointCommand.php} | 8 ++++++- ...dUserCommand.php => CreateUserCommand.php} | 4 ++-- ...Event.php => ComponentWasCreatedEvent.php} | 7 ++++++- ....php => ComponentGroupWasCreatedEvent.php} | 7 ++++++- ...ent.php => MetricPointWasCreatedEvent.php} | 7 ++++++- ...dedEvent.php => MetricWasCreatedEvent.php} | 7 ++++++- ...AddedEvent.php => UserWasCreatedEvent.php} | 7 ++++++- ....php => CreateComponentCommandHandler.php} | 21 ++++++++++++------- ...=> CreateComponentGroupCommandHandler.php} | 16 +++++++------- ...ler.php => CreateMetricCommandHandler.php} | 12 +++++------ ...hp => CreateMetricPointCommandHandler.php} | 16 +++++++------- ...ndler.php => CreateUserCommandHandler.php} | 14 ++++++------- .../User/SignupUserCommandHandler.php | 4 ++-- .../Providers/EventServiceProvider.php | 10 ++++----- .../Controllers/Api/ComponentController.php | 4 ++-- .../Api/ComponentGroupController.php | 4 ++-- app/Http/Controllers/Api/MetricController.php | 4 ++-- .../Controllers/Api/MetricPointController.php | 4 ++-- .../Dashboard/ComponentController.php | 8 +++---- .../Dashboard/MetricController.php | 4 ++-- .../Controllers/Dashboard/TeamController.php | 4 ++-- ...est.php => CreateComponentCommandTest.php} | 12 +++++------ ...hp => CreateComponentGroupCommandTest.php} | 12 +++++------ ...ndTest.php => CreateMetricCommandTest.php} | 12 +++++------ ...t.php => CreateMetricPointCommandTest.php} | 12 +++++------ .../Bus/Commands/User/AddUserCommandTest.php | 10 ++++----- .../Component/ComponentWasAddedEventTest.php | 6 +++--- .../ComponentGroupWasAddedEventTest.php | 6 +++--- .../Metric/MetricPointWasAddedEventTest.php | 6 +++--- .../Events/Metric/MetricWasAddedEventTest.php | 6 +++--- .../Bus/Events/User/UserWasAddedEventTest.php | 6 +++--- 34 files changed, 163 insertions(+), 116 deletions(-) rename app/Bus/Commands/Component/{AddComponentCommand.php => CreateComponentCommand.php} (94%) rename app/Bus/Commands/ComponentGroup/{AddComponentGroupCommand.php => CreateComponentGroupCommand.php} (94%) rename app/Bus/Commands/Metric/{AddMetricCommand.php => CreateMetricCommand.php} (94%) rename app/Bus/Commands/Metric/{AddMetricPointCommand.php => CreateMetricPointCommand.php} (86%) rename app/Bus/Commands/User/{AddUserCommand.php => CreateUserCommand.php} (95%) rename app/Bus/Events/Component/{ComponentWasAddedEvent.php => ComponentWasCreatedEvent.php} (87%) rename app/Bus/Events/ComponentGroup/{ComponentGroupWasAddedEvent.php => ComponentGroupWasCreatedEvent.php} (87%) rename app/Bus/Events/Metric/{MetricPointWasAddedEvent.php => MetricPointWasCreatedEvent.php} (87%) rename app/Bus/Events/Metric/{MetricWasAddedEvent.php => MetricWasCreatedEvent.php} (87%) rename app/Bus/Events/User/{UserWasAddedEvent.php => UserWasCreatedEvent.php} (85%) rename app/Bus/Handlers/Commands/Component/{AddComponentCommandHandler.php => CreateComponentCommandHandler.php} (70%) rename app/Bus/Handlers/Commands/ComponentGroup/{AddComponentGroupCommandHandler.php => CreateComponentGroupCommandHandler.php} (65%) rename app/Bus/Handlers/Commands/Metric/{AddMetricCommandHandler.php => CreateMetricCommandHandler.php} (80%) rename app/Bus/Handlers/Commands/Metric/{AddMetricPointCommandHandler.php => CreateMetricPointCommandHandler.php} (80%) rename app/Bus/Handlers/Commands/User/{AddUserCommandHandler.php => CreateUserCommandHandler.php} (66%) rename tests/Bus/Commands/Component/{AddComponentCommandTest.php => CreateComponentCommandTest.php} (78%) rename tests/Bus/Commands/ComponentGroup/{AddComponentGroupCommandTest.php => CreateComponentGroupCommandTest.php} (73%) rename tests/Bus/Commands/Metric/{AddMetricCommandTest.php => CreateMetricCommandTest.php} (82%) rename tests/Bus/Commands/Metric/{AddMetricPointCommandTest.php => CreateMetricPointCommandTest.php} (66%) diff --git a/app/Bus/Commands/Component/AddComponentCommand.php b/app/Bus/Commands/Component/CreateComponentCommand.php similarity index 94% rename from app/Bus/Commands/Component/AddComponentCommand.php rename to app/Bus/Commands/Component/CreateComponentCommand.php index 1332fe4a657a..d2305fa989e5 100644 --- a/app/Bus/Commands/Component/AddComponentCommand.php +++ b/app/Bus/Commands/Component/CreateComponentCommand.php @@ -11,7 +11,12 @@ namespace CachetHQ\Cachet\Bus\Commands\Component; -final class AddComponentCommand +/** + * This is the create component command class. + * + * @author James Brooks + */ +final class CreateComponentCommand { /** * The component name. diff --git a/app/Bus/Commands/ComponentGroup/AddComponentGroupCommand.php b/app/Bus/Commands/ComponentGroup/CreateComponentGroupCommand.php similarity index 94% rename from app/Bus/Commands/ComponentGroup/AddComponentGroupCommand.php rename to app/Bus/Commands/ComponentGroup/CreateComponentGroupCommand.php index 2a959221afdc..7bec1b5d666c 100644 --- a/app/Bus/Commands/ComponentGroup/AddComponentGroupCommand.php +++ b/app/Bus/Commands/ComponentGroup/CreateComponentGroupCommand.php @@ -12,11 +12,11 @@ namespace CachetHQ\Cachet\Bus\Commands\ComponentGroup; /** - * This is the add component group command. + * This is the create component group command. * * @author James Brooks */ -final class AddComponentGroupCommand +final class CreateComponentGroupCommand { /** * The component group name. diff --git a/app/Bus/Commands/Metric/AddMetricCommand.php b/app/Bus/Commands/Metric/CreateMetricCommand.php similarity index 94% rename from app/Bus/Commands/Metric/AddMetricCommand.php rename to app/Bus/Commands/Metric/CreateMetricCommand.php index 39000e82e603..dc1ed90d6155 100644 --- a/app/Bus/Commands/Metric/AddMetricCommand.php +++ b/app/Bus/Commands/Metric/CreateMetricCommand.php @@ -11,7 +11,13 @@ namespace CachetHQ\Cachet\Bus\Commands\Metric; -final class AddMetricCommand +/** + * This is the create metric command class. + * + * @author Joseph Cohen + * @author James Brooks + */ +final class CreateMetricCommand { /** * The metric name. diff --git a/app/Bus/Commands/Metric/AddMetricPointCommand.php b/app/Bus/Commands/Metric/CreateMetricPointCommand.php similarity index 86% rename from app/Bus/Commands/Metric/AddMetricPointCommand.php rename to app/Bus/Commands/Metric/CreateMetricPointCommand.php index 74c50b3db08b..a6b7e0a19ffa 100644 --- a/app/Bus/Commands/Metric/AddMetricPointCommand.php +++ b/app/Bus/Commands/Metric/CreateMetricPointCommand.php @@ -13,7 +13,13 @@ use CachetHQ\Cachet\Models\Metric; -final class AddMetricPointCommand +/** + * This is the create metric point command class. + * + * @author Joseph Cohen + * @author James Brooks + */ +final class CreateMetricPointCommand { /** * The metric to add. diff --git a/app/Bus/Commands/User/AddUserCommand.php b/app/Bus/Commands/User/CreateUserCommand.php similarity index 95% rename from app/Bus/Commands/User/AddUserCommand.php rename to app/Bus/Commands/User/CreateUserCommand.php index ef9ecdd69eee..fad590d3baf4 100644 --- a/app/Bus/Commands/User/AddUserCommand.php +++ b/app/Bus/Commands/User/CreateUserCommand.php @@ -12,11 +12,11 @@ namespace CachetHQ\Cachet\Bus\Commands\User; /** - * This is the add user command. + * This is the create user command. * * @author James Brooks */ -final class AddUserCommand +final class CreateUserCommand { /** * The user username. diff --git a/app/Bus/Events/Component/ComponentWasAddedEvent.php b/app/Bus/Events/Component/ComponentWasCreatedEvent.php similarity index 87% rename from app/Bus/Events/Component/ComponentWasAddedEvent.php rename to app/Bus/Events/Component/ComponentWasCreatedEvent.php index c33f369a7825..29b00da5950d 100644 --- a/app/Bus/Events/Component/ComponentWasAddedEvent.php +++ b/app/Bus/Events/Component/ComponentWasCreatedEvent.php @@ -15,7 +15,12 @@ use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\User; -final class ComponentWasAddedEvent implements ActionInterface, ComponentEventInterface +/** + * This is the component was created event class. + * + * @author James Brooks + */ +final class ComponentWasCreatedEvent implements ActionInterface, ComponentEventInterface { /** * The user who added the component. diff --git a/app/Bus/Events/ComponentGroup/ComponentGroupWasAddedEvent.php b/app/Bus/Events/ComponentGroup/ComponentGroupWasCreatedEvent.php similarity index 87% rename from app/Bus/Events/ComponentGroup/ComponentGroupWasAddedEvent.php rename to app/Bus/Events/ComponentGroup/ComponentGroupWasCreatedEvent.php index a41501b55556..97ad605786e2 100644 --- a/app/Bus/Events/ComponentGroup/ComponentGroupWasAddedEvent.php +++ b/app/Bus/Events/ComponentGroup/ComponentGroupWasCreatedEvent.php @@ -15,7 +15,12 @@ use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\User; -final class ComponentGroupWasAddedEvent implements ActionInterface, ComponentGroupEventInterface +/** + * This is the component group was created event class. + * + * @author James Brooks + */ +final class ComponentGroupWasCreatedEvent implements ActionInterface, ComponentGroupEventInterface { /** * The user who added the component group. diff --git a/app/Bus/Events/Metric/MetricPointWasAddedEvent.php b/app/Bus/Events/Metric/MetricPointWasCreatedEvent.php similarity index 87% rename from app/Bus/Events/Metric/MetricPointWasAddedEvent.php rename to app/Bus/Events/Metric/MetricPointWasCreatedEvent.php index 02a57ae081c7..7137b8c119ce 100644 --- a/app/Bus/Events/Metric/MetricPointWasAddedEvent.php +++ b/app/Bus/Events/Metric/MetricPointWasCreatedEvent.php @@ -15,7 +15,12 @@ use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Models\User; -final class MetricPointWasAddedEvent implements ActionInterface, MetricEventInterface +/** + * This is the metric point was created event class. + * + * @author James Brooks + */ +final class MetricPointWasCreatedEvent implements ActionInterface, MetricEventInterface { /** * The user who added the metric point. diff --git a/app/Bus/Events/Metric/MetricWasAddedEvent.php b/app/Bus/Events/Metric/MetricWasCreatedEvent.php similarity index 87% rename from app/Bus/Events/Metric/MetricWasAddedEvent.php rename to app/Bus/Events/Metric/MetricWasCreatedEvent.php index 9ed5c4200e24..f3e123b8e5c2 100644 --- a/app/Bus/Events/Metric/MetricWasAddedEvent.php +++ b/app/Bus/Events/Metric/MetricWasCreatedEvent.php @@ -15,7 +15,12 @@ use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\User; -final class MetricWasAddedEvent implements ActionInterface, MetricEventInterface +/** + * This is the metric was created event class. + * + * @author James Brooks + */ +final class MetricWasCreatedEvent implements ActionInterface, MetricEventInterface { /** * The user who added the metric. diff --git a/app/Bus/Events/User/UserWasAddedEvent.php b/app/Bus/Events/User/UserWasCreatedEvent.php similarity index 85% rename from app/Bus/Events/User/UserWasAddedEvent.php rename to app/Bus/Events/User/UserWasCreatedEvent.php index fb9d218e4a3b..1dd02484ece5 100644 --- a/app/Bus/Events/User/UserWasAddedEvent.php +++ b/app/Bus/Events/User/UserWasCreatedEvent.php @@ -14,7 +14,12 @@ use CachetHQ\Cachet\Bus\Events\ActionInterface; use CachetHQ\Cachet\Models\User; -final class UserWasAddedEvent implements ActionInterface, UserEventInterface +/** + * This is the user was created event class. + * + * @author James Brooks + */ +final class UserWasCreatedEvent implements ActionInterface, UserEventInterface { /** * The user that has been added. diff --git a/app/Bus/Handlers/Commands/Component/AddComponentCommandHandler.php b/app/Bus/Handlers/Commands/Component/CreateComponentCommandHandler.php similarity index 70% rename from app/Bus/Handlers/Commands/Component/AddComponentCommandHandler.php rename to app/Bus/Handlers/Commands/Component/CreateComponentCommandHandler.php index fd22f323b514..7cc941e0eb41 100644 --- a/app/Bus/Handlers/Commands/Component/AddComponentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Component/CreateComponentCommandHandler.php @@ -11,12 +11,17 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\Component; -use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; -use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent; +use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand; +use CachetHQ\Cachet\Bus\Events\Component\ComponentWasCreatedEvent; use CachetHQ\Cachet\Models\Component; use Illuminate\Contracts\Auth\Guard; -class AddComponentCommandHandler +/** + * This is the add component command handler class. + * + * @author James Brooks + */ +class CreateComponentCommandHandler { /** * The authentication guard instance. @@ -40,15 +45,15 @@ public function __construct(Guard $auth) /** * Handle the add component command. * - * @param \CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand $command * * @return \CachetHQ\Cachet\Models\Component */ - public function handle(AddComponentCommand $command) + public function handle(CreateComponentCommand $command) { $component = Component::create($this->filter($command)); - event(new ComponentWasAddedEvent($this->auth->user(), $component)); + event(new ComponentWasCreatedEvent($this->auth->user(), $component)); return $component; } @@ -56,11 +61,11 @@ public function handle(AddComponentCommand $command) /** * Filter the command data. * - * @param \CachetHQ\Cachet\Bus\Commands\Incident\AddComponentCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\Incident\CreateComponentCommand $command * * @return array */ - protected function filter(AddComponentCommand $command) + protected function filter(CreateComponentCommand $command) { $params = [ 'name' => $command->name, diff --git a/app/Bus/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php b/app/Bus/Handlers/Commands/ComponentGroup/CreateComponentGroupCommandHandler.php similarity index 65% rename from app/Bus/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php rename to app/Bus/Handlers/Commands/ComponentGroup/CreateComponentGroupCommandHandler.php index 9715f4a987b5..2169025baab7 100644 --- a/app/Bus/Handlers/Commands/ComponentGroup/AddComponentGroupCommandHandler.php +++ b/app/Bus/Handlers/Commands/ComponentGroup/CreateComponentGroupCommandHandler.php @@ -11,12 +11,12 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup; -use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; -use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent; +use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand; +use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasCreatedEvent; use CachetHQ\Cachet\Models\ComponentGroup; use Illuminate\Contracts\Auth\Guard; -class AddComponentGroupCommandHandler +class CreateComponentGroupCommandHandler { /** * The authentication guard instance. @@ -26,7 +26,7 @@ class AddComponentGroupCommandHandler protected $auth; /** - * Create a new add component group command handler instance. + * Create a new create component group command handler instance. * * @param \Illuminate\Contracts\Auth\Guard $auth * @@ -38,13 +38,13 @@ public function __construct(Guard $auth) } /** - * Handle the add component group command. + * Handle the create component group command. * - * @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand $command * * @return \CachetHQ\Cachet\Models\ComponentGroup */ - public function handle(AddComponentGroupCommand $command) + public function handle(CreateComponentGroupCommand $command) { $group = ComponentGroup::create([ 'name' => $command->name, @@ -53,7 +53,7 @@ public function handle(AddComponentGroupCommand $command) 'visible' => $command->visible, ]); - event(new ComponentGroupWasAddedEvent($this->auth->user(), $group)); + event(new ComponentGroupWasCreatedEvent($this->auth->user(), $group)); return $group; } diff --git a/app/Bus/Handlers/Commands/Metric/AddMetricCommandHandler.php b/app/Bus/Handlers/Commands/Metric/CreateMetricCommandHandler.php similarity index 80% rename from app/Bus/Handlers/Commands/Metric/AddMetricCommandHandler.php rename to app/Bus/Handlers/Commands/Metric/CreateMetricCommandHandler.php index 1f0744395fbb..cc410ce0b242 100644 --- a/app/Bus/Handlers/Commands/Metric/AddMetricCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/CreateMetricCommandHandler.php @@ -11,12 +11,12 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\Metric; -use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; -use CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent; +use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand; +use CachetHQ\Cachet\Bus\Events\Metric\MetricWasCreatedEvent; use CachetHQ\Cachet\Models\Metric; use Illuminate\Contracts\Auth\Guard; -class AddMetricCommandHandler +class CreateMetricCommandHandler { /** * The authentication guard instance. @@ -40,11 +40,11 @@ public function __construct(Guard $auth) /** * Handle the add metric command. * - * @param \CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand $command * * @return \CachetHQ\Cachet\Models\Metric */ - public function handle(AddMetricCommand $command) + public function handle(CreateMetricCommand $command) { $metric = Metric::create([ 'name' => $command->name, @@ -60,7 +60,7 @@ public function handle(AddMetricCommand $command) 'visible' => $command->visible, ]); - event(new MetricWasAddedEvent($this->auth->user(), $metric)); + event(new MetricWasCreatedEvent($this->auth->user(), $metric)); return $metric; } diff --git a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/CreateMetricPointCommandHandler.php similarity index 80% rename from app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php rename to app/Bus/Handlers/Commands/Metric/CreateMetricPointCommandHandler.php index 5be8acb1616b..4e065de715fe 100644 --- a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/CreateMetricPointCommandHandler.php @@ -11,14 +11,14 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\Metric; -use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand; -use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent; +use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand; +use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasCreatedEvent; use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Services\Dates\DateFactory; use Carbon\Carbon; use Illuminate\Contracts\Auth\Guard; -class AddMetricPointCommandHandler +class CreateMetricPointCommandHandler { /** * The authentication guard instance. @@ -51,11 +51,11 @@ public function __construct(Guard $auth, DateFactory $dates) /** * Handle the add metric point command. * - * @param \CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand $command * * @return \CachetHQ\Cachet\Models\MetricPoint */ - public function handle(AddMetricPointCommand $command) + public function handle(CreateMetricPointCommand $command) { $metric = $command->metric; $createdAt = $command->created_at; @@ -65,7 +65,7 @@ public function handle(AddMetricPointCommand $command) $point->increment('counter', 1); - event(new MetricPointWasAddedEvent($this->auth->user(), $point)); + event(new MetricPointWasCreatedEvent($this->auth->user(), $point)); return $point; } @@ -73,11 +73,11 @@ public function handle(AddMetricPointCommand $command) /** * Find or create a metric point. * - * @param \CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand $command * * @return \CachetHQ\Cachet\Models\MetricPoint */ - protected function findOrCreatePoint(AddMetricPointCommand $command) + protected function findOrCreatePoint(CreateMetricPointCommand $command) { $buffer = Carbon::now()->subMinutes($command->metric->threshold); diff --git a/app/Bus/Handlers/Commands/User/AddUserCommandHandler.php b/app/Bus/Handlers/Commands/User/CreateUserCommandHandler.php similarity index 66% rename from app/Bus/Handlers/Commands/User/AddUserCommandHandler.php rename to app/Bus/Handlers/Commands/User/CreateUserCommandHandler.php index 856e33bbb0d7..9ae22e67b846 100644 --- a/app/Bus/Handlers/Commands/User/AddUserCommandHandler.php +++ b/app/Bus/Handlers/Commands/User/CreateUserCommandHandler.php @@ -11,25 +11,25 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\User; -use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand; -use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent; +use CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand; +use CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent; use CachetHQ\Cachet\Models\User; /** - * This is the add user command handler. + * This is the create user command handler. * * @author James Brooks */ -class AddUserCommandHandler +class CreateUserCommandHandler { /** * Handle the add user command. * - * @param \CachetHQ\Cachet\Bus\Commands\User\AddUserCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand $command * * @return \CachetHQ\Cachet\Models\User */ - public function handle(AddUserCommand $command) + public function handle(CreateUserCommand $command) { $user = User::create([ 'username' => $command->username, @@ -38,7 +38,7 @@ public function handle(AddUserCommand $command) 'level' => $command->level, ]); - event(new UserWasAddedEvent($user)); + event(new UserWasCreatedEvent($user)); return $user; } diff --git a/app/Bus/Handlers/Commands/User/SignupUserCommandHandler.php b/app/Bus/Handlers/Commands/User/SignupUserCommandHandler.php index 740b8a4c0eab..bb274a2faac0 100644 --- a/app/Bus/Handlers/Commands/User/SignupUserCommandHandler.php +++ b/app/Bus/Handlers/Commands/User/SignupUserCommandHandler.php @@ -12,7 +12,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\User; use CachetHQ\Cachet\Bus\Commands\User\SignupUserCommand; -use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent; +use CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent; use CachetHQ\Cachet\Models\User; class SignupUserCommandHandler @@ -33,7 +33,7 @@ public function handle(SignupUserCommand $command) 'level' => User::LEVEL_USER, ]); - event(new UserWasAddedEvent($user)); + event(new UserWasCreatedEvent($user)); return $user; } diff --git a/app/Foundation/Providers/EventServiceProvider.php b/app/Foundation/Providers/EventServiceProvider.php index fed96eec54b9..ac289226b8b6 100644 --- a/app/Foundation/Providers/EventServiceProvider.php +++ b/app/Foundation/Providers/EventServiceProvider.php @@ -30,7 +30,7 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\Beacon\BeaconWasSentEvent' => [ // ], - 'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent' => [ + 'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasCreatedEvent' => [ // ], 'CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasRemovedEvent' => [ @@ -42,7 +42,7 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent' => [ 'CachetHQ\Cachet\Bus\Handlers\Events\Component\SendComponentUpdateEmailNotificationHandler', ], - 'CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent' => [ + 'CachetHQ\Cachet\Bus\Events\Component\ComponentWasCreatedEvent' => [ // ], 'CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent' => [ @@ -75,7 +75,7 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\Invite\InviteWasClaimedEvent' => [ // ], - 'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent' => [ + 'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasCreatedEvent' => [ // ], 'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasRemovedEvent' => [ @@ -84,7 +84,7 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasUpdatedEvent' => [ // ], - 'CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent' => [ + 'CachetHQ\Cachet\Bus\Events\Metric\MetricWasCreatedEvent' => [ // ], 'CachetHQ\Cachet\Bus\Events\Metric\MetricWasRemovedEvent' => [ @@ -150,7 +150,7 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\User\UserRegeneratedApiTokenEvent' => [ // ], - 'CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent' => [ + 'CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent' => [ // ], 'CachetHQ\Cachet\Bus\Events\User\UserWasInvitedEvent' => [ diff --git a/app/Http/Controllers/Api/ComponentController.php b/app/Http/Controllers/Api/ComponentController.php index cfb917304922..de811f3bccc8 100644 --- a/app/Http/Controllers/Api/ComponentController.php +++ b/app/Http/Controllers/Api/ComponentController.php @@ -11,7 +11,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Api; -use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; +use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand; use CachetHQ\Cachet\Models\Component; @@ -70,7 +70,7 @@ public function getComponent(Component $component) public function postComponents() { try { - $component = dispatch(new AddComponentCommand( + $component = dispatch(new CreateComponentCommand( Binput::get('name'), Binput::get('description'), Binput::get('status'), diff --git a/app/Http/Controllers/Api/ComponentGroupController.php b/app/Http/Controllers/Api/ComponentGroupController.php index 796eab696bb9..38f54767738c 100644 --- a/app/Http/Controllers/Api/ComponentGroupController.php +++ b/app/Http/Controllers/Api/ComponentGroupController.php @@ -11,7 +11,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Api; -use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; +use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand; use CachetHQ\Cachet\Models\ComponentGroup; @@ -92,7 +92,7 @@ public function getGroup(ComponentGroup $group) public function postGroups() { try { - $group = dispatch(new AddComponentGroupCommand( + $group = dispatch(new CreateComponentGroupCommand( Binput::get('name'), Binput::get('order', 0), Binput::get('collapsed', 0), diff --git a/app/Http/Controllers/Api/MetricController.php b/app/Http/Controllers/Api/MetricController.php index ddb11f002703..39d6fc2018cd 100644 --- a/app/Http/Controllers/Api/MetricController.php +++ b/app/Http/Controllers/Api/MetricController.php @@ -11,7 +11,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Api; -use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; +use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand; use CachetHQ\Cachet\Models\Metric; @@ -76,7 +76,7 @@ public function getMetricPoints(Metric $metric) public function postMetrics() { try { - $metric = dispatch(new AddMetricCommand( + $metric = dispatch(new CreateMetricCommand( Binput::get('name'), Binput::get('suffix'), Binput::get('description'), diff --git a/app/Http/Controllers/Api/MetricPointController.php b/app/Http/Controllers/Api/MetricPointController.php index a84758d93349..09ddff66ed81 100644 --- a/app/Http/Controllers/Api/MetricPointController.php +++ b/app/Http/Controllers/Api/MetricPointController.php @@ -11,7 +11,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Api; -use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand; +use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand; use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricPointCommand; use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricPointCommand; use CachetHQ\Cachet\Models\Metric; @@ -45,7 +45,7 @@ public function getMetricPoints(Metric $metric, MetricPoint $metricPoint) public function postMetricPoints(Metric $metric) { try { - $metricPoint = dispatch(new AddMetricPointCommand( + $metricPoint = dispatch(new CreateMetricPointCommand( $metric, Binput::get('value'), Binput::get('timestamp') diff --git a/app/Http/Controllers/Dashboard/ComponentController.php b/app/Http/Controllers/Dashboard/ComponentController.php index 4aefe335cdb3..dd991db1a2d1 100644 --- a/app/Http/Controllers/Dashboard/ComponentController.php +++ b/app/Http/Controllers/Dashboard/ComponentController.php @@ -12,10 +12,10 @@ namespace CachetHQ\Cachet\Http\Controllers\Dashboard; use AltThree\Validator\ValidationException; -use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; +use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand; use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand; -use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; +use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand; use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand; use CachetHQ\Cachet\Models\Component; @@ -182,7 +182,7 @@ public function createComponentAction() $tags = array_pull($componentData, 'tags'); try { - $component = dispatch(new AddComponentCommand( + $component = dispatch(new CreateComponentCommand( $componentData['name'], $componentData['description'], $componentData['status'], @@ -276,7 +276,7 @@ public function showEditComponentGroup(ComponentGroup $group) public function postAddComponentGroup() { try { - $group = dispatch(new AddComponentGroupCommand( + $group = dispatch(new CreateComponentGroupCommand( Binput::get('name'), Binput::get('order', 0), Binput::get('collapsed'), diff --git a/app/Http/Controllers/Dashboard/MetricController.php b/app/Http/Controllers/Dashboard/MetricController.php index dd3da8f77fd7..d87fb436d9e5 100644 --- a/app/Http/Controllers/Dashboard/MetricController.php +++ b/app/Http/Controllers/Dashboard/MetricController.php @@ -12,7 +12,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Dashboard; use AltThree\Validator\ValidationException; -use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; +use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand; use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand; use CachetHQ\Cachet\Models\Metric; @@ -70,7 +70,7 @@ public function createMetricAction() $metricData = Binput::get('metric'); try { - dispatch(new AddMetricCommand( + dispatch(new CreateMetricCommand( $metricData['name'], $metricData['suffix'], $metricData['description'], diff --git a/app/Http/Controllers/Dashboard/TeamController.php b/app/Http/Controllers/Dashboard/TeamController.php index 152f097107ec..6e0d112b305a 100644 --- a/app/Http/Controllers/Dashboard/TeamController.php +++ b/app/Http/Controllers/Dashboard/TeamController.php @@ -12,7 +12,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Dashboard; use AltThree\Validator\ValidationException; -use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand; +use CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand; use CachetHQ\Cachet\Bus\Commands\User\InviteUserCommand; use CachetHQ\Cachet\Bus\Commands\User\RemoveUserCommand; use CachetHQ\Cachet\Models\User; @@ -80,7 +80,7 @@ public function showInviteTeamMemberView() public function postAddUser() { try { - dispatch(new AddUserCommand( + dispatch(new CreateUserCommand( Binput::get('username'), Binput::get('password'), Binput::get('email'), diff --git a/tests/Bus/Commands/Component/AddComponentCommandTest.php b/tests/Bus/Commands/Component/CreateComponentCommandTest.php similarity index 78% rename from tests/Bus/Commands/Component/AddComponentCommandTest.php rename to tests/Bus/Commands/Component/CreateComponentCommandTest.php index 851b96885115..454beeb52c90 100644 --- a/tests/Bus/Commands/Component/AddComponentCommandTest.php +++ b/tests/Bus/Commands/Component/CreateComponentCommandTest.php @@ -12,17 +12,17 @@ namespace CachetHQ\Tests\Cachet\Bus\Commands\Component; use AltThree\TestBench\CommandTrait; -use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand; -use CachetHQ\Cachet\Bus\Handlers\Commands\Component\AddComponentCommandHandler; +use CachetHQ\Cachet\Bus\Commands\Component\CreateComponentCommand; +use CachetHQ\Cachet\Bus\Handlers\Commands\Component\CreateComponentCommandHandler; use CachetHQ\Tests\Cachet\AbstractTestCase; /** - * This is the add component command test class. + * This is the create component command test class. * * @author James Brooks * @author Graham Campbell */ -class AddComponentCommandTest extends AbstractTestCase +class CreateComponentCommandTest extends AbstractTestCase { use CommandTrait; @@ -38,7 +38,7 @@ protected function getObjectAndParams() 'enabled' => true, 'meta' => null, ]; - $object = new AddComponentCommand( + $object = new CreateComponentCommand( $params['name'], $params['description'], $params['status'], @@ -59,6 +59,6 @@ protected function objectHasRules() protected function getHandlerClass() { - return AddComponentCommandHandler::class; + return CreateComponentCommandHandler::class; } } diff --git a/tests/Bus/Commands/ComponentGroup/AddComponentGroupCommandTest.php b/tests/Bus/Commands/ComponentGroup/CreateComponentGroupCommandTest.php similarity index 73% rename from tests/Bus/Commands/ComponentGroup/AddComponentGroupCommandTest.php rename to tests/Bus/Commands/ComponentGroup/CreateComponentGroupCommandTest.php index 7bf7bcdb44cb..5a4560954446 100644 --- a/tests/Bus/Commands/ComponentGroup/AddComponentGroupCommandTest.php +++ b/tests/Bus/Commands/ComponentGroup/CreateComponentGroupCommandTest.php @@ -12,18 +12,18 @@ namespace CachetHQ\Tests\Cachet\Bus\Commands\ComponentGroup; use AltThree\TestBench\CommandTrait; -use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand; -use CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup\AddComponentGroupCommandHandler; +use CachetHQ\Cachet\Bus\Commands\ComponentGroup\CreateComponentGroupCommand; +use CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup\CreateComponentGroupCommandHandler; use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Tests\Cachet\AbstractTestCase; /** - * This is the add component group command test class. + * This is the create component group command test class. * * @author James Brooks * @author Graham Campbell */ -class AddComponentGroupCommandTest extends AbstractTestCase +class CreateComponentGroupCommandTest extends AbstractTestCase { use CommandTrait; @@ -36,7 +36,7 @@ protected function getObjectAndParams() 'visible' => ComponentGroup::VISIBLE_AUTHENTICATED, ]; - $object = new AddComponentGroupCommand( + $object = new CreateComponentGroupCommand( $params['name'], $params['order'], $params['collapsed'], @@ -53,6 +53,6 @@ protected function objectHasRules() protected function getHandlerClass() { - return AddComponentGroupCommandHandler::class; + return CreateComponentGroupCommandHandler::class; } } diff --git a/tests/Bus/Commands/Metric/AddMetricCommandTest.php b/tests/Bus/Commands/Metric/CreateMetricCommandTest.php similarity index 82% rename from tests/Bus/Commands/Metric/AddMetricCommandTest.php rename to tests/Bus/Commands/Metric/CreateMetricCommandTest.php index 881ba08d4bbe..7595f54bcce0 100644 --- a/tests/Bus/Commands/Metric/AddMetricCommandTest.php +++ b/tests/Bus/Commands/Metric/CreateMetricCommandTest.php @@ -12,17 +12,17 @@ namespace CachetHQ\Tests\Cachet\Bus\Commands\Metric; use AltThree\TestBench\CommandTrait; -use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand; -use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\AddMetricCommandHandler; +use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricCommand; +use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\CreateMetricCommandHandler; use CachetHQ\Tests\Cachet\AbstractTestCase; /** - * This is the add metric command test class. + * This is the create metric command test class. * * @author James Brooks * @author Graham Campbell */ -class AddMetricCommandTest extends AbstractTestCase +class CreateMetricCommandTest extends AbstractTestCase { use CommandTrait; @@ -42,7 +42,7 @@ protected function getObjectAndParams() 'visible' => 1, ]; - $object = new AddMetricCommand( + $object = new CreateMetricCommand( $params['name'], $params['suffix'], $params['description'], @@ -66,6 +66,6 @@ protected function objectHasRules() protected function getHandlerClass() { - return AddMetricCommandHandler::class; + return CreateMetricCommandHandler::class; } } diff --git a/tests/Bus/Commands/Metric/AddMetricPointCommandTest.php b/tests/Bus/Commands/Metric/CreateMetricPointCommandTest.php similarity index 66% rename from tests/Bus/Commands/Metric/AddMetricPointCommandTest.php rename to tests/Bus/Commands/Metric/CreateMetricPointCommandTest.php index 77c08e9e183c..c2aa8ba72f0d 100644 --- a/tests/Bus/Commands/Metric/AddMetricPointCommandTest.php +++ b/tests/Bus/Commands/Metric/CreateMetricPointCommandTest.php @@ -12,25 +12,25 @@ namespace CachetHQ\Tests\Cachet\Bus\Commands\Metric; use AltThree\TestBench\CommandTrait; -use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricPointCommand; -use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\AddMetricPointCommandHandler; +use CachetHQ\Cachet\Bus\Commands\Metric\CreateMetricPointCommand; +use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\CreateMetricPointCommandHandler; use CachetHQ\Cachet\Models\Metric; use CachetHQ\Tests\Cachet\AbstractTestCase; /** - * This is the add metric point command test class. + * This is the create metric point command test class. * * @author James Brooks * @author Graham Campbell */ -class AddMetricPointCommandTest extends AbstractTestCase +class CreateMetricPointCommandTest extends AbstractTestCase { use CommandTrait; protected function getObjectAndParams() { $params = ['metric' => new Metric(), 'value' => 1, 'created_at' => '2020-12-30 12:00:00']; - $object = new AddMetricPointCommand($params['metric'], $params['value'], $params['created_at']); + $object = new CreateMetricPointCommand($params['metric'], $params['value'], $params['created_at']); return compact('params', 'object'); } @@ -42,6 +42,6 @@ protected function objectHasRules() protected function getHandlerClass() { - return AddMetricPointCommandHandler::class; + return CreateMetricPointCommandHandler::class; } } diff --git a/tests/Bus/Commands/User/AddUserCommandTest.php b/tests/Bus/Commands/User/AddUserCommandTest.php index 83ee9e7eb917..336394da289a 100644 --- a/tests/Bus/Commands/User/AddUserCommandTest.php +++ b/tests/Bus/Commands/User/AddUserCommandTest.php @@ -12,8 +12,8 @@ namespace CachetHQ\Tests\Cachet\Bus\Commands\User; use AltThree\TestBench\CommandTrait; -use CachetHQ\Cachet\Bus\Commands\User\AddUserCommand; -use CachetHQ\Cachet\Bus\Handlers\Commands\User\AddUserCommandHandler; +use CachetHQ\Cachet\Bus\Commands\User\CreateUserCommand; +use CachetHQ\Cachet\Bus\Handlers\Commands\User\CreateUserCommandHandler; use CachetHQ\Tests\Cachet\AbstractTestCase; /** @@ -22,7 +22,7 @@ * @author James Brooks * @author Graham Campbell */ -class AddUserCommandTest extends AbstractTestCase +class CreateUserCommandTest extends AbstractTestCase { use CommandTrait; @@ -35,7 +35,7 @@ protected function getObjectAndParams() 'level' => 1, ]; - $object = new AddUserCommand( + $object = new CreateUserCommand( $params['username'], $params['password'], $params['email'], @@ -52,6 +52,6 @@ protected function objectHasRules() protected function getHandlerClass() { - return AddUserCommandHandler::class; + return CreateUserCommandHandler::class; } } diff --git a/tests/Bus/Events/Component/ComponentWasAddedEventTest.php b/tests/Bus/Events/Component/ComponentWasAddedEventTest.php index ac9c9857f7b3..532f09c25b0a 100644 --- a/tests/Bus/Events/Component/ComponentWasAddedEventTest.php +++ b/tests/Bus/Events/Component/ComponentWasAddedEventTest.php @@ -11,11 +11,11 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\Component; -use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent; +use CachetHQ\Cachet\Bus\Events\Component\ComponentWasCreatedEvent; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\User; -class ComponentWasAddedEventTest extends AbstractComponentEventTestCase +class ComponentWasCreatedEventTest extends AbstractComponentEventTestCase { protected function objectHasHandlers() { @@ -25,7 +25,7 @@ protected function objectHasHandlers() protected function getObjectAndParams() { $params = ['user' => new User(), 'component' => new Component()]; - $object = new ComponentWasAddedEvent($params['user'], $params['component']); + $object = new ComponentWasCreatedEvent($params['user'], $params['component']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php b/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php index c8a01f89e3ae..a0bedb11ac9d 100644 --- a/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php +++ b/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php @@ -11,11 +11,11 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\ComponentGroup; -use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent; +use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasCreatedEvent; use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\User; -class ComponentGroupWasAddedEventTest extends AbstractComponentGroupEventTestCase +class ComponentGroupWasCreatedEventTest extends AbstractComponentGroupEventTestCase { protected function objectHasHandlers() { @@ -25,7 +25,7 @@ protected function objectHasHandlers() protected function getObjectAndParams() { $params = ['user' => new User(), 'group' => new ComponentGroup()]; - $object = new ComponentGroupWasAddedEvent($params['user'], $params['group']); + $object = new ComponentGroupWasCreatedEvent($params['user'], $params['group']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php b/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php index 770da8da55ac..df7ec505e214 100644 --- a/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php +++ b/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php @@ -11,7 +11,7 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\Metric; -use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent; +use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasCreatedEvent; use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Models\User; @@ -20,7 +20,7 @@ * * @author James Brooks */ -class MetricPointWasAddedEventTest extends AbstractMetricEventTestCase +class MetricPointWasCreatedEventTest extends AbstractMetricEventTestCase { protected function objectHasHandlers() { @@ -30,7 +30,7 @@ protected function objectHasHandlers() protected function getObjectAndParams() { $params = ['user' => new User(), 'metricPoint' => new MetricPoint()]; - $object = new MetricPointWasAddedEvent($params['user'], $params['metricPoint']); + $object = new MetricPointWasCreatedEvent($params['user'], $params['metricPoint']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/Metric/MetricWasAddedEventTest.php b/tests/Bus/Events/Metric/MetricWasAddedEventTest.php index 65b18a74fd20..2f81383f044d 100644 --- a/tests/Bus/Events/Metric/MetricWasAddedEventTest.php +++ b/tests/Bus/Events/Metric/MetricWasAddedEventTest.php @@ -11,11 +11,11 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\Metric; -use CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent; +use CachetHQ\Cachet\Bus\Events\Metric\MetricWasCreatedEvent; use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\User; -class MetricWasAddedEventTest extends AbstractMetricEventTestCase +class MetricWasCreatedEventTest extends AbstractMetricEventTestCase { protected function objectHasHandlers() { @@ -25,7 +25,7 @@ protected function objectHasHandlers() protected function getObjectAndParams() { $params = ['user' => new User(), 'metric' => new Metric()]; - $object = new MetricWasAddedEvent($params['user'], $params['metric']); + $object = new MetricWasCreatedEvent($params['user'], $params['metric']); return compact('params', 'object'); } diff --git a/tests/Bus/Events/User/UserWasAddedEventTest.php b/tests/Bus/Events/User/UserWasAddedEventTest.php index 0a9340cbf622..3c231813dff8 100644 --- a/tests/Bus/Events/User/UserWasAddedEventTest.php +++ b/tests/Bus/Events/User/UserWasAddedEventTest.php @@ -11,7 +11,7 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\User; -use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent; +use CachetHQ\Cachet\Bus\Events\User\UserWasCreatedEvent; use CachetHQ\Cachet\Models\User; /** @@ -19,7 +19,7 @@ * * @author Graham Campbell */ -class UserWasAddedEventTest extends AbstractUserEventTestCase +class UserWasCreatedEventTest extends AbstractUserEventTestCase { protected function objectHasHandlers() { @@ -29,7 +29,7 @@ protected function objectHasHandlers() protected function getObjectAndParams() { $params = ['user' => new User()]; - $object = new UserWasAddedEvent($params['user']); + $object = new UserWasCreatedEvent($params['user']); return compact('params', 'object'); } From 485116b5cede924c4511876e3fe340daba1cb405 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 18 Mar 2017 09:41:33 +0000 Subject: [PATCH 3/4] Rename incident bus --- ...tCommand.php => CreateIncidentCommand.php} | 6 ++--- ...nd.php => CreateIncidentUpdateCommand.php} | 2 +- ...dEvent.php => IncidentWasCreatedEvent.php} | 2 +- ...r.php => CreateIncidentCommandHandler.php} | 22 +++++++++---------- ...=> CreateIncidentUpdateCommandHandler.php} | 8 +++---- .../SendIncidentEmailNotificationHandler.php | 6 ++--- .../Providers/EventServiceProvider.php | 6 ++--- .../Controllers/Api/IncidentController.php | 4 ++-- .../Api/IncidentUpdateController.php | 4 ++-- .../Dashboard/IncidentController.php | 8 +++---- ...Test.php => CreateIncidentCommandTest.php} | 12 +++++----- ...hp => CreateIncidentUpdateCommandTest.php} | 12 +++++----- ...st.php => IncidentWasCreatedEventTest.php} | 8 +++---- 13 files changed, 50 insertions(+), 50 deletions(-) rename app/Bus/Commands/Incident/{ReportIncidentCommand.php => CreateIncidentCommand.php} (96%) rename app/Bus/Commands/IncidentUpdate/{ReportIncidentUpdateCommand.php => CreateIncidentUpdateCommand.php} (97%) rename app/Bus/Events/Incident/{IncidentWasReportedEvent.php => IncidentWasCreatedEvent.php} (94%) rename app/Bus/Handlers/Commands/Incident/{ReportIncidentCommandHandler.php => CreateIncidentCommandHandler.php} (86%) rename app/Bus/Handlers/Commands/IncidentUpdate/{ReportIncidentUpdateCommandHandler.php => CreateIncidentUpdateCommandHandler.php} (87%) rename tests/Bus/Commands/Incident/{ReportIncidentCommandTest.php => CreateIncidentCommandTest.php} (82%) rename tests/Bus/Commands/IncidentUpdate/{ReportIncidentUpdateCommandTest.php => CreateIncidentUpdateCommandTest.php} (73%) rename tests/Bus/Events/Incident/{IncidentWasReportedEventTest.php => IncidentWasCreatedEventTest.php} (70%) diff --git a/app/Bus/Commands/Incident/ReportIncidentCommand.php b/app/Bus/Commands/Incident/CreateIncidentCommand.php similarity index 96% rename from app/Bus/Commands/Incident/ReportIncidentCommand.php rename to app/Bus/Commands/Incident/CreateIncidentCommand.php index 979cc0cdcda1..ae8f5f97a1a6 100644 --- a/app/Bus/Commands/Incident/ReportIncidentCommand.php +++ b/app/Bus/Commands/Incident/CreateIncidentCommand.php @@ -12,12 +12,12 @@ namespace CachetHQ\Cachet\Bus\Commands\Incident; /** - * This is the report incident command. + * This is the create incident command. * * @author Joseph Cohen * @author James Brooks */ -final class ReportIncidentCommand +final class CreateIncidentCommand { /** * The incident name. @@ -115,7 +115,7 @@ final class ReportIncidentCommand ]; /** - * Create a new report incident command instance. + * Create a new create incident command instance. * * @param string $name * @param int $status diff --git a/app/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommand.php b/app/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommand.php similarity index 97% rename from app/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommand.php rename to app/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommand.php index d88e51401127..048465b8f8d0 100644 --- a/app/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommand.php +++ b/app/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommand.php @@ -19,7 +19,7 @@ * * @author James Brooks */ -final class ReportIncidentUpdateCommand +final class CreateIncidentUpdateCommand { /** * The incident. diff --git a/app/Bus/Events/Incident/IncidentWasReportedEvent.php b/app/Bus/Events/Incident/IncidentWasCreatedEvent.php similarity index 94% rename from app/Bus/Events/Incident/IncidentWasReportedEvent.php rename to app/Bus/Events/Incident/IncidentWasCreatedEvent.php index 141fccb7f36f..c43d672b0c66 100644 --- a/app/Bus/Events/Incident/IncidentWasReportedEvent.php +++ b/app/Bus/Events/Incident/IncidentWasCreatedEvent.php @@ -15,7 +15,7 @@ use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\User; -final class IncidentWasReportedEvent implements ActionInterface, IncidentEventInterface +final class IncidentWasCreatedEvent implements ActionInterface, IncidentEventInterface { /** * The user who reported the event. diff --git a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/CreateIncidentCommandHandler.php similarity index 86% rename from app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php rename to app/Bus/Handlers/Commands/Incident/CreateIncidentCommandHandler.php index 85fcd64849e5..d8b36af2b3dc 100644 --- a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/CreateIncidentCommandHandler.php @@ -12,8 +12,8 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\Incident; use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand; -use CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand; -use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent; +use CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand; +use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent; use CachetHQ\Cachet\Bus\Exceptions\Incident\InvalidIncidentTimestampException; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Incident; @@ -25,11 +25,11 @@ use Twig_Loader_Array; /** - * This is the report incident command handler. + * This is the create incident command handler. * * @author James Brooks */ -class ReportIncidentCommandHandler +class CreateIncidentCommandHandler { /** * The authentication guard instance. @@ -46,7 +46,7 @@ class ReportIncidentCommandHandler protected $dates; /** - * Create a new report incident command handler instance. + * Create a new create incident command handler instance. * * @param \Illuminate\Contracts\Auth\Guard $auth * @param \CachetHQ\Cachet\Services\Dates\DateFactory $dates @@ -60,13 +60,13 @@ public function __construct(Guard $auth, DateFactory $dates) } /** - * Handle the report incident command. + * Handle the create incident command. * - * @param \CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand $command * * @return \CachetHQ\Cachet\Models\Incident */ - public function handle(ReportIncidentCommand $command) + public function handle(CreateIncidentCommand $command) { $data = [ 'name' => $command->name, @@ -116,7 +116,7 @@ public function handle(ReportIncidentCommand $command) )); } - event(new IncidentWasReportedEvent($this->auth->user(), $incident, (bool) $command->notify)); + event(new IncidentWasCreatedEvent($this->auth->user(), $incident, (bool) $command->notify)); return $incident; } @@ -125,11 +125,11 @@ public function handle(ReportIncidentCommand $command) * Compiles an incident template into an incident message. * * @param \CachetHQ\Cachet\Models\IncidentTemplate $template - * @param \CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand $command * * @return string */ - protected function parseTemplate(IncidentTemplate $template, ReportIncidentCommand $command) + protected function parseTemplate(IncidentTemplate $template, CreateIncidentCommand $command) { $env = new Twig_Environment(new Twig_Loader_Array([])); $template = $env->createTemplate($template->template); diff --git a/app/Bus/Handlers/Commands/IncidentUpdate/ReportIncidentUpdateCommandHandler.php b/app/Bus/Handlers/Commands/IncidentUpdate/CreateIncidentUpdateCommandHandler.php similarity index 87% rename from app/Bus/Handlers/Commands/IncidentUpdate/ReportIncidentUpdateCommandHandler.php rename to app/Bus/Handlers/Commands/IncidentUpdate/CreateIncidentUpdateCommandHandler.php index fba3c3e53bff..09fe9d9b1047 100644 --- a/app/Bus/Handlers/Commands/IncidentUpdate/ReportIncidentUpdateCommandHandler.php +++ b/app/Bus/Handlers/Commands/IncidentUpdate/CreateIncidentUpdateCommandHandler.php @@ -12,7 +12,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate; use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand; -use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand; +use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\CreateIncidentUpdateCommand; use CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasReportedEvent; use CachetHQ\Cachet\Models\IncidentUpdate; use Illuminate\Contracts\Auth\Guard; @@ -22,7 +22,7 @@ * * @author James Brooks */ -class ReportIncidentUpdateCommandHandler +class CreateIncidentUpdateCommandHandler { /** * The authentication guard instance. @@ -46,11 +46,11 @@ public function __construct(Guard $auth) /** * Handle the report incident command. * - * @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand $command + * @param \CachetHQ\Cachet\Bus\Commands\IncidentUpdate\CreateIncidentUpdateCommand $command * * @return \CachetHQ\Cachet\Models\IncidentUpdate */ - public function handle(ReportIncidentUpdateCommand $command) + public function handle(CreateIncidentUpdateCommand $command) { $data = [ 'incident_id' => $command->incident->id, diff --git a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php index 82bddcda71e0..b85b8fc865ef 100644 --- a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php @@ -11,7 +11,7 @@ namespace CachetHQ\Cachet\Bus\Handlers\Events\Incident; -use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent; +use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent; use CachetHQ\Cachet\Models\Subscriber; use CachetHQ\Cachet\Notifications\Incident\NewIncidentNotification; @@ -39,11 +39,11 @@ public function __construct(Subscriber $subscriber) /** * Handle the event. * - * @param \CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent $event + * @param \CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent $event * * @return void */ - public function handle(IncidentWasReportedEvent $event) + public function handle(IncidentWasCreatedEvent $event) { $incident = $event->incident; diff --git a/app/Foundation/Providers/EventServiceProvider.php b/app/Foundation/Providers/EventServiceProvider.php index ac289226b8b6..2543300b0f6f 100644 --- a/app/Foundation/Providers/EventServiceProvider.php +++ b/app/Foundation/Providers/EventServiceProvider.php @@ -60,12 +60,12 @@ class EventServiceProvider extends ServiceProvider 'CachetHQ\Cachet\Bus\Events\IncidentUpdate\IncidentUpdateWasUpdatedEvent' => [ // ], + 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent' => [ + 'CachetHQ\Cachet\Bus\Handlers\Events\Incident\SendIncidentEmailNotificationHandler', + ], 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent' => [ // ], - 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent' => [ - 'CachetHQ\Cachet\Bus\Handlers\Events\Incident\SendIncidentEmailNotificationHandler', - ], 'CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent' => [ // ], diff --git a/app/Http/Controllers/Api/IncidentController.php b/app/Http/Controllers/Api/IncidentController.php index 1c6226f92e1e..98b66cc2ffb5 100644 --- a/app/Http/Controllers/Api/IncidentController.php +++ b/app/Http/Controllers/Api/IncidentController.php @@ -11,8 +11,8 @@ namespace CachetHQ\Cachet\Http\Controllers\Api; +use CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand; use CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand; -use CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand; use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand; use CachetHQ\Cachet\Models\Incident; use GrahamCampbell\Binput\Facades\Binput; @@ -67,7 +67,7 @@ public function getIncident(Incident $incident) public function postIncidents() { try { - $incident = dispatch(new ReportIncidentCommand( + $incident = dispatch(new CreateIncidentCommand( Binput::get('name'), Binput::get('status'), Binput::get('message', null, false, false), diff --git a/app/Http/Controllers/Api/IncidentUpdateController.php b/app/Http/Controllers/Api/IncidentUpdateController.php index 84a01d7ab5d4..73faf3794696 100644 --- a/app/Http/Controllers/Api/IncidentUpdateController.php +++ b/app/Http/Controllers/Api/IncidentUpdateController.php @@ -11,8 +11,8 @@ namespace CachetHQ\Cachet\Http\Controllers\Api; +use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\CreateIncidentUpdateCommand; use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\RemoveIncidentUpdateCommand; -use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand; use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand; use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\IncidentUpdate; @@ -74,7 +74,7 @@ public function getIncidentUpdate(Incident $incident, IncidentUpdate $update) public function postIncidentUpdate(Incident $incident) { try { - $update = dispatch(new ReportIncidentUpdateCommand( + $update = dispatch(new CreateIncidentUpdateCommand( $incident, Binput::get('status'), Binput::get('message'), diff --git a/app/Http/Controllers/Dashboard/IncidentController.php b/app/Http/Controllers/Dashboard/IncidentController.php index 376f8a357859..c1aa9a05f5f2 100644 --- a/app/Http/Controllers/Dashboard/IncidentController.php +++ b/app/Http/Controllers/Dashboard/IncidentController.php @@ -12,10 +12,10 @@ namespace CachetHQ\Cachet\Http\Controllers\Dashboard; use AltThree\Validator\ValidationException; +use CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand; use CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand; -use CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand; use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand; -use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand; +use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\CreateIncidentUpdateCommand; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\Incident; @@ -108,7 +108,7 @@ public function showTemplates() public function createIncidentAction() { try { - $incident = dispatch(new ReportIncidentCommand( + $incident = dispatch(new CreateIncidentCommand( Binput::get('name'), Binput::get('status'), Binput::get('message', null, false, false), @@ -308,7 +308,7 @@ public function showIncidentUpdateAction(Incident $incident) public function createIncidentUpdateAction(Incident $incident) { try { - $incident = dispatch(new ReportIncidentUpdateCommand( + $incident = dispatch(new CreateIncidentUpdateCommand( $incident, Binput::get('status'), Binput::get('message'), diff --git a/tests/Bus/Commands/Incident/ReportIncidentCommandTest.php b/tests/Bus/Commands/Incident/CreateIncidentCommandTest.php similarity index 82% rename from tests/Bus/Commands/Incident/ReportIncidentCommandTest.php rename to tests/Bus/Commands/Incident/CreateIncidentCommandTest.php index 3c135c078999..e52796c3f536 100644 --- a/tests/Bus/Commands/Incident/ReportIncidentCommandTest.php +++ b/tests/Bus/Commands/Incident/CreateIncidentCommandTest.php @@ -12,17 +12,17 @@ namespace CachetHQ\Tests\Cachet\Bus\Commands\Incident; use AltThree\TestBench\CommandTrait; -use CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand; -use CachetHQ\Cachet\Bus\Handlers\Commands\Incident\ReportIncidentCommandHandler; +use CachetHQ\Cachet\Bus\Commands\Incident\CreateIncidentCommand; +use CachetHQ\Cachet\Bus\Handlers\Commands\Incident\CreateIncidentCommandHandler; use CachetHQ\Tests\Cachet\AbstractTestCase; /** - * This is the add incident command test class. + * This is the create incident command test class. * * @author James Brooks * @author Graham Campbell */ -class ReportIncidentCommandTest extends AbstractTestCase +class CreateIncidentCommandTest extends AbstractTestCase { use CommandTrait; @@ -42,7 +42,7 @@ protected function getObjectAndParams() 'template_vars' => [], ]; - $object = new ReportIncidentCommand( + $object = new CreateIncidentCommand( $params['name'], $params['status'], $params['message'], @@ -66,6 +66,6 @@ protected function objectHasRules() protected function getHandlerClass() { - return ReportIncidentCommandHandler::class; + return CreateIncidentCommandHandler::class; } } diff --git a/tests/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommandTest.php b/tests/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommandTest.php similarity index 73% rename from tests/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommandTest.php rename to tests/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommandTest.php index 3a81fd188aa6..ef715e113548 100644 --- a/tests/Bus/Commands/IncidentUpdate/ReportIncidentUpdateCommandTest.php +++ b/tests/Bus/Commands/IncidentUpdate/CreateIncidentUpdateCommandTest.php @@ -12,18 +12,18 @@ namespace CachetHQ\Tests\Cachet\Bus\Commands\IncidentUpdate; use AltThree\TestBench\CommandTrait; -use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\ReportIncidentUpdateCommand; -use CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate\ReportIncidentUpdateCommandHandler; +use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\CreateIncidentUpdateCommand; +use CachetHQ\Cachet\Bus\Handlers\Commands\IncidentUpdate\CreateIncidentUpdateCommandHandler; use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\User; use CachetHQ\Tests\Cachet\AbstractTestCase; /** - * This is the report incident update command test class. + * This is the create incident update command test class. * * @author James Brooks */ -class ReportIncidentUpdateCommandTest extends AbstractTestCase +class CreateIncidentUpdateCommandTest extends AbstractTestCase { use CommandTrait; @@ -35,7 +35,7 @@ protected function getObjectAndParams() 'message' => 'Foo', 'user' => new User(), ]; - $object = new ReportIncidentUpdateCommand($params['incident'], $params['status'], $params['message'], $params['user']); + $object = new CreateIncidentUpdateCommand($params['incident'], $params['status'], $params['message'], $params['user']); return compact('params', 'object'); } @@ -47,6 +47,6 @@ protected function objectHasRules() protected function getHandlerClass() { - return ReportIncidentUpdateCommandHandler::class; + return CreateIncidentUpdateCommandHandler::class; } } diff --git a/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php b/tests/Bus/Events/Incident/IncidentWasCreatedEventTest.php similarity index 70% rename from tests/Bus/Events/Incident/IncidentWasReportedEventTest.php rename to tests/Bus/Events/Incident/IncidentWasCreatedEventTest.php index cb4445d95a80..5fd7d72027ab 100644 --- a/tests/Bus/Events/Incident/IncidentWasReportedEventTest.php +++ b/tests/Bus/Events/Incident/IncidentWasCreatedEventTest.php @@ -11,16 +11,16 @@ namespace CachetHQ\Tests\Cachet\Bus\Events\Incident; -use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent; +use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasCreatedEvent; use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\User; /** - * This is the incident was reported event test class. + * This is the incident was created event test class. * * @author James Brooks */ -class IncidentWasReportedEventTest extends AbstractIncidentEventTestCase +class IncidentWasCreatedEventTest extends AbstractIncidentEventTestCase { protected function objectHasHandlers() { @@ -34,7 +34,7 @@ protected function getObjectAndParams() 'incident' => new Incident(), 'notify' => true, ]; - $object = new IncidentWasReportedEvent($params['user'], $params['incident'], $params['notify']); + $object = new IncidentWasCreatedEvent($params['user'], $params['incident'], $params['notify']); return compact('params', 'object'); } From c1bd3e40fa237d5df8c0020085e4fb4b290ae2ad Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sat, 18 Mar 2017 09:49:33 +0000 Subject: [PATCH 4/4] Fix some tests --- app/Bus/Events/User/UserWasCreatedEvent.php | 2 +- app/Bus/Events/User/UserWasInvitedEvent.php | 2 +- .../User/{AddUserCommandTest.php => CreateUserCommandTest.php} | 2 +- ...tWasAddedEventTest.php => ComponentWasCreatedEventTest.php} | 0 ...ddedEventTest.php => ComponentGroupWasCreatedEventTest.php} | 0 ...asAddedEventTest.php => MetricPointWasCreatedEventTest.php} | 2 +- ...tricWasAddedEventTest.php => MetricWasCreatedEventTest.php} | 0 .../{UserWasAddedEventTest.php => UserWasCreatedEventTest.php} | 3 ++- 8 files changed, 6 insertions(+), 5 deletions(-) rename tests/Bus/Commands/User/{AddUserCommandTest.php => CreateUserCommandTest.php} (96%) rename tests/Bus/Events/Component/{ComponentWasAddedEventTest.php => ComponentWasCreatedEventTest.php} (100%) rename tests/Bus/Events/ComponentGroup/{ComponentGroupWasAddedEventTest.php => ComponentGroupWasCreatedEventTest.php} (100%) rename tests/Bus/Events/Metric/{MetricPointWasAddedEventTest.php => MetricPointWasCreatedEventTest.php} (93%) rename tests/Bus/Events/Metric/{MetricWasAddedEventTest.php => MetricWasCreatedEventTest.php} (100%) rename tests/Bus/Events/User/{UserWasAddedEventTest.php => UserWasCreatedEventTest.php} (88%) diff --git a/app/Bus/Events/User/UserWasCreatedEvent.php b/app/Bus/Events/User/UserWasCreatedEvent.php index 1dd02484ece5..a013352a583b 100644 --- a/app/Bus/Events/User/UserWasCreatedEvent.php +++ b/app/Bus/Events/User/UserWasCreatedEvent.php @@ -47,7 +47,7 @@ public function __construct(User $user) */ public function __toString() { - return 'User was added.'; + return 'User was created.'; } /** diff --git a/app/Bus/Events/User/UserWasInvitedEvent.php b/app/Bus/Events/User/UserWasInvitedEvent.php index 1df56261ee54..529efce0a81e 100644 --- a/app/Bus/Events/User/UserWasInvitedEvent.php +++ b/app/Bus/Events/User/UserWasInvitedEvent.php @@ -23,7 +23,7 @@ final class UserWasInvitedEvent implements UserEventInterface { /** - * The invite that has been added. + * The invite that has been created. * * @var \CachetHQ\Cachet\Models\Invite */ diff --git a/tests/Bus/Commands/User/AddUserCommandTest.php b/tests/Bus/Commands/User/CreateUserCommandTest.php similarity index 96% rename from tests/Bus/Commands/User/AddUserCommandTest.php rename to tests/Bus/Commands/User/CreateUserCommandTest.php index 336394da289a..3a4b8be19e60 100644 --- a/tests/Bus/Commands/User/AddUserCommandTest.php +++ b/tests/Bus/Commands/User/CreateUserCommandTest.php @@ -17,7 +17,7 @@ use CachetHQ\Tests\Cachet\AbstractTestCase; /** - * This is the add user command test class. + * This is the create user command test class. * * @author James Brooks * @author Graham Campbell diff --git a/tests/Bus/Events/Component/ComponentWasAddedEventTest.php b/tests/Bus/Events/Component/ComponentWasCreatedEventTest.php similarity index 100% rename from tests/Bus/Events/Component/ComponentWasAddedEventTest.php rename to tests/Bus/Events/Component/ComponentWasCreatedEventTest.php diff --git a/tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php b/tests/Bus/Events/ComponentGroup/ComponentGroupWasCreatedEventTest.php similarity index 100% rename from tests/Bus/Events/ComponentGroup/ComponentGroupWasAddedEventTest.php rename to tests/Bus/Events/ComponentGroup/ComponentGroupWasCreatedEventTest.php diff --git a/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php b/tests/Bus/Events/Metric/MetricPointWasCreatedEventTest.php similarity index 93% rename from tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php rename to tests/Bus/Events/Metric/MetricPointWasCreatedEventTest.php index df7ec505e214..4c903e0ce13c 100644 --- a/tests/Bus/Events/Metric/MetricPointWasAddedEventTest.php +++ b/tests/Bus/Events/Metric/MetricPointWasCreatedEventTest.php @@ -16,7 +16,7 @@ use CachetHQ\Cachet\Models\User; /** - * This is the metric point was added event test class. + * This is the metric point was created event test class. * * @author James Brooks */ diff --git a/tests/Bus/Events/Metric/MetricWasAddedEventTest.php b/tests/Bus/Events/Metric/MetricWasCreatedEventTest.php similarity index 100% rename from tests/Bus/Events/Metric/MetricWasAddedEventTest.php rename to tests/Bus/Events/Metric/MetricWasCreatedEventTest.php diff --git a/tests/Bus/Events/User/UserWasAddedEventTest.php b/tests/Bus/Events/User/UserWasCreatedEventTest.php similarity index 88% rename from tests/Bus/Events/User/UserWasAddedEventTest.php rename to tests/Bus/Events/User/UserWasCreatedEventTest.php index 3c231813dff8..574567d26a45 100644 --- a/tests/Bus/Events/User/UserWasAddedEventTest.php +++ b/tests/Bus/Events/User/UserWasCreatedEventTest.php @@ -15,9 +15,10 @@ use CachetHQ\Cachet\Models\User; /** - * This is the user was added event test class. + * This is the user was created event test class. * * @author Graham Campbell + * @author James Brooks */ class UserWasCreatedEventTest extends AbstractUserEventTestCase {