Added missing command tests

This commit is contained in:
Graham Campbell
2015-12-06 11:32:45 +00:00
parent 5fd3abcbd0
commit 3c1f5cfdf5
3 changed files with 142 additions and 0 deletions

View File

@@ -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\Commands\Invite;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Commands\Invite\ClaimInviteCommand;
use CachetHQ\Cachet\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;
}
}

View File

@@ -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\Commands\User;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Commands\User\InviteTeamMemberCommand;
use CachetHQ\Cachet\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;
}
}

View File

@@ -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\User;
use AltThree\TestBench\CommandTrait;
use CachetHQ\Cachet\Commands\User\SignupUserCommand;
use CachetHQ\Cachet\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;
}
}