Commit f5ec4a2 1 parent 001efb0 commit f5ec4a2 Copy full SHA for f5ec4a2
File tree 4 files changed +59
-0
lines changed
4 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 8
8
* test: Add mandatory config for ` symfony/framework-bundle ` .
9
9
* fix(` ProxyGenerator ` ): Handle readonly targets.
10
10
* build: Require ` symfony/console ` .
11
+ * test: Lazy loading id property from parent class.
11
12
12
13
## 0.6.7
13
14
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /*
6
+ * This file is part of rekalogika/mapper package.
7
+ *
8
+ * (c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE file
11
+ * that was distributed with this source code.
12
+ */
13
+
14
+ namespace Rekalogika \Mapper \Tests \Fixtures \LazyObject ;
15
+
16
+ class AbstractObjectWithIdDto
17
+ {
18
+ public ?string $ id = null ;
19
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /*
6
+ * This file is part of rekalogika/mapper package.
7
+ *
8
+ * (c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
9
+ *
10
+ * For the full copyright and license information, please view the LICENSE file
11
+ * that was distributed with this source code.
12
+ */
13
+
14
+ namespace Rekalogika \Mapper \Tests \Fixtures \LazyObject ;
15
+
16
+ class ChildObjectWithIdDto extends AbstractObjectWithIdDto
17
+ {
18
+ public ?string $ name = null ;
19
+ }
Original file line number Diff line number Diff line change 14
14
namespace Rekalogika \Mapper \Tests \IntegrationTest ;
15
15
16
16
use Rekalogika \Mapper \Tests \Common \AbstractFrameworkTest ;
17
+ use Rekalogika \Mapper \Tests \Fixtures \LazyObject \ChildObjectWithIdDto ;
18
+ use Rekalogika \Mapper \Tests \Fixtures \LazyObject \ConcreteObjectWithId ;
17
19
use Rekalogika \Mapper \Tests \Fixtures \LazyObject \ObjectWithId ;
18
20
use Rekalogika \Mapper \Tests \Fixtures \LazyObject \ObjectWithIdDto ;
19
21
use Rekalogika \Mapper \Tests \Fixtures \LazyObject \ObjectWithIdFinalDto ;
@@ -75,4 +77,22 @@ public function testReadOnly83(): void
75
77
$ source = new ObjectWithId ();
76
78
$ target = $ this ->mapper ->map ($ source , ObjectWithIdReadOnlyDto::class);
77
79
}
80
+
81
+
82
+ public function testIdInParentClass (): void
83
+ {
84
+ $ source = new ObjectWithId ();
85
+ $ target = $ this ->mapper ->map ($ source , ChildObjectWithIdDto::class);
86
+ $ this ->assertSame ('id ' , $ target ->id );
87
+ }
88
+
89
+ public function testIdInParentClassInitialized (): void
90
+ {
91
+ $ this ->expectException (\LogicException::class);
92
+ $ this ->expectExceptionMessage ('This method should not be called ' );
93
+
94
+ $ source = new ObjectWithId ();
95
+ $ target = $ this ->mapper ->map ($ source , ChildObjectWithIdDto::class);
96
+ $ foo = $ target ->name ;
97
+ }
78
98
}
You can’t perform that action at this time.
0 commit comments