-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2004 from CachetHQ/existence
Improved the bus test coverage
- Loading branch information
Showing
13 changed files
with
431 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?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; | ||
|
||
use AltThree\TestBench\ExistenceTrait; | ||
use PHPUnit_Framework_TestCase as TestCase; | ||
|
||
/** | ||
* This is the command existence test class. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
*/ | ||
class CommandExistenceTest extends TestCase | ||
{ | ||
use ExistenceTrait; | ||
|
||
protected function getSourcePath() | ||
{ | ||
return realpath(__DIR__.'/../../../app/Bus/Commands'); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/Bus/Commands/Subscriber/UpdateSubscriberSubscriptionCommandTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Subscriber; | ||
|
||
use AltThree\TestBench\CommandTrait; | ||
use CachetHQ\Cachet\Bus\Commands\Subscriber\UpdateSubscriberSubscriptionCommand; | ||
use CachetHQ\Cachet\Bus\Handlers\Commands\Subscriber\UpdateSubscriberSubscriptionCommandHandler; | ||
use CachetHQ\Cachet\Models\Subscriber; | ||
use CachetHQ\Tests\Cachet\AbstractTestCase; | ||
|
||
/** | ||
* This is the update subscriber subscription command test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class UpdateSubscriberSubscriptionCommandTest extends AbstractTestCase | ||
{ | ||
use CommandTrait; | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['subscriber' => new Subscriber(), 'subscriptions' => null]; | ||
$object = new UpdateSubscriberSubscriptionCommand($params['subscriber'], $params['subscriptions']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
|
||
protected function getHandlerClass() | ||
{ | ||
return UpdateSubscriberSubscriptionCommandHandler::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?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; | ||
|
||
use AltThree\TestBench\ExistenceTrait; | ||
use PHPUnit_Framework_TestCase as TestCase; | ||
|
||
/** | ||
* This is the event existence test class. | ||
* | ||
* @author Graham Campbell <[email protected]> | ||
*/ | ||
class EventExistenceTest extends TestCase | ||
{ | ||
use ExistenceTrait; | ||
|
||
protected function getSourcePath() | ||
{ | ||
return realpath(__DIR__.'/../../../app/Bus/Events'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Incident; | ||
|
||
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasRemovedEvent; | ||
use CachetHQ\Cachet\Models\Incident; | ||
|
||
/** | ||
* This is the incident was removed event test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class IncidentWasRemovedEventTest extends AbstractIncidentEventTestCase | ||
{ | ||
protected function objectHasHandlers() | ||
{ | ||
return false; | ||
} | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['incident' => new Incident()]; | ||
$object = new IncidentWasRemovedEvent($params['incident']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/Bus/Events/Incident/IncidentWasReportedEventTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Incident; | ||
|
||
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasReportedEvent; | ||
use CachetHQ\Cachet\Models\Incident; | ||
|
||
/** | ||
* This is the incident was reported event test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class IncidentWasReportedEventTest extends AbstractIncidentEventTestCase | ||
{ | ||
protected function objectHasHandlers() | ||
{ | ||
return true; | ||
} | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['incident' => new Incident()]; | ||
$object = new IncidentWasReportedEvent($params['incident']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Incident; | ||
|
||
use CachetHQ\Cachet\Bus\Events\Incident\IncidentWasUpdatedEvent; | ||
use CachetHQ\Cachet\Models\Incident; | ||
|
||
/** | ||
* This is the incident was updated event test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class IncidentWasUpdatedEventTest extends AbstractIncidentEventTestCase | ||
{ | ||
protected function objectHasHandlers() | ||
{ | ||
return false; | ||
} | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['incident' => new Incident()]; | ||
$object = new IncidentWasUpdatedEvent($params['incident']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/Bus/Events/Incident/MaintenanceWasScheduledEventTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Incident; | ||
|
||
use CachetHQ\Cachet\Bus\Events\Incident\MaintenanceWasScheduledEvent; | ||
use CachetHQ\Cachet\Models\Incident; | ||
|
||
/** | ||
* This is the maintenance was scheduled event test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class MaintenanceWasScheduledEventTest extends AbstractIncidentEventTestCase | ||
{ | ||
protected function objectHasHandlers() | ||
{ | ||
return true; | ||
} | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['incident' => new Incident()]; | ||
$object = new MaintenanceWasScheduledEvent($params['incident']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Metric; | ||
|
||
use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasAddedEvent; | ||
use CachetHQ\Cachet\Models\MetricPoint; | ||
|
||
/** | ||
* This is the metric point was added event test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class MetricPointWasAddedEventTest extends AbstractMetricEventTestCase | ||
{ | ||
protected function objectHasHandlers() | ||
{ | ||
return false; | ||
} | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['metricPoint' => new MetricPoint()]; | ||
$object = new MetricPointWasAddedEvent($params['metricPoint']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/Bus/Events/Metric/MetricPointWasRemovedEventTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Metric; | ||
|
||
use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasRemovedEvent; | ||
use CachetHQ\Cachet\Models\MetricPoint; | ||
|
||
/** | ||
* This is the metric point was removed event test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class MetricPointWasRemovedEventTest extends AbstractMetricEventTestCase | ||
{ | ||
protected function objectHasHandlers() | ||
{ | ||
return false; | ||
} | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['metricPoint' => new MetricPoint()]; | ||
$object = new MetricPointWasRemovedEvent($params['metricPoint']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/Bus/Events/Metric/MetricPointWasUpdatedEventTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\Metric; | ||
|
||
use CachetHQ\Cachet\Bus\Events\Metric\MetricPointWasUpdatedEvent; | ||
use CachetHQ\Cachet\Models\MetricPoint; | ||
|
||
/** | ||
* This is the metric point was updated event test class. | ||
* | ||
* @author James Brooks <[email protected]> | ||
*/ | ||
class MetricPointWasUpdatedEventTest extends AbstractMetricEventTestCase | ||
{ | ||
protected function objectHasHandlers() | ||
{ | ||
return false; | ||
} | ||
|
||
protected function getObjectAndParams() | ||
{ | ||
$params = ['metricPoint' => new MetricPoint()]; | ||
$object = new MetricPointWasUpdatedEvent($params['metricPoint']); | ||
|
||
return compact('params', 'object'); | ||
} | ||
} |
Oops, something went wrong.