Fix test to run with new bootstrapping
This commit is contained in:
parent
e8ea218f20
commit
ac9f83a8fe
3 changed files with 10 additions and 38 deletions
|
@ -1,30 +1,17 @@
|
|||
<?php
|
||||
/*
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Tests\Unit\Services\Helpers;
|
||||
|
||||
use Mockery as m;
|
||||
use Tests\TestCase;
|
||||
use phpmock\phpunit\PHPMock;
|
||||
use Tests\Traits\MocksUuids;
|
||||
use Illuminate\Contracts\Hashing\Hasher;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Pterodactyl\Services\Helpers\TemporaryPasswordService;
|
||||
|
||||
class TemporaryPasswordServiceTest extends TestCase
|
||||
{
|
||||
use PHPMock;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Config\Repository|\Mockery\Mock
|
||||
*/
|
||||
protected $config;
|
||||
use MocksUuids;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Database\ConnectionInterface|\Mockery\Mock
|
||||
|
@ -48,11 +35,10 @@ class TemporaryPasswordServiceTest extends TestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->config = m::mock(Repository::class);
|
||||
$this->connection = m::mock(ConnectionInterface::class);
|
||||
$this->hasher = m::mock(Hasher::class);
|
||||
|
||||
$this->service = new TemporaryPasswordService($this->config, $this->connection, $this->hasher);
|
||||
$this->service = new TemporaryPasswordService($this->connection, $this->hasher);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,11 +46,7 @@ class TemporaryPasswordServiceTest extends TestCase
|
|||
*/
|
||||
public function testTemporaryPasswordIsStored()
|
||||
{
|
||||
$this->getFunctionMock('\\Pterodactyl\\Services\\Helpers', 'str_random')
|
||||
->expects($this->once())->with(40)->willReturn('random_string');
|
||||
|
||||
$this->config->shouldReceive('get')->with('app.key')->once()->andReturn('123456');
|
||||
$token = hash_hmac(TemporaryPasswordService::HMAC_ALGO, 'random_string', '123456');
|
||||
$token = hash_hmac(TemporaryPasswordService::HMAC_ALGO, $this->getKnownUuid(), config('app.key'));
|
||||
|
||||
$this->hasher->shouldReceive('make')->with($token)->once()->andReturn('hashed_token');
|
||||
$this->connection->shouldReceive('table')->with('password_resets')->once()->andReturnSelf();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue