. */ declare(strict_types=1); namespace Tests\Feature\Controllers\Json; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use Illuminate\Support\Collection; use Log; use Tests\TestCase; /** * Class FrontpageControllerTest * * @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class FrontpageControllerTest extends TestCase { /** * */ public function setUp() { parent::setUp(); Log::debug(sprintf('Now in %s.', get_class($this))); } /** * @covers \FireflyIII\Http\Controllers\Json\FrontpageController::piggyBanks */ public function testPiggyBanks() { $piggy = $this->user()->piggyBanks()->first(); $repository = $this->mock(PiggyBankRepositoryInterface::class); $repository->shouldReceive('getPiggyBanks')->andReturn(new Collection([$piggy])); $repository->shouldReceive('getCurrentAmount')->andReturn('10'); $this->be($this->user()); $response = $this->get(route('json.fp.piggy-banks')); $response->assertStatus(200); } }