Scalr\Tests\Api\ApiEntityAdapterTest::testToEntity PHP Method

testToEntity() public method

public testToEntity ( )
    public function testToEntity()
    {
        $adapter = new TestApiAdapter(new ApiController());
        $testTime = '2015-11-12';
        $testData = new stdClass();
        $testData->id = rand(1, 100);
        $testData->dtField = $testTime;
        /* @var  $entity TestEntity */
        $entity = $adapter->toEntity($testData);
        $this->assertInstanceOf(TestEntity::class, $entity);
        $this->assertEquals($testData->id, $entity->id);
        $this->assertEquals(new \DateTime($testTime), $entity->dtField);
    }