-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: utilize
InheritanceMap
on the source side to determine the ta…
…rget class
- Loading branch information
Showing
4 changed files
with
120 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of rekalogika/mapper package. | ||
* | ||
* (c) Priyadi Iman Nurcahyo <https://rekalogika.dev> | ||
* | ||
* For the full copyright and license information, please view the LICENSE file | ||
* that was distributed with this source code. | ||
*/ | ||
|
||
namespace Rekalogika\Mapper\Tests\IntegrationTest; | ||
|
||
use Rekalogika\Mapper\Tests\Common\FrameworkTestCase; | ||
use Rekalogika\Mapper\Tests\Fixtures\Inheritance\AbstractClass; | ||
use Rekalogika\Mapper\Tests\Fixtures\Inheritance\ConcreteClassA; | ||
use Rekalogika\Mapper\Tests\Fixtures\InheritanceDto\ConcreteClassADto; | ||
|
||
class InheritanceReversedTest extends FrameworkTestCase | ||
{ | ||
public function testMapDtoToAbstractClass(): void | ||
{ | ||
$concreteClassADto = new ConcreteClassADto(); | ||
$concreteClassADto->propertyInA = 'xxpropertyInA'; | ||
$concreteClassADto->propertyInParent = 'xxpropertyInParent'; | ||
|
||
$result = $this->mapper->map($concreteClassADto, AbstractClass::class); | ||
|
||
/** @var ConcreteClassA $result */ | ||
|
||
$this->assertInstanceOf(ConcreteClassA::class, $result); | ||
$this->assertSame('xxpropertyInA', $result->propertyInA); | ||
$this->assertSame('xxpropertyInParent', $result->propertyInParent); | ||
} | ||
} |