. */ declare(strict_types=1); namespace Tests\Unit\Import\Mapper; use FireflyIII\Import\Mapper\Bills; use FireflyIII\Models\Account; use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use Illuminate\Support\Collection; use Tests\TestCase; /** * Class BillsTest */ class BillsTest extends TestCase { /** * @covers \FireflyIII\Import\Mapper\Bills::getMap() */ public function testGetMapBasic() { $one = new Bill(); $one->id = 5; $one->name = 'Something'; $one->match = 'hi,bye'; $two = new Account; $two->id = 9; $two->name = 'Else'; $two->match = 'match'; $collection = new Collection([$one, $two]); $repository = $this->mock(BillRepositoryInterface::class); $repository->shouldReceive('getBills')->andReturn($collection)->once(); $mapper = new Bills(); $mapping = $mapper->getMap(); $this->assertCount(3, $mapping); // assert this is what the result looks like: $result = [ 0 => strval(trans('import.map_do_not_map')), 9 => 'Else [match]', 5 => 'Something [hi,bye]', ]; $this->assertEquals($result, $mapping); } }