Neos\Flow\Tests\Unit\Persistence\Generic\DataMapperTest::mapArrayCreatesExpectedArray PHP Метод

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

    public function mapArrayCreatesExpectedArray()
    {
        $dateTime = new \DateTime();
        $object = new \stdClass();
        $splObjectStorage = new \SplObjectStorage();
        $expected = ['one' => 'onetwothreefour', 'two' => 1234, 'three' => 1.234, 'four' => false, 'five' => $dateTime, 'six' => $object, 'seven' => $splObjectStorage];
        $arrayValues = ['one' => ['type' => 'string', 'index' => 'one', 'value' => 'onetwothreefour'], 'two' => ['type' => 'integer', 'index' => 'two', 'value' => 1234], 'three' => ['type' => 'float', 'index' => 'three', 'value' => 1.234], 'four' => ['type' => 'boolean', 'index' => 'four', 'value' => false], 'five' => ['type' => 'DateTime', 'index' => 'five', 'value' => $dateTime->getTimestamp()], 'six' => ['type' => 'stdClass', 'index' => 'six', 'value' => ['mappedObject']], 'seven' => ['type' => 'SplObjectStorage', 'index' => 'seven', 'value' => ['mappedObject']]];
        $dataMapper = $this->getAccessibleMock(Persistence\Generic\DataMapper::class, ['mapDateTime', 'mapToObject', 'mapSplObjectStorage']);
        $dataMapper->expects($this->once())->method('mapDateTime')->with($arrayValues['five']['value'])->will($this->returnValue($dateTime));
        $dataMapper->expects($this->once())->method('mapToObject')->with($arrayValues['six']['value'])->will($this->returnValue($object));
        $dataMapper->expects($this->once())->method('mapSplObjectStorage')->with($arrayValues['seven']['value'])->will($this->returnValue($splObjectStorage));
        $this->assertEquals($dataMapper->_call('mapArray', $arrayValues), $expected);
    }