| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 18 | public function testBuildWebsite() : void |
||
| 19 | { |
||
| 20 | $input = new ArrayInput(['command' => 'doctrine:build-website']); |
||
| 21 | |||
| 22 | $kernel = new AppKernel('test', true); |
||
| 23 | $kernel->boot(); |
||
| 24 | |||
| 25 | $container = $kernel->getContainer(); |
||
|
|
|||
| 26 | |||
| 27 | $application = new Application($kernel); |
||
| 28 | $application->setAutoExit(false); |
||
| 29 | $application->run($input); |
||
| 30 | |||
| 31 | $buildDir = __DIR__ . '/App/build-test'; |
||
| 32 | |||
| 33 | $indexContents = $this->getFileContents($buildDir, 'index.html'); |
||
| 34 | |||
| 35 | self::assertContains( |
||
| 36 | '<title>Doctrine Static Website</title>', |
||
| 37 | $indexContents |
||
| 38 | ); |
||
| 39 | |||
| 40 | self::assertContains( |
||
| 41 | '<h1>DoctrineStaticWebsiteGeneratorBundle</h1>', |
||
| 42 | $indexContents |
||
| 43 | ); |
||
| 44 | |||
| 45 | self::assertContains( |
||
| 46 | '<p>Testing that DoctrineStaticWebsiteGeneratorBundle works in a Symfony application.</p>', |
||
| 47 | $indexContents |
||
| 48 | ); |
||
| 49 | |||
| 50 | self::assertContains('Homepage: /index.html', $indexContents); |
||
| 51 | |||
| 52 | self::assertContains('Homepage URL: http://localhost/index.html', $indexContents); |
||
| 53 | |||
| 54 | self::assertContains('Controller Data: This data came from the controller', $indexContents); |
||
| 55 | |||
| 56 | self::assertContains('Request Data: /index.html', $indexContents); |
||
| 57 | |||
| 58 | $apiIndexContents = $this->getFileContents($buildDir, 'api/index.html'); |
||
| 59 | |||
| 60 | self::assertSame('This file should not be rendered.', trim($apiIndexContents)); |
||
| 61 | |||
| 62 | $jwageContents = $this->getFileContents($buildDir, 'user/jwage.html'); |
||
| 63 | |||
| 64 | self::assertContains('jwage', $jwageContents); |
||
| 65 | |||
| 66 | $ocramiusContents = $this->getFileContents($buildDir, 'user/ocramius.html'); |
||
| 67 | |||
| 68 | self::assertContains('ocramius', $ocramiusContents); |
||
| 69 | } |
||
| 83 |