/** @test */
 public function itMapsPropertiesUsingGettersAndSetters()
 {
     $map = new Map();
     $map->map('foo', 'mappedFoo');
     $from = new Stubs\From('value for foo');
     $to = new Stubs\To();
     $mapper = new Mapper();
     $mapper->process($from, $to, $map);
     $this->assertEquals('value for foo', $to->getMappedFoo());
 }
 /** @test */
 public function itReversesEmbeddedCollections()
 {
     $from = new Stubs\From();
     $to = new Stubs\To('value from mapped foo');
     $to->setMappedChildren([new Stubs\From('foo child 0'), new Stubs\From('foo child 1'), new Stubs\From('foo child 2')]);
     $map = new Map();
     $map->map('foo', 'mappedFoo')->embedCollection('children', 'mappedChildren', (new Map())->map('[foo]', 'foo'), new CallbackFactory(function ($value) {
         return new Stubs\To();
     }, function ($value) {
         return [];
     }));
     $mapper = new Mapper();
     $mapper->reverse($from, $to, $map);
     $this->assertEquals('value from mapped foo', $from->getFoo());
     $this->assertCount(3, $from->getChildren());
     $count = 0;
     foreach ($from->getChildren() as $child) {
         $this->assertTrue(is_array($child));
         $this->assertEquals(sprintf('foo child %d', $count++), $child['foo']);
     }
 }