Example #1
0
 public function testShouldNotMapIgnoredMembers()
 {
     // arrange
     $engine = new Engine();
     $engine->createMap(Source::className(), Destination::className())->forMember('value', new Ignore());
     // act
     /** @var Destination $destination */
     $destination = $engine->map(new Source())->toType(Destination::className());
     // assert
     $this->assertNull($destination->value);
 }
Example #2
0
 public function testMappingShouldThrowExceptionWhenCreatedInvalidDestinationClass()
 {
     $this->setExpectedException('Papper\\MappingException');
     // arrange
     $engine = new Engine();
     $engine->createMap(Source::className(), Destination::className())->constructUsing(function (Source $source) {
         return new InvalidDestination($source->value);
     });
     // act
     $engine->map(new Source('Some value'))->toType(Destination::className());
 }