. */ declare(strict_types=1); namespace Tests\Unit\Import\Mapper; use FireflyIII\Import\Mapper\AssetAccounts; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Illuminate\Support\Collection; use Tests\TestCase; /** * Class AssetAccountsTest */ class AssetAccountsTest extends TestCase { /** * @covers \FireflyIII\Import\Mapper\AssetAccounts::getMap() */ public function testGetMapBasic() { $one = new Account; $one->id = 23; $one->name = 'Something'; $one->iban = 'IBAN'; $two = new Account; $two->id = 19; $two->name = 'Else'; $collection = new Collection([$one, $two]); $repository = $this->mock(AccountRepositoryInterface::class); $repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::DEFAULT, AccountType::ASSET]])->andReturn($collection)->once(); $mapper = new AssetAccounts(); $mapping = $mapper->getMap(); $this->assertCount(3, $mapping); // assert this is what the result looks like: $result = [ 0 => strval(trans('import.map_do_not_map')), 19 => 'Else', 23 => 'Something (IBAN)', ]; $this->assertEquals($result, $mapping); } }