Started working on event tests

This commit is contained in:
James Brooks
2015-12-25 16:10:38 +00:00
parent f71e9c0cc5
commit 68d5a5c29e
15 changed files with 435 additions and 0 deletions

View File

@@ -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\Events\Component;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Events\Component\ComponentEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractComponentEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [ComponentEventInterface::class];
}
}

View File

@@ -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\Events\Component;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\Component;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\Component;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\ComponentGroup;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Events\ComponentGroup\ComponentGroupEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractComponentGroupEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [ComponentGroupEventInterface::class];
}
}

View File

@@ -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\Events\ComponentGroup;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\ComponentGroup;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\ComponentGroup;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\Incident;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Events\Incident\IncidentEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractIncidentEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [IncidentEventInterface::class];
}
}

View File

@@ -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\Events\Invite;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Events\Invite\InviteEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractInviteEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [InviteEventInterface::class];
}
}

View File

@@ -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\Events\Metric;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Events\Metric\MetricEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractMetricEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [MetricEventInterface::class];
}
}

View File

@@ -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\Events\Metric;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\Metric;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\Metric;
use CachetHQ\Cachet\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');
}
}

View File

@@ -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\Events\Subscriber;
use AltThree\TestBench\EventTrait;
use CachetHQ\Cachet\Events\Subscriber\SubscriberEventInterface;
use CachetHQ\Tests\Cachet\AbstractTestCase;
abstract class AbstractSubscriberEventTestCase extends AbstractTestCase
{
use EventTrait;
protected function getEventInterfaces()
{
return [SubscriberEventInterface::class];
}
}