@@ 17-41 (lines=25) @@ | ||
14 | */ |
|
15 | class TransformerConfigTest extends \PHPUnit_Framework_TestCase |
|
16 | { |
|
17 | public function testCreateFromSnakeCaseOptions() |
|
18 | { |
|
19 | $config = new TransformerConfig([ |
|
20 | 'input_class' => FooBar::class, |
|
21 | 'input_validator' => ValidatorChain::class, |
|
22 | 'extractor' => ClassMethods::class, |
|
23 | 'keyMap' => [ |
|
24 | 'foo' => 'fiz', |
|
25 | 'bar' => 'buz', |
|
26 | ], |
|
27 | 'transformer' => TransformerInterface::class, |
|
28 | 'hydrator' => ClassMethods::class, |
|
29 | 'output_class' => FizBuz::class, |
|
30 | 'output_validator' => ValidatorChain::class, |
|
31 | ]); |
|
32 | ||
33 | self::assertEquals(FooBar::class, $config->getInputClass()); |
|
34 | self::assertEquals(ValidatorChain::class, $config->getInputValidator()); |
|
35 | self::assertEquals(ClassMethods::class, $config->getExtractor()); |
|
36 | self::assertEquals(['foo' => 'fiz', 'bar' => 'buz'], $config->getKeyMap()); |
|
37 | self::assertEquals(TransformerInterface::class, $config->getTransformer()); |
|
38 | self::assertEquals(ClassMethods::class, $config->getHydrator()); |
|
39 | self::assertEquals(FizBuz::class, $config->getOutputClass()); |
|
40 | self::assertEquals(ValidatorChain::class, $config->getOutputValidator()); |
|
41 | } |
|
42 | ||
43 | public function testCreateFromCamelCaseOptions() |
|
44 | { |
|
@@ 43-67 (lines=25) @@ | ||
40 | self::assertEquals(ValidatorChain::class, $config->getOutputValidator()); |
|
41 | } |
|
42 | ||
43 | public function testCreateFromCamelCaseOptions() |
|
44 | { |
|
45 | $config = new TransformerConfig([ |
|
46 | 'inputClass' => FooBar::class, |
|
47 | 'inputValidator' => ValidatorChain::class, |
|
48 | 'extractor' => ClassMethods::class, |
|
49 | 'keyMap' => [ |
|
50 | 'foo' => 'fiz', |
|
51 | 'bar' => 'buz', |
|
52 | ], |
|
53 | 'transformer' => TransformerInterface::class, |
|
54 | 'hydrator' => ClassMethods::class, |
|
55 | 'outputClass' => FizBuz::class, |
|
56 | 'outputValidator' => ValidatorChain::class, |
|
57 | ]); |
|
58 | ||
59 | self::assertEquals(FooBar::class, $config->getInputClass()); |
|
60 | self::assertEquals(ValidatorChain::class, $config->getInputValidator()); |
|
61 | self::assertEquals(ClassMethods::class, $config->getExtractor()); |
|
62 | self::assertEquals(['foo' => 'fiz', 'bar' => 'buz'], $config->getKeyMap()); |
|
63 | self::assertEquals(TransformerInterface::class, $config->getTransformer()); |
|
64 | self::assertEquals(ClassMethods::class, $config->getHydrator()); |
|
65 | self::assertEquals(FizBuz::class, $config->getOutputClass()); |
|
66 | self::assertEquals(ValidatorChain::class, $config->getOutputValidator()); |
|
67 | } |
|
68 | } |
|
69 |