Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] avoid raising unexpected RuntimeException when specifying $_SERVER['KERNEL_DIR']#11370

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@iteman
Copy link
Contributor

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Since v2.5.0 (exactlye778cf1), all tests that use WebTestCase are to be errors "RuntimeException: Unable to guess the Kernel directory." even though $_SERVER['KERNEL_DIR'] is specified. This has been preventing another test runner (e.g.MakeGood) from running tests for a Symfony application without overriding KernelTestCase::getPhpUnitXmlDir() as follows.

The bootstrap file for testing in the app directory:

<?php...$_SERVER['KERNEL_DIR'] =__DIR__;require_oncedirname(__DIR__) .'/var/bootstrap.php.cache';

console output:

PHPUnit 4.1.3 by Sebastian Bergmann.EEAcme\DemoBundle\Tests\Controller\DemoController [ ] Index [ ] Secure sectionTime: 146 ms, Memory: 9.50MbThere were 2 errors:1) Acme\DemoBundle\Tests\Controller\DemoControllerTest::testIndexRuntimeException: Unable to guess the Kernel directory./path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:56/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:103/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:156/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:137/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33/path/to/symfony-application/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php:11/path/to/eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.0.v201407050319/resources/php/vendor/piece/stagehand-testrunner/src/Runner/PHPUnitRunner.php:81/path/to/eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.0.v201407050319/resources/php/vendor/piece/stagehand-testrunner/src/Process/TestRunner.php:100/path/to/eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.0.v201407050319/resources/php/vendor/piece/stagehand-testrunner/src/CLI/TestRunnerApplication/Command/PluginCommand.php:149/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:887/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:193/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:124...

…_SERVER['KERNEL_DIR'] before invoking getPhpUnitXmlDir()
@fabpot
Copy link
Member

👍

1 similar comment
@romainneutron
Copy link
Contributor

👍

@fabpot
Copy link
Member

Thank you@iteman.

fabpot added a commit that referenced this pull requestJul 23, 2014
…n when specifying $_SERVER['KERNEL_DIR'] (iteman)This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes#11370).Discussion----------[FrameworkBundle] avoid raising unexpected RuntimeException when specifying $_SERVER['KERNEL_DIR']| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Since v2.5.0 (exactlye778cf1), all tests that use WebTestCase are to be errors "RuntimeException: Unable to guess the Kernel directory." even though $_SERVER['KERNEL_DIR'] is specified. This has been preventing another test runner (e.g. [MakeGood](https://github.com/piece/makegood)) from running tests for a Symfony application without overriding KernelTestCase::getPhpUnitXmlDir() as follows.The bootstrap file for testing in the app directory:```php<?php...$_SERVER['KERNEL_DIR'] = __DIR__;require_once dirname(__DIR__) . '/var/bootstrap.php.cache';```console output:```consolePHPUnit 4.1.3 by Sebastian Bergmann.EEAcme\DemoBundle\Tests\Controller\DemoController [ ] Index [ ] Secure sectionTime: 146 ms, Memory: 9.50MbThere were 2 errors:1) Acme\DemoBundle\Tests\Controller\DemoControllerTest::testIndexRuntimeException: Unable to guess the Kernel directory./path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:56/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:103/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:156/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:137/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33/path/to/symfony-application/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php:11/path/to/eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.0.v201407050319/resources/php/vendor/piece/stagehand-testrunner/src/Runner/PHPUnitRunner.php:81/path/to/eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.0.v201407050319/resources/php/vendor/piece/stagehand-testrunner/src/Process/TestRunner.php:100/path/to/eclipse/plugins/com.piece_framework.makegood.stagehandtestrunner_3.1.0.v201407050319/resources/php/vendor/piece/stagehand-testrunner/src/CLI/TestRunnerApplication/Command/PluginCommand.php:149/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:252/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:887/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:193/path/to/symfony-application/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:124...```Commits-------6f58674 [FrameworkBundle] changed KernelTestCase::getKernelClass() to check $_SERVER['KERNEL_DIR'] before invoking getPhpUnitXmlDir()
@fabpotfabpot closed thisJul 23, 2014
@iteman
Copy link
ContributorAuthor

@fabpot@romainneutron Thank you.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@iteman@fabpot@romainneutron

[8]ページ先頭

©2009-2025 Movatter.jp