| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function testGenerateModule() |
||
| 25 | { |
||
| 26 | $generator = $this->getEntitiesGeneratorService(); |
||
| 27 | |||
| 28 | $generator->generateModule('Leads', 'Leads', 'Lead', __DIR__.'/../generated/', 'TestNamespace'); |
||
| 29 | |||
| 30 | $this->assertFileExists(__DIR__.'/../generated/Lead.php'); |
||
| 31 | |||
| 32 | require __DIR__.'/../generated/Lead.php'; |
||
| 33 | |||
| 34 | // Second iteration: from existing class! |
||
| 35 | $daoFullyQualified = $generator->generateModule('Leads', 'Leads', 'Lead', __DIR__.'/../generated/', 'TestNamespace'); |
||
| 36 | |||
| 37 | $this->assertFileExists(__DIR__.'/../generated/Lead.php'); |
||
| 38 | $this->assertEquals('TestNamespace\\LeadZohoDao', $daoFullyQualified); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: