mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 06:31:22 +00:00
Some light refactoring. No changes.
This commit is contained in:
@@ -50,13 +50,16 @@ class CategoryControllerTest extends TestCase
|
||||
*/
|
||||
public function testAll(string $range)
|
||||
{
|
||||
|
||||
$repository = $this->mock(CategoryRepositoryInterface::class);
|
||||
$accountRepos = $this->mock(AccountRepositoryInterface::class);
|
||||
$generator = $this->mock(GeneratorInterface::class);
|
||||
$firstUse = new Carbon;
|
||||
$firstUse->subDays(3);
|
||||
|
||||
$repository->shouldReceive('spentInPeriod')->andReturn('0');
|
||||
$repository->shouldReceive('earnedInPeriod')->andReturn('0');
|
||||
$repository->shouldReceive('firstUseDate')->andReturn(new Carbon('1900-01-01'))->once();
|
||||
$repository->shouldReceive('firstUseDate')->andReturn($firstUse)->once();
|
||||
$accountRepos->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn(new Collection)->once();
|
||||
$generator->shouldReceive('multiSet')->once()->andReturn([]);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace Tests\Unit\Helpers;
|
||||
|
||||
use FireflyIII\Http\Middleware\Sandstorm;
|
||||
use FireflyIII\Models\Role;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -74,7 +75,7 @@ class SandstormTest extends TestCase
|
||||
putenv('SANDSTORM=1');
|
||||
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('count')->once()->andReturn(1);
|
||||
$repository->shouldReceive('count')->twice()->andReturn(1);
|
||||
|
||||
$response = $this->get('/_test/sandstorm');
|
||||
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
|
||||
@@ -123,9 +124,10 @@ class SandstormTest extends TestCase
|
||||
putenv('SANDSTORM=1');
|
||||
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('count')->once()->andReturn(0);
|
||||
$repository->shouldReceive('count')->twice()->andReturn(0);
|
||||
$repository->shouldReceive('store')->once()->andReturn($this->user());
|
||||
$repository->shouldReceive('attachRole')->once()->andReturn(true);
|
||||
$repository->shouldReceive('attachRole')->twice()->andReturn(true);
|
||||
$repository->shouldReceive('getRole')->once()->andReturn(new Role);
|
||||
|
||||
$response = $this->get('/_test/sandstorm', ['X-Sandstorm-User-Id' => 'abcd']);
|
||||
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
|
||||
@@ -152,7 +154,7 @@ class SandstormTest extends TestCase
|
||||
putenv('SANDSTORM=1');
|
||||
|
||||
$repository = $this->mock(UserRepositoryInterface::class);
|
||||
$repository->shouldReceive('count')->once()->andReturn(1);
|
||||
$repository->shouldReceive('count')->twice()->andReturn(1);
|
||||
$repository->shouldReceive('first')->once()->andReturn($this->user());
|
||||
|
||||
$response = $this->get('/_test/sandstorm', ['X-Sandstorm-User-Id' => 'abcd']);
|
||||
|
||||
Reference in New Issue
Block a user