File tree Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ final class ArrayMapperTest extends BuilderTestCase
16
16
{
17
17
use TransformerBuilderAssertTrait;
18
18
19
- public function testWithOneConditionThatMatch ()
19
+ public function testWithASingleCopyField ()
20
20
{
21
21
$ builder = new \Kiboko \Plugin \FastMap \Builder \ArrayMapper (
22
22
$ mapper = new ArrayBuilder ()
@@ -42,7 +42,7 @@ public function testWithOneConditionThatMatch()
42
42
);
43
43
}
44
44
45
- public function testWithSeveralConditionsThatMatch ()
45
+ public function testWithSameNumberOfOutputFields ()
46
46
{
47
47
$ builder = new \Kiboko \Plugin \FastMap \Builder \ArrayMapper (
48
48
$ mapper = new ArrayBuilder ()
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace functional \Kiboko \Plugin \FastMap \Builder \DTO ;
6
+
7
+ class Product
8
+ {
9
+ public function __construct (
10
+ public int $ id ,
11
+ public ?bool $ enabled = false ,
12
+ ) {
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace functional \Kiboko \Plugin \FastMap \Builder ;
6
+
7
+ use functional \Kiboko \Plugin \FastMap \Builder \DTO \Product ;
8
+ use Kiboko \Component \FastMapConfig \ObjectBuilder ;
9
+ use Kiboko \Component \PHPUnitExtension \Assert \TransformerBuilderAssertTrait ;
10
+ use Kiboko \Plugin \FastMap \Builder \Transformer ;
11
+
12
+ final class ObjectMapperTest extends BuilderTestCase
13
+ {
14
+ use TransformerBuilderAssertTrait;
15
+
16
+ public function testObjectMapper ()
17
+ {
18
+ $ builder = new \Kiboko \Plugin \FastMap \Builder \ObjectMapper (
19
+ $ mapper = new ObjectBuilder (Product::class)
20
+ );
21
+
22
+ $ mapper ->arguments ('input.id ' , 'input.enabled ' );
23
+
24
+ $ builder = new Transformer ($ builder );
25
+
26
+ $ this ->assertBuildsTransformerTransformsLike (
27
+ [
28
+ new Product (1 )
29
+ ],
30
+ [
31
+ new Product (1 )
32
+ ],
33
+ $ builder ,
34
+ );
35
+
36
+ $ this ->assertBuildsTransformerTransformsLike (
37
+ [
38
+ new Product (1 , true )
39
+ ],
40
+ [
41
+ new Product (1 , true )
42
+ ],
43
+ $ builder ,
44
+ );
45
+ }
46
+ }
You can’t perform that action at this time.
0 commit comments