@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\Component;
|
namespace CachetHQ\Cachet\Commands\Component;
|
||||||
|
|
||||||
class AddComponentCommand
|
final class AddComponentCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The component name.
|
* The component name.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Component;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Component;
|
use CachetHQ\Cachet\Models\Component;
|
||||||
|
|
||||||
class RemoveComponentCommand
|
final class RemoveComponentCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The component to remove.
|
* The component to remove.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Component;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Component;
|
use CachetHQ\Cachet\Models\Component;
|
||||||
|
|
||||||
class UpdateComponentCommand
|
final class UpdateComponentCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The component to update.
|
* The component to update.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\ComponentGroup;
|
namespace CachetHQ\Cachet\Commands\ComponentGroup;
|
||||||
|
|
||||||
class AddComponentGroupCommand
|
final class AddComponentGroupCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The component group name.
|
* The component group name.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\ComponentGroup;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||||
|
|
||||||
class RemoveComponentGroupCommand
|
final class RemoveComponentGroupCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The component group to remove.
|
* The component group to remove.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\ComponentGroup;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\ComponentGroup;
|
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||||
|
|
||||||
class UpdateComponentGroupCommand
|
final class UpdateComponentGroupCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The component group.
|
* The component group.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Incident;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Incident;
|
use CachetHQ\Cachet\Models\Incident;
|
||||||
|
|
||||||
class RemoveIncidentCommand
|
final class RemoveIncidentCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The incident to remove.
|
* The incident to remove.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\Incident;
|
namespace CachetHQ\Cachet\Commands\Incident;
|
||||||
|
|
||||||
class ReportIncidentCommand
|
final class ReportIncidentCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The incident name.
|
* The incident name.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\Incident;
|
namespace CachetHQ\Cachet\Commands\Incident;
|
||||||
|
|
||||||
class ReportMaintenanceCommand
|
final class ReportMaintenanceCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The maintenance name.
|
* The maintenance name.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Incident;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Incident;
|
use CachetHQ\Cachet\Models\Incident;
|
||||||
|
|
||||||
class UpdateIncidentCommand
|
final class UpdateIncidentCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The incident to update.
|
* The incident to update.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\Metric;
|
namespace CachetHQ\Cachet\Commands\Metric;
|
||||||
|
|
||||||
class AddMetricCommand
|
final class AddMetricCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The metric name.
|
* The metric name.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Metric;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Metric;
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
|
|
||||||
class AddMetricPointCommand
|
final class AddMetricPointCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The metric to add.
|
* The metric to add.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Metric;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Metric;
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
|
|
||||||
class RemoveMetricCommand
|
final class RemoveMetricCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The metric to remove.
|
* The metric to remove.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Metric;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\MetricPoint;
|
use CachetHQ\Cachet\Models\MetricPoint;
|
||||||
|
|
||||||
class RemoveMetricPointCommand
|
final class RemoveMetricPointCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The metric point to remove.
|
* The metric point to remove.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\Metric;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Metric;
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
|
|
||||||
class UpdateMetricCommand
|
final class UpdateMetricCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The metric.
|
* The metric.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace CachetHQ\Cachet\Commands\Metric;
|
|||||||
use CachetHQ\Cachet\Models\Metric;
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
use CachetHQ\Cachet\Models\MetricPoint;
|
use CachetHQ\Cachet\Models\MetricPoint;
|
||||||
|
|
||||||
class UpdateMetricPointCommand
|
final class UpdateMetricPointCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The metric point.
|
* The metric point.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\Subscriber;
|
namespace CachetHQ\Cachet\Commands\Subscriber;
|
||||||
|
|
||||||
class SubscribeSubscriberCommand
|
final class SubscribeSubscriberCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The subscriber email.
|
* The subscriber email.
|
||||||
@@ -23,7 +23,7 @@ class SubscribeSubscriberCommand
|
|||||||
/**
|
/**
|
||||||
* The subscriber auto verification.
|
* The subscriber auto verification.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $verified;
|
public $verified;
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ namespace CachetHQ\Cachet\Commands\Subscriber;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Subscriber;
|
use CachetHQ\Cachet\Models\Subscriber;
|
||||||
|
|
||||||
class UnsubscribeSubscriberCommand
|
final class UnsubscribeSubscriberCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The subscriber to unsubscribe.
|
* The subscriber to unsubscribe.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var \CachetHQ\Cachet\Models\Subscriber
|
||||||
*/
|
*/
|
||||||
public $subscriber;
|
public $subscriber;
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ namespace CachetHQ\Cachet\Commands\Subscriber;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\Subscriber;
|
use CachetHQ\Cachet\Models\Subscriber;
|
||||||
|
|
||||||
class VerifySubscriberCommand
|
final class VerifySubscriberCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The subscriber to verify.
|
* The subscriber to verify.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var \CachetHQ\Cachet\Models\Subscriber
|
||||||
*/
|
*/
|
||||||
public $subscriber;
|
public $subscriber;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\User;
|
namespace CachetHQ\Cachet\Commands\User;
|
||||||
|
|
||||||
class AddTeamMemberCommand
|
final class AddTeamMemberCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The user username.
|
* The user username.
|
||||||
@@ -41,6 +41,17 @@ class AddTeamMemberCommand
|
|||||||
*/
|
*/
|
||||||
public $level;
|
public $level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The validation rules.
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public $rules = [
|
||||||
|
'name' => 'required|string',
|
||||||
|
'password' => 'string',
|
||||||
|
'level' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new add team member command instance.
|
* Create a new add team member command instance.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace CachetHQ\Cachet\Commands\User;
|
namespace CachetHQ\Cachet\Commands\User;
|
||||||
|
|
||||||
class GenerateApiTokenCommand
|
final class GenerateApiTokenCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The user to generate the token.
|
* The user to generate the token.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace CachetHQ\Cachet\Commands\User;
|
|||||||
|
|
||||||
use CachetHQ\Cachet\Models\User;
|
use CachetHQ\Cachet\Models\User;
|
||||||
|
|
||||||
class RemoveUserCommand
|
final class RemoveUserCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The user to remove.
|
* The user to remove.
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands;
|
||||||
|
|
||||||
|
use CachetHQ\Tests\Cachet\AbstractAnemicTestCase;
|
||||||
|
use Illuminate\Contracts\Bus\Dispatcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the abstract command test case class.
|
||||||
|
*
|
||||||
|
* @author Graham Campbell <graham@alt-three.com>
|
||||||
|
*/
|
||||||
|
abstract class AbstractCommandTestCase extends AbstractAnemicTestCase
|
||||||
|
{
|
||||||
|
public function testHandlerCanBeResolved()
|
||||||
|
{
|
||||||
|
$command = $this->getObjectAndParams()['object'];
|
||||||
|
$dispatcher = $this->app->make(Dispatcher::class);
|
||||||
|
|
||||||
|
$this->assertInstanceOf($this->getHandlerClass(), $dispatcher->resolveHandler($command));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Component;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Component\AddComponentCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Component\AddComponentCommandHandler;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the add component command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class AddComponentCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'name' => 'Test',
|
||||||
|
'description' => 'Foo',
|
||||||
|
'status' => 1,
|
||||||
|
'link' => 'https://cachethq.io',
|
||||||
|
'order' => 0,
|
||||||
|
'group_id' => 0,
|
||||||
|
];
|
||||||
|
$object = new AddComponentCommand(
|
||||||
|
$params['name'],
|
||||||
|
$params['description'],
|
||||||
|
$params['status'],
|
||||||
|
$params['link'],
|
||||||
|
$params['order'],
|
||||||
|
$params['group_id']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return AddComponentCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Component;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Component\RemoveComponentCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Component\RemoveComponentCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Component;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the remove component command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class RemoveComponentCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['component' => new Component()];
|
||||||
|
$object = new RemoveComponentCommand($params['component']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return RemoveComponentCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Component;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Component\UpdateComponentCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Component\UpdateComponentCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Component;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the update component command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class UpdateComponentCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'component' => new Component(),
|
||||||
|
'name' => 'Test',
|
||||||
|
'description' => 'Foo',
|
||||||
|
'status' => 1,
|
||||||
|
'link' => 'https://cachethq.io',
|
||||||
|
'order' => 0,
|
||||||
|
'group_id' => 0,
|
||||||
|
];
|
||||||
|
$object = new UpdateComponentCommand(
|
||||||
|
$params['component'],
|
||||||
|
$params['name'],
|
||||||
|
$params['description'],
|
||||||
|
$params['status'],
|
||||||
|
$params['link'],
|
||||||
|
$params['order'],
|
||||||
|
$params['group_id']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return UpdateComponentCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\ComponentGroup;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\ComponentGroup\AddComponentGroupCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\ComponentGroup\AddComponentGroupCommandHandler;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the add component group command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class AddComponentGroupCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'name' => 'Test',
|
||||||
|
'order' => 0,
|
||||||
|
];
|
||||||
|
$object = new AddComponentGroupCommand(
|
||||||
|
$params['name'],
|
||||||
|
$params['order']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return AddComponentGroupCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\ComponentGroup;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\ComponentGroup\RemoveComponentGroupCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\ComponentGroup\RemoveComponentGroupCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the remove component group command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class RemoveComponentGroupCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['group' => new ComponentGroup()];
|
||||||
|
$object = new RemoveComponentGroupCommand($params['group']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return RemoveComponentGroupCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\ComponentGroup;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\ComponentGroup\UpdateComponentGroupCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\ComponentGroup\UpdateComponentGroupCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\ComponentGroup;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the update component group command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class UpdateComponentGroupCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'group' => new ComponentGroup(),
|
||||||
|
'name' => 'Foo',
|
||||||
|
'order' => 1,
|
||||||
|
];
|
||||||
|
$object = new UpdateComponentGroupCommand($params['group'], $params['name'], $params['order']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return UpdateComponentGroupCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Incident;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Incident\RemoveIncidentCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Incident\RemoveIncidentCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Incident;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the remove incident command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class RemoveIncidentCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['incident' => new Incident()];
|
||||||
|
$object = new RemoveIncidentCommand($params['incident']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return RemoveIncidentCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Incident;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Incident\ReportIncidentCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Incident\ReportIncidentCommandHandler;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the add incident command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class ReportIncidentCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'name' => 'Test',
|
||||||
|
'status' => 1,
|
||||||
|
'message' => 'Foo bar baz',
|
||||||
|
'visible' => 1,
|
||||||
|
'component_id' => 1,
|
||||||
|
'component_status' => 1,
|
||||||
|
'notify' => false,
|
||||||
|
'incident_date' => null,
|
||||||
|
];
|
||||||
|
$object = new ReportIncidentCommand(
|
||||||
|
$params['name'],
|
||||||
|
$params['status'],
|
||||||
|
$params['message'],
|
||||||
|
$params['visible'],
|
||||||
|
$params['component_id'],
|
||||||
|
$params['component_status'],
|
||||||
|
$params['notify'],
|
||||||
|
$params['incident_date']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return ReportIncidentCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Incident;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Incident\ReportMaintenanceCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Incident\ReportMaintenanceCommandHandler;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the add incident command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class ReportMaintenanceCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'name' => 'Test',
|
||||||
|
'message' => 'Foo bar baz',
|
||||||
|
'notify' => false,
|
||||||
|
'timestamp' => '2020-12-30 00:00:01',
|
||||||
|
];
|
||||||
|
$object = new ReportMaintenanceCommand(
|
||||||
|
$params['name'],
|
||||||
|
$params['message'],
|
||||||
|
$params['notify'],
|
||||||
|
$params['timestamp']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return ReportMaintenanceCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Incident;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Incident\UpdateIncidentCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Incident\UpdateIncidentCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Incident;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the update incident command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class UpdateIncidentCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'incident' => new Incident(),
|
||||||
|
'name' => 'Test',
|
||||||
|
'status' => 1,
|
||||||
|
'message' => 'Foo bar baz',
|
||||||
|
'visible' => 1,
|
||||||
|
'component_id' => 1,
|
||||||
|
'component_status' => 1,
|
||||||
|
'notify' => false,
|
||||||
|
'incident_date' => null,
|
||||||
|
];
|
||||||
|
$object = new UpdateIncidentCommand(
|
||||||
|
$params['incident'],
|
||||||
|
$params['name'],
|
||||||
|
$params['status'],
|
||||||
|
$params['message'],
|
||||||
|
$params['visible'],
|
||||||
|
$params['component_id'],
|
||||||
|
$params['component_status'],
|
||||||
|
$params['notify'],
|
||||||
|
$params['incident_date']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return UpdateIncidentCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Metric;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Metric\AddMetricCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Metric\AddMetricCommandHandler;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the add metric command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class AddMetricCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'name' => 'Coffee',
|
||||||
|
'suffix' => 'cups',
|
||||||
|
'description' => 'Cups of coffee consumed',
|
||||||
|
'default_value' => 0,
|
||||||
|
'calc_type' => 0,
|
||||||
|
'display_chart' => 1,
|
||||||
|
'places' => 0,
|
||||||
|
];
|
||||||
|
$object = new AddMetricCommand(
|
||||||
|
$params['name'],
|
||||||
|
$params['suffix'],
|
||||||
|
$params['description'],
|
||||||
|
$params['default_value'],
|
||||||
|
$params['calc_type'],
|
||||||
|
$params['display_chart'],
|
||||||
|
$params['places']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return AddMetricCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Metric;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Metric\AddMetricPointCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Metric\AddMetricPointCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the add metric point command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class AddMetricPointCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
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']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return AddMetricPointCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Metric;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Metric\RemoveMetricCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Metric\RemoveMetricCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the remove metric command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class RemoveMetricCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['metric' => new Metric()];
|
||||||
|
$object = new RemoveMetricCommand($params['metric']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return RemoveMetricCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Metric;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Metric\RemoveMetricPointCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Metric\RemoveMetricPointCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\MetricPoint;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the remove metric point command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class RemoveMetricPointCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['metricPoint' => new MetricPoint()];
|
||||||
|
$object = new RemoveMetricPointCommand($params['metricPoint']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return RemoveMetricPointCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Metric;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Metric\UpdateMetricCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Metric\UpdateMetricCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the update metric command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class UpdateMetricCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'metric' => new Metric(),
|
||||||
|
'name' => 'Coffee',
|
||||||
|
'suffix' => 'cups',
|
||||||
|
'description' => 'Cups of coffee consumed',
|
||||||
|
'default_value' => 0,
|
||||||
|
'calc_type' => 0,
|
||||||
|
'display_chart' => 1,
|
||||||
|
'places' => 0,
|
||||||
|
];
|
||||||
|
$object = new UpdateMetricCommand(
|
||||||
|
$params['metric'],
|
||||||
|
$params['name'],
|
||||||
|
$params['suffix'],
|
||||||
|
$params['description'],
|
||||||
|
$params['default_value'],
|
||||||
|
$params['calc_type'],
|
||||||
|
$params['display_chart'],
|
||||||
|
$params['places']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return UpdateMetricCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Metric;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Metric\UpdateMetricPointCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Metric\UpdateMetricPointCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Metric;
|
||||||
|
use CachetHQ\Cachet\Models\MetricPoint;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the update metric point command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class UpdateMetricPointCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'point' => new MetricPoint(),
|
||||||
|
'metric' => new Metric(),
|
||||||
|
'value' => 1,
|
||||||
|
'created_at' => '2012-12-30 12:00:00',
|
||||||
|
];
|
||||||
|
$object = new UpdateMetricPointCommand(
|
||||||
|
$params['point'],
|
||||||
|
$params['metric'],
|
||||||
|
$params['value'],
|
||||||
|
$params['created_at']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return UpdateMetricPointCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Subscriber;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Subscriber\SubscribeSubscriberCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Subscriber\SubscribeSubscriberCommandHandler;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the subscribe subscriber command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class SubscribeSubscriberCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'email' => 'support@cachethq.io',
|
||||||
|
'verified' => true,
|
||||||
|
];
|
||||||
|
$object = new SubscribeSubscriberCommand(
|
||||||
|
$params['email'],
|
||||||
|
$params['verified']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return SubscribeSubscriberCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Subscriber;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Subscriber\UnsubscribeSubscriberCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Subscriber\UnsubscribeSubscriberCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Subscriber;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the unsubscribe subscriber command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class UnsubscribeSubscriberCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['subscriber' => new Subscriber()];
|
||||||
|
$object = new UnsubscribeSubscriberCommand($params['subscriber']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return UnsubscribeSubscriberCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\Subscriber;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\Subscriber\VerifySubscriberCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\Subscriber\VerifySubscriberCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\Subscriber;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the verify subscriber command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class VerifySubscriberCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['subscriber' => new Subscriber()];
|
||||||
|
$object = new VerifySubscriberCommand($params['subscriber']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return VerifySubscriberCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\User;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\User\AddTeamMemberCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\User\AddTeamMemberCommandHandler;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the add team member command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class AddTeamMemberCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'username' => 'Test',
|
||||||
|
'password' => 'fooey',
|
||||||
|
'email' => 'test@test.com',
|
||||||
|
'level' => 1,
|
||||||
|
];
|
||||||
|
$object = new AddTeamMemberCommand(
|
||||||
|
$params['username'],
|
||||||
|
$params['password'],
|
||||||
|
$params['email'],
|
||||||
|
$params['level']
|
||||||
|
);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return AddTeamMemberCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\User;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\User\GenerateApiTokenCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\User\GenerateApiTokenCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\User;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the generate api token command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class GenerateApiTokenCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['user' => new User()];
|
||||||
|
$object = new GenerateApiTokenCommand($params['user']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return GenerateApiTokenCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Tests\Cachet\Commands\User;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Commands\User\RemoveUserCommand;
|
||||||
|
use CachetHQ\Cachet\Handlers\Commands\User\RemoveUserCommandHandler;
|
||||||
|
use CachetHQ\Cachet\Models\User;
|
||||||
|
use CachetHQ\Tests\Cachet\Commands\AbstractCommandTestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the remove user command test class.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
*/
|
||||||
|
class RemoveUserCommandTest extends AbstractCommandTestCase
|
||||||
|
{
|
||||||
|
protected function getObjectAndParams()
|
||||||
|
{
|
||||||
|
$params = ['user' => new User()];
|
||||||
|
$object = new RemoveUserCommand($params['user']);
|
||||||
|
|
||||||
|
return compact('params', 'object');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function objectHasRules()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getHandlerClass()
|
||||||
|
{
|
||||||
|
return RemoveUserCommandHandler::class;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user