mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 02:52:44 +00:00
Improve test coverage.
This commit is contained in:
@@ -28,8 +28,8 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Mockery;
|
||||
use Tests\TestCase;
|
||||
use Preferences;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class LinkControllerTest
|
||||
@@ -85,7 +85,7 @@ class LinkControllerTest extends TestCase
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'demo'])->andReturn(false)->atLeast()->once();
|
||||
|
||||
$linkType = LinkType::where('editable', 1)->first();
|
||||
$another= LinkType::where('editable', 0)->first();
|
||||
$another = LinkType::where('editable', 0)->first();
|
||||
$repository->shouldReceive('get')->once()->andReturn(new Collection([$linkType, $another]));
|
||||
$repository->shouldReceive('countJournals')->andReturn(2);
|
||||
$this->be($this->user());
|
||||
@@ -100,9 +100,9 @@ class LinkControllerTest extends TestCase
|
||||
*/
|
||||
public function testDeleteNonEditable(): void
|
||||
{
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$this->mock(LinkTypeRepositoryInterface::class);
|
||||
$linkType = LinkType::where('editable', 0)->first();
|
||||
$linkType = LinkType::where('editable', 0)->first();
|
||||
|
||||
// mock default session stuff
|
||||
$this->mockDefaultSession();
|
||||
@@ -216,7 +216,7 @@ class LinkControllerTest extends TestCase
|
||||
*/
|
||||
public function testShow(): void
|
||||
{
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$repository = $this->mock(LinkTypeRepositoryInterface::class);
|
||||
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->andReturn(true)->atLeast()->once();
|
||||
@@ -327,7 +327,7 @@ class LinkControllerTest extends TestCase
|
||||
*/
|
||||
public function testUpdateNonEditable(): void
|
||||
{
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$this->mock(LinkTypeRepositoryInterface::class);
|
||||
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->andReturn(true)->atLeast()->once();
|
||||
|
Reference in New Issue
Block a user