Moved things into a bus namespace

This commit is contained in:
Graham Campbell
2016-01-05 02:38:07 +00:00
parent 1d399b27ba
commit df5eb24efd
148 changed files with 362 additions and 362 deletions
@@ -0,0 +1,62 @@
<?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\Bus\Commands\Component;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Component\AddComponentCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Component\AddComponentCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the add component command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class AddComponentCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = [
'name' => 'Test',
'description' => 'Foo',
'status' => 1,
'link' => 'https://cachethq.io',
'order' => 0,
'group_id' => 0,
'enabled' => true,
];
$object = new AddComponentCommand(
$params['name'],
$params['description'],
$params['status'],
$params['link'],
$params['order'],
$params['group_id'],
$params['enabled']
);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return AddComponentCommandHandler::class;
}
}
@@ -0,0 +1,42 @@
<?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\Bus\Commands\Component;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Component\RemoveComponentCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Component\RemoveComponentCommandHandler;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the remove component command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class RemoveComponentCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['component' => new Component()];
$object = new RemoveComponentCommand($params['component']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return RemoveComponentCommandHandler::class;
}
}
@@ -0,0 +1,66 @@
<?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\Bus\Commands\Component;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Component\UpdateComponentCommandHandler;
use CachetHQ\Cachet\Models\Component;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the update component command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class UpdateComponentCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = [
'component' => new Component(),
'name' => 'Test',
'description' => 'Foo',
'status' => 1,
'link' => 'https://cachethq.io',
'order' => 0,
'group_id' => 0,
'enabled' => true,
];
$object = new UpdateComponentCommand(
$params['component'],
$params['name'],
$params['description'],
$params['status'],
$params['link'],
$params['order'],
$params['group_id'],
$params['enabled']
);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return UpdateComponentCommandHandler::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\Bus\Commands\ComponentGroup;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\AddComponentGroupCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup\AddComponentGroupCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the add component group command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class AddComponentGroupCommandTest extends AbstractTestCase
{
use CommandTrait;
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,42 @@
<?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\Bus\Commands\ComponentGroup;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\RemoveComponentGroupCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup\RemoveComponentGroupCommandHandler;
use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the remove component group command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class RemoveComponentGroupCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['group' => new ComponentGroup()];
$object = new RemoveComponentGroupCommand($params['group']);
return compact('params', 'object');
}
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\Bus\Commands\ComponentGroup;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\ComponentGroup\UpdateComponentGroupCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\ComponentGroup\UpdateComponentGroupCommandHandler;
use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the update component group command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class UpdateComponentGroupCommandTest extends AbstractTestCase
{
use CommandTrait;
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,42 @@
<?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\Bus\Commands\Incident;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Incident\RemoveIncidentCommandHandler;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the remove incident command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class RemoveIncidentCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['incident' => new Incident()];
$object = new RemoveIncidentCommand($params['incident']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return RemoveIncidentCommandHandler::class;
}
}
@@ -0,0 +1,69 @@
<?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\Bus\Commands\Incident;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Incident\ReportIncidentCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Incident\ReportIncidentCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the add incident command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class ReportIncidentCommandTest extends AbstractTestCase
{
use CommandTrait;
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,
'template' => null,
'template_vars' => null,
];
$object = new ReportIncidentCommand(
$params['name'],
$params['status'],
$params['message'],
$params['visible'],
$params['component_id'],
$params['component_status'],
$params['notify'],
$params['incident_date'],
$params['template'],
$params['template_vars']
);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return ReportIncidentCommandHandler::class;
}
}
@@ -0,0 +1,57 @@
<?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\Bus\Commands\Incident;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Incident\ReportMaintenanceCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Incident\ReportMaintenanceCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the add incident command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class ReportMaintenanceCommandTest extends AbstractTestCase
{
use CommandTrait;
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,72 @@
<?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\Bus\Commands\Incident;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Incident\UpdateIncidentCommandHandler;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the update incident command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class UpdateIncidentCommandTest extends AbstractTestCase
{
use CommandTrait;
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,
'template' => null,
'template_vars' => 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'],
$params['template'],
$params['template_vars']
);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return UpdateIncidentCommandHandler::class;
}
}
@@ -0,0 +1,41 @@
<?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\Bus\Commands\Invite;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Invite\ClaimInviteCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Invite\ClaimInviteCommandHandler;
use CachetHQ\Cachet\Models\Invite;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the claim invite command test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class ClaimInviteCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['invite' => new Invite()];
$object = new ClaimInviteCommand($params['invite']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return ClaimInviteCommandHandler::class;
}
}
@@ -0,0 +1,65 @@
<?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\Bus\Commands\Metric;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Metric\AddMetricCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\AddMetricCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the add metric command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class AddMetricCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = [
'name' => 'Coffee',
'suffix' => 'cups',
'description' => 'Cups of coffee consumed',
'default_value' => 0,
'calc_type' => 0,
'display_chart' => 1,
'places' => 0,
'default_view' => 0,
];
$object = new AddMetricCommand(
$params['name'],
$params['suffix'],
$params['description'],
$params['default_value'],
$params['calc_type'],
$params['display_chart'],
$params['places'],
$params['default_view']
);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return AddMetricCommandHandler::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\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\Models\Metric;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the add metric point command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class AddMetricPointCommandTest 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']);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return AddMetricPointCommandHandler::class;
}
}
@@ -0,0 +1,42 @@
<?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\Bus\Commands\Metric;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\RemoveMetricCommandHandler;
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the remove metric command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class RemoveMetricCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['metric' => new Metric()];
$object = new RemoveMetricCommand($params['metric']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return RemoveMetricCommandHandler::class;
}
}
@@ -0,0 +1,42 @@
<?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\Bus\Commands\Metric;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Metric\RemoveMetricPointCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\RemoveMetricPointCommandHandler;
use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the remove metric point command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class RemoveMetricPointCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['metricPoint' => new MetricPoint()];
$object = new RemoveMetricPointCommand($params['metricPoint']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return RemoveMetricPointCommandHandler::class;
}
}
@@ -0,0 +1,68 @@
<?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\Bus\Commands\Metric;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\UpdateMetricCommandHandler;
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the update metric command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class UpdateMetricCommandTest extends AbstractTestCase
{
use CommandTrait;
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,
'default_view' => 0,
];
$object = new UpdateMetricCommand(
$params['metric'],
$params['name'],
$params['suffix'],
$params['description'],
$params['default_value'],
$params['calc_type'],
$params['display_chart'],
$params['places'],
$params['default_view']
);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return UpdateMetricCommandHandler::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\Bus\Commands\Metric;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricPointCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Metric\UpdateMetricPointCommandHandler;
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the update metric point command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class UpdateMetricPointCommandTest extends AbstractTestCase
{
use CommandTrait;
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,46 @@
<?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\Bus\Commands\Subscriber;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Subscriber\SubscribeSubscriberCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Subscriber\SubscribeSubscriberCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the subscribe subscriber command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class SubscribeSubscriberCommandTest extends AbstractTestCase
{
use CommandTrait;
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,42 @@
<?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\Bus\Commands\Subscriber;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Subscriber\UnsubscribeSubscriberCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Subscriber\UnsubscribeSubscriberCommandHandler;
use CachetHQ\Cachet\Models\Subscriber;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the unsubscribe subscriber command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class UnsubscribeSubscriberCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['subscriber' => new Subscriber()];
$object = new UnsubscribeSubscriberCommand($params['subscriber']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return UnsubscribeSubscriberCommandHandler::class;
}
}
@@ -0,0 +1,42 @@
<?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\Bus\Commands\Subscriber;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\Subscriber\VerifySubscriberCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\Subscriber\VerifySubscriberCommandHandler;
use CachetHQ\Cachet\Models\Subscriber;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the verify subscriber command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class VerifySubscriberCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['subscriber' => new Subscriber()];
$object = new VerifySubscriberCommand($params['subscriber']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return VerifySubscriberCommandHandler::class;
}
}
@@ -0,0 +1,57 @@
<?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\Bus\Commands\User;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\User\AddTeamMemberCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\User\AddTeamMemberCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the add team member command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class AddTeamMemberCommandTest extends AbstractTestCase
{
use CommandTrait;
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,42 @@
<?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\Bus\Commands\User;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\User\GenerateApiTokenCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\User\GenerateApiTokenCommandHandler;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the generate api token command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class GenerateApiTokenCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['user' => new User()];
$object = new GenerateApiTokenCommand($params['user']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return GenerateApiTokenCommandHandler::class;
}
}
@@ -0,0 +1,45 @@
<?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\Bus\Commands\User;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\User\InviteTeamMemberCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\User\InviteTeamMemberCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the invite team member command test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class InviteTeamMemberCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['emails' => ['foo@example.com']];
$object = new InviteTeamMemberCommand($params['emails']);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return InviteTeamMemberCommandHandler::class;
}
}
@@ -0,0 +1,42 @@
<?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\Bus\Commands\User;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\User\RemoveUserCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\User\RemoveUserCommandHandler;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the remove user command test class.
*
* @author James Brooks <james@alt-three.com>
* @author Graham Campbell <graham@alt-three.com>
*/
class RemoveUserCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = ['user' => new User()];
$object = new RemoveUserCommand($params['user']);
return compact('params', 'object');
}
protected function getHandlerClass()
{
return RemoveUserCommandHandler::class;
}
}
@@ -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\Bus\Commands\User;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Bus\Commands\User\SignupUserCommand;
use CachetHQ\Cachet\Bus\Handlers\Commands\User\SignupUserCommandHandler;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the signup user command test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class SignupUserCommandTest extends AbstractTestCase
{
use CommandTrait;
protected function getObjectAndParams()
{
$params = [
'username' => 'Test',
'password' => 'fooey',
'email' => 'test@test.com',
'level' => 1,
];
$object = new SignupUserCommand(
$params['username'],
$params['password'],
$params['email'],
$params['level']
);
return compact('params', 'object');
}
protected function objectHasRules()
{
return true;
}
protected function getHandlerClass()
{
return SignupUserCommandHandler::class;
}
}
@@ -0,0 +1,26 @@
<?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\Bus\Events\Component;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Bus\Events\Component\ComponentEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractComponentEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [ComponentEventInterface::class];
}
}
@@ -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\Bus\Events\Component;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasAddedEvent;
use CachetHQ\Cachet\Models\Component;
class ComponentWasAddedEventTest extends AbstractComponentEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['component' => new Component()];
$object = new ComponentWasAddedEvent($params['component']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\Component;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasRemovedEvent;
use CachetHQ\Cachet\Models\Component;
class ComponentWasRemovedEventTest extends AbstractComponentEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['component' => new Component()];
$object = new ComponentWasRemovedEvent($params['component']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\Component;
use CachetHQ\Cachet\Bus\Events\Component\ComponentWasUpdatedEvent;
use CachetHQ\Cachet\Models\Component;
class ComponentWasUpdatedEventTest extends AbstractComponentEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['component' => new Component()];
$object = new ComponentWasUpdatedEvent($params['component']);
return compact('params', 'object');
}
}
@@ -0,0 +1,26 @@
<?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\Bus\Events\ComponentGroup;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractComponentGroupEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [ComponentGroupEventInterface::class];
}
}
@@ -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\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasAddedEvent;
use CachetHQ\Cachet\Models\ComponentGroup;
class ComponentGroupWasAddedEventTest extends AbstractComponentGroupEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['group' => new ComponentGroup()];
$object = new ComponentGroupWasAddedEvent($params['group']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasRemovedEvent;
use CachetHQ\Cachet\Models\ComponentGroup;
class ComponentGroupWasRemovedEventTest extends AbstractComponentGroupEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['group' => new ComponentGroup()];
$object = new ComponentGroupWasRemovedEvent($params['group']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\ComponentGroup;
use CachetHQ\Cachet\Bus\Events\ComponentGroup\ComponentGroupWasUpdatedEvent;
use CachetHQ\Cachet\Models\ComponentGroup;
class ComponentGroupWasUpdatedEventTest extends AbstractComponentGroupEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['group' => new ComponentGroup()];
$object = new ComponentGroupWasUpdatedEvent($params['group']);
return compact('params', 'object');
}
}
@@ -0,0 +1,26 @@
<?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\Bus\Events\Incident;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Bus\Events\Incident\IncidentEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractIncidentEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [IncidentEventInterface::class];
}
}
@@ -0,0 +1,26 @@
<?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\Bus\Events\Invite;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Bus\Events\Invite\InviteEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractInviteEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [InviteEventInterface::class];
}
}
@@ -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\Bus\Events\Invite;
use CachetHQ\Cachet\Bus\Events\Invite\InviteWasClaimedEvent;
use CachetHQ\Cachet\Models\Invite;
class InviteWasClaimedEventTest extends AbstractInviteEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['invite' => new Invite()];
$object = new InviteWasClaimedEvent($params['invite']);
return compact('params', 'object');
}
}
@@ -0,0 +1,26 @@
<?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\Bus\Events\Metric;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Bus\Events\Metric\MetricEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractMetricEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [MetricEventInterface::class];
}
}
@@ -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\Bus\Events\Metric;
use CachetHQ\Cachet\Bus\Events\Metric\MetricWasAddedEvent;
use CachetHQ\Cachet\Models\Metric;
class MetricWasAddedEventTest extends AbstractMetricEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['metric' => new Metric()];
$object = new MetricWasAddedEvent($params['metric']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\Metric;
use CachetHQ\Cachet\Bus\Events\Metric\MetricWasRemovedEvent;
use CachetHQ\Cachet\Models\Metric;
class MetricWasRemovedEventTest extends AbstractMetricEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['metric' => new Metric()];
$object = new MetricWasRemovedEvent($params['metric']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\Metric;
use CachetHQ\Cachet\Bus\Events\Metric\MetricWasUpdatedEvent;
use CachetHQ\Cachet\Models\Metric;
class MetricWasUpdatedEventTest extends AbstractMetricEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['metric' => new Metric()];
$object = new MetricWasUpdatedEvent($params['metric']);
return compact('params', 'object');
}
}
@@ -0,0 +1,26 @@
<?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\Bus\Events\Subscriber;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractSubscriberEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [SubscriberEventInterface::class];
}
}
@@ -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\Bus\Events\Subscriber;
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent;
use CachetHQ\Cachet\Models\Subscriber;
class SubscriberHasSubscribedEventTest extends AbstractSubscriberEventTestCase
{
protected function objectHasHandlers()
{
return true;
}
protected function getObjectAndParams()
{
$params = ['subscriber' => new Subscriber()];
$object = new SubscriberHasSubscribedEvent($params['subscriber']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\Subscriber;
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasUnsubscribedEvent;
use CachetHQ\Cachet\Models\Subscriber;
class SubscriberHasUnsubscribedEventTest extends AbstractSubscriberEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['subscriber' => new Subscriber()];
$object = new SubscriberHasUnsubscribedEvent($params['subscriber']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\Subscriber;
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasVerifiedEvent;
use CachetHQ\Cachet\Models\Subscriber;
class SubscriberHasVerifiedEventTest extends AbstractSubscriberEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['subscriber' => new Subscriber()];
$object = new SubscriberHasVerifiedEvent($params['subscriber']);
return compact('params', 'object');
}
}
@@ -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\Bus\Events\User;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Bus\Events\User\UserEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
/**
* This is the abstract user event test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
abstract class AbstractUserEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [UserEventInterface::class];
}
}
@@ -0,0 +1,36 @@
<?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\Bus\Events\User;
use CachetHQ\Cachet\Bus\Events\User\UserWasAddedEvent;
use CachetHQ\Cachet\Models\User;
/**
* This is the user was added event test class.
*
* @author Graham Campbell <graham@alt-three.com>
*/
class UserWasAddedEventTest extends AbstractUserEventTestCase
{
protected function objectHasHandlers()
{
return false;
}
protected function getObjectAndParams()
{
$params = ['user' => new User()];
$object = new UserWasAddedEvent($params['user']);
return compact('params', 'object');
}
}