-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added more tests for WebProfilerBundle #31522
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/Symfony/Bundle/WebProfilerBundle/Tests/Functional/WebProfilerBundleKernel.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
namespace Symfony\Bundle\WebProfilerBundle\Tests\Functional; | ||
|
||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | ||
use Symfony\Bundle\TwigBundle\TwigBundle; | ||
use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Routing\RouteCollectionBuilder; | ||
|
||
class WebProfilerBundleKernel extends Kernel | ||
{ | ||
use MicroKernelTrait; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct('test', false); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
{ | ||
if (null === $this->name) { | ||
$this->name = parent::getName().substr(md5(__CLASS__), -16); | ||
} | ||
|
||
return $this->name; | ||
} | ||
|
||
public function registerBundles() | ||
{ | ||
return [ | ||
new FrameworkBundle(), | ||
new TwigBundle(), | ||
new WebProfilerBundle(), | ||
]; | ||
} | ||
|
||
protected function configureRoutes(RouteCollectionBuilder $routes) | ||
{ | ||
$routes->import(__DIR__.'/../../Resources/config/routing/profiler.xml', '/_profiler'); | ||
$routes->import(__DIR__.'/../../Resources/config/routing/wdt.xml', '/_wdt'); | ||
$routes->add('/', 'kernel:homepageController'); | ||
} | ||
|
||
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader) | ||
{ | ||
$containerBuilder->loadFromExtension('framework', [ | ||
'secret' => 'foo-secret', | ||
'profiler' => ['only_exceptions' => false], | ||
'session' => ['storage_id' => 'session.storage.mock_file'], | ||
]); | ||
|
||
$containerBuilder->loadFromExtension('web_profiler', [ | ||
'toolbar' => true, | ||
'intercept_redirects' => false, | ||
]); | ||
} | ||
|
||
public function getCacheDir() | ||
{ | ||
return sys_get_temp_dir().'/cache-'.spl_object_hash($this); | ||
} | ||
|
||
public function getLogDir() | ||
{ | ||
return sys_get_temp_dir().'/log-'.spl_object_hash($this); | ||
} | ||
|
||
public function homepageController() | ||
{ | ||
return new Response('<html><head></head><body>Homepage Controller.</body></html>'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this assertion when merging in 4.4 because it doesn't pass and the patch is painful enough to merge up.
Feel free to submit it again on 4.4 with the proper assertion.