Skip to content

[FrameworkBundle] Add support to environment variables APP_ENV/DEBUG in KernelTestCase #24177

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

Merged
merged 1 commit into from
Sep 13, 2017

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented Sep 12, 2017

Q A
Branch? 3.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets symfony/recipes#170 (comment)
License MIT
Doc PR -

/cc @fabpot

@yceruto
Copy link
Member Author

yceruto commented Sep 12, 2017

I guess fabbot failure (unrelated) should be fixed from 2.7

);
if (isset($options['environment'])) {
$env = $options['environment'];
} elseif (isset($_SERVER['APP_ENV']) || isset($_ENV['APP_ENV'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would split this in two:

if (isset($options['environment'])) {
    $env = $options['environment'];
} elseif (isset($_SERVER['APP_ENV'])) {
    $env = $_SERVER['APP_ENV'];
} elseif (isset($_ENV['APP_ENV'])) {
    $env = $_ENV['APP_ENV'];
} else {
    $env = 'test';
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@xabbuh
Copy link
Member

xabbuh commented Sep 12, 2017

Should we merge this one as a bugfix into the 3.3 branch instead?

@yceruto
Copy link
Member Author

yceruto commented Sep 12, 2017

As a bugfix should be into 2.7, no? Let's me know the final decision. I'm for a bugfix rather than a feature ( similar to #24115)

@fabpot
Copy link
Member

fabpot commented Sep 12, 2017

As env vars are "officially" supported since 3.3, I'd vote for a merge in 3.3

@yceruto yceruto changed the base branch from 3.4 to 3.3 September 12, 2017 22:57
@yceruto
Copy link
Member Author

yceruto commented Sep 12, 2017

Done.

@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Sep 13, 2017
@nicolas-grekas
Copy link
Member

Thank you @yceruto.

@nicolas-grekas nicolas-grekas merged commit 8d56744 into symfony:3.3 Sep 13, 2017
nicolas-grekas added a commit that referenced this pull request Sep 13, 2017
…_ENV/DEBUG in KernelTestCase (yceruto)

This PR was merged into the 3.3 branch.

Discussion
----------

[FrameworkBundle] Add support to environment variables APP_ENV/DEBUG in KernelTestCase

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/recipes#170 (comment)
| License       | MIT
| Doc PR        | -

/cc @fabpot

Commits
-------

8d56744 Add support to environment variables APP_ENV/DEBUG in KernelTestCase
@yceruto yceruto deleted the test_env_vars branch September 13, 2017 10:42
@fabpot fabpot mentioned this pull request Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants