@@ 46-65 (lines=20) @@ | ||
43 | $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen); |
|
44 | } |
|
45 | ||
46 | public function testFirstClassGenerator() |
|
47 | { |
|
48 | $namespace = 'TestNamespace'; |
|
49 | $className = 'FirstClass'; |
|
50 | $gClassgen = new ClassGenerator($namespace, $className); |
|
51 | $gClassgen->setLogger($this->logger); |
|
52 | $config = new ClassConfig(); |
|
53 | $properties = [ |
|
54 | 'extend' => 'ExtendClass', |
|
55 | 'implements' => 'IClass', |
|
56 | ]; |
|
57 | $typesReferenceArray = []; |
|
58 | $typesDescArray = []; |
|
59 | $gClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config); |
|
60 | // $actual = $gClassgenClassgen->toString(); |
|
61 | // $expected = file_get_contents(__DIR__.'/../Resources/php/FirstClass.php'); |
|
62 | // $this->assertSame($expected, $actual, 'Classe FirstClass invalid'); |
|
63 | $resourcesDir = __DIR__.'/../Resources/php'; |
|
64 | $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgen); |
|
65 | } |
|
66 | ||
67 | public function testTraitsGenerator() |
|
68 | { |
|
@@ 112-129 (lines=18) @@ | ||
109 | $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgenClassgen); |
|
110 | } |
|
111 | ||
112 | public function testImplementsClassWithNamespaceGenerator() |
|
113 | { |
|
114 | $namespace = 'TestNamespace'; |
|
115 | $className = 'ImplementsClassWithNamespace'; |
|
116 | $gClassgenClassgen = new ClassGenerator($namespace, $className); |
|
117 | $gClassgenClassgen->setLogger($this->logger); |
|
118 | $config = new ClassConfig(); |
|
119 | $properties = [ |
|
120 | 'extend' => 'ExtendClass', |
|
121 | 'implements' => "NS\IClass", |
|
122 | ]; |
|
123 | $typesReferenceArray = []; |
|
124 | $typesDescArray = []; |
|
125 | $gClassgenClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config); |
|
126 | $resourcesDir = __DIR__.'/../Resources/php'; |
|
127 | ||
128 | $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgenClassgen); |
|
129 | } |
|
130 | ||
131 | public function testMultiImplementsClassWithNamespaceGenerator() |
|
132 | { |
|
@@ 131-151 (lines=21) @@ | ||
128 | $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgenClassgen); |
|
129 | } |
|
130 | ||
131 | public function testMultiImplementsClassWithNamespaceGenerator() |
|
132 | { |
|
133 | $namespace = 'TestNamespace'; |
|
134 | $className = 'MultiImplementsClassWithNamespace'; |
|
135 | $gClassgenClassgen = new ClassGenerator($namespace, $className); |
|
136 | $gClassgenClassgen->setLogger($this->logger); |
|
137 | $config = new ClassConfig(); |
|
138 | $properties = [ |
|
139 | 'extend' => 'ExtendClass', |
|
140 | 'implements' => [ |
|
141 | "NS\IClass", |
|
142 | "NS\IClass2", |
|
143 | ], |
|
144 | ]; |
|
145 | $typesReferenceArray = []; |
|
146 | $typesDescArray = []; |
|
147 | $gClassgenClassgen->generateClassType($properties, $typesReferenceArray, $typesDescArray, $config); |
|
148 | $resourcesDir = __DIR__.'/../Resources/php'; |
|
149 | ||
150 | $this->compareFileGenerated($resourcesDir, $namespace, $className, $gClassgenClassgen); |
|
151 | } |
|
152 | ||
153 | public function testImplementsClassWithNamespaceAndFieldGeneratorMethod() |
|
154 | { |