. */ declare(strict_types=1); namespace Tests\Feature\Controllers; use FireflyIII\Models\Attachment; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Support\Collection; use Log; use Mockery; use Preferences; use Tests\TestCase; /** * Class AttachmentControllerTest * * @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class AttachmentControllerTest extends TestCase { /** * */ public function setUp(): void { parent::setUp(); Log::info(sprintf('Now in %s.', get_class($this))); } /** * @covers \FireflyIII\Http\Controllers\AttachmentController */ public function testDelete(): void { $this->mockDefaultSession(); // data $attachment = $this->getRandomAttachment(); // mock stuff $this->mock(AttachmentRepositoryInterface::class); $userRepos = $this->mock(UserRepositoryInterface::class); $userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->andReturn(true)->atLeast()->once(); $this->be($this->user()); $response = $this->get(route('attachments.delete', [$attachment->id])); $response->assertStatus(200); // has bread crumb $response->assertSee('