-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mariusz Fik <[email protected]>
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 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,53 @@ | ||
<?php | ||
|
||
namespace Modules\User\Tests; | ||
|
||
use Modules\User\Entities\Sentinel\User; | ||
use Modules\User\Http\Controllers\Api\UserController; | ||
use Modules\User\Http\Requests\CreateUserRequest; | ||
use Modules\User\Permissions\PermissionManager; | ||
use Modules\User\Repositories\UserRepository; | ||
use Modules\User\Repositories\UserTokenRepository; | ||
|
||
class ApiUserControllerTest extends BaseUserTestCase | ||
{ | ||
/** | ||
* @var UserRepository | ||
*/ | ||
private $user; | ||
/** | ||
* @var PermissionManager | ||
*/ | ||
private $permissions; | ||
/** | ||
* @var UserTokenRepository | ||
*/ | ||
private $userToken; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->user = app(UserRepository::class); | ||
$this->permissions = app(PermissionManager::class); | ||
$this->userToken = app(UserTokenRepository::class); | ||
} | ||
|
||
/** @test */ | ||
public function it_creates_a_new_activated_user() | ||
{ | ||
$data = [ | ||
'email' => '[email protected]', | ||
'password' => 'Pa$$w0rd', | ||
'is_activated' => true, | ||
]; | ||
|
||
$request = CreateUserRequest::create('', '', $data); | ||
$controller = new UserController($this->user, $this->permissions, $this->userToken); | ||
|
||
$controller->store($request); | ||
$user = $this->user->find(1); | ||
|
||
$this->assertInstanceOf(User::class, $user); | ||
$this->assertTrue($user->isActivated()); | ||
} | ||
} |
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