|
@@ -112,7 +112,7 @@ discard block |
|
|
block discarded – undo |
|
112
|
112
|
$schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath()); |
|
113
|
113
|
$tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
|
114
|
114
|
$this->tdbmDaoGenerator = new TDBMDaoGenerator($this->getConfiguration(), $tdbmSchemaAnalyzer); |
|
115
|
|
- $this->rootPath = __DIR__ . '/../'; |
|
|
115
|
+ $this->rootPath = __DIR__.'/../'; |
|
116
|
116
|
//$this->tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
|
117
|
117
|
} |
|
118
|
118
|
|
|
@@ -134,10 +134,10 @@ discard block |
|
|
block discarded – undo |
|
134
|
134
|
public function testDaoGeneration(): void |
|
135
|
135
|
{ |
|
136
|
136
|
// Remove all previously generated files. |
|
137
|
|
- $this->recursiveDelete($this->rootPath . 'src/Test/Dao/'); |
|
138
|
|
- mkdir($this->rootPath . 'src/Test/Dao/Generated', 0755, true); |
|
|
137
|
+ $this->recursiveDelete($this->rootPath.'src/Test/Dao/'); |
|
|
138
|
+ mkdir($this->rootPath.'src/Test/Dao/Generated', 0755, true); |
|
139
|
139
|
// Let's generate a dummy file to see it is indeed removed. |
|
140
|
|
- $dummyFile = $this->rootPath . 'src/Test/Dao/Generated/foobar.php'; |
|
|
140
|
+ $dummyFile = $this->rootPath.'src/Test/Dao/Generated/foobar.php'; |
|
141
|
141
|
touch($dummyFile); |
|
142
|
142
|
$this->assertFileExists($dummyFile); |
|
143
|
143
|
|
|
@@ -156,7 +156,7 @@ discard block |
|
|
block discarded – undo |
|
156
|
156
|
|
|
157
|
157
|
// Let's require all files to check they are valid PHP! |
|
158
|
158
|
// Test the daoFactory |
|
159
|
|
- require_once $this->rootPath . 'src/Test/Dao/Generated/DaoFactory.php'; |
|
|
159
|
+ require_once $this->rootPath.'src/Test/Dao/Generated/DaoFactory.php'; |
|
160
|
160
|
// Test the others |
|
161
|
161
|
|
|
162
|
162
|
$beanDescriptors = $this->getDummyGeneratorListener()->getBeanDescriptors(); |
|
@@ -166,10 +166,10 @@ discard block |
|
|
block discarded – undo |
|
166
|
166
|
$daoBaseName = $beanDescriptor->getBaseDaoClassName(); |
|
167
|
167
|
$beanName = $beanDescriptor->getBeanClassName(); |
|
168
|
168
|
$baseBeanName = $beanDescriptor->getBaseBeanClassName(); |
|
169
|
|
- require_once $this->rootPath . 'src/Test/Dao/Bean/Generated/' . $baseBeanName . '.php'; |
|
170
|
|
- require_once $this->rootPath . 'src/Test/Dao/Bean/' . $beanName . '.php'; |
|
171
|
|
- require_once $this->rootPath . 'src/Test/Dao/Generated/' . $daoBaseName . '.php'; |
|
172
|
|
- require_once $this->rootPath . 'src/Test/Dao/' . $daoName . '.php'; |
|
|
169
|
+ require_once $this->rootPath.'src/Test/Dao/Bean/Generated/'.$baseBeanName.'.php'; |
|
|
170
|
+ require_once $this->rootPath.'src/Test/Dao/Bean/'.$beanName.'.php'; |
|
|
171
|
+ require_once $this->rootPath.'src/Test/Dao/Generated/'.$daoBaseName.'.php'; |
|
|
172
|
+ require_once $this->rootPath.'src/Test/Dao/'.$daoName.'.php'; |
|
173
|
173
|
} |
|
174
|
174
|
|
|
175
|
175
|
// Check that pivot tables do not generate DAOs or beans. |
|
@@ -185,7 +185,7 @@ discard block |
|
|
block discarded – undo |
|
185
|
185
|
$schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath()); |
|
186
|
186
|
$tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
|
187
|
187
|
$tdbmDaoGenerator = new TDBMDaoGenerator($configuration, $tdbmSchemaAnalyzer); |
|
188
|
|
- $this->rootPath = __DIR__ . '/../../../../'; |
|
|
188
|
+ $this->rootPath = __DIR__.'/../../../../'; |
|
189
|
189
|
//$tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
|
190
|
190
|
|
|
191
|
191
|
$this->expectException(NoPathFoundException::class); |
|
@@ -203,7 +203,7 @@ discard block |
|
|
block discarded – undo |
|
203
|
203
|
if (is_file($str)) { |
|
204
|
204
|
return @unlink($str); |
|
205
|
205
|
} elseif (is_dir($str)) { |
|
206
|
|
- $scan = glob(rtrim($str, '/') . '/*'); |
|
|
206
|
+ $scan = glob(rtrim($str, '/').'/*'); |
|
207
|
207
|
foreach ($scan as $index => $path) { |
|
208
|
208
|
$this->recursiveDelete($path); |
|
209
|
209
|
} |
|
@@ -1643,7 +1643,7 @@ discard block |
|
|
block discarded – undo |
|
1643
|
1643
|
|
|
1644
|
1644
|
// executes after the command finishes |
|
1645
|
1645
|
if (!$process->isSuccessful()) { |
|
1646
|
|
- $this->fail('Generated code is not PSR-2 compliant' . PHP_EOL . $process->getErrorOutput()); |
|
|
1646
|
+ $this->fail('Generated code is not PSR-2 compliant'.PHP_EOL.$process->getErrorOutput()); |
|
1647
|
1647
|
} |
|
1648
|
1648
|
$this->assertTrue($process->isSuccessful()); |
|
1649
|
1649
|
} |
|
@@ -2082,7 +2082,7 @@ discard block |
|
|
block discarded – undo |
|
2082
|
2082
|
|
|
2083
|
2083
|
$artists = new ArtistDao($this->tdbmService); |
|
2084
|
2084
|
$pinkFloyd = $artists->getById(1); |
|
2085
|
|
- $animals = $pinkFloyd->getAlbums()[0]; |
|
|
2085
|
+ $animals = $pinkFloyd->getAlbums()[0]; |
|
2086
|
2086
|
$json = $pinkFloyd->jsonSerialize(); |
|
2087
|
2087
|
// Collection name properly handled ('discography' instead of default 'albums') |
|
2088
|
2088
|
self::assertTrue(isset($json['discography'])); |