ScriptFUSIONTest\Unit\Porter\Mapper\PorterMapperTest::testMap PHP Метод

testMap() публичный Метод

public testMap ( )
    public function testMap()
    {
        $mapper = new PorterMapper($porter = \Mockery::mock(Porter::class));
        /** @var RecordCollection $records */
        $records = \Mockery::mock(RecordCollection::class, [new \ArrayIterator([[1], [2], [3]])])->makePartial();
        $mappedRecords = $mapper->mapCollection($records, new AnonymousMapping([$strategy = \Mockery::mock(implode(',', [Strategy::class, PorterAware::class]))]));
        $strategy->shouldReceive('__invoke')->andReturnUsing(function ($data) {
            return $data[0] * $data[0];
        })->getMock()->shouldReceive('setPorter')->with($porter)->atLeast()->once();
        self::assertSame([[1], [4], [9]], iterator_to_array($mappedRecords));
    }
PorterMapperTest