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

Add support for env, server and ini settings in parallel test runs#28995

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

@alexander-schranz
Copy link
Contributor

@alexander-schranzalexander-schranz commentedOct 26, 2018
edited
Loading

QA
Branch?4.3
Bug fix?yes
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#28895 ( maybe related:#28726,symfony/recipes#476 )
LicenseMIT

This fixes problems with $_SERVER and ENV Variables inparallel test runs and that the bootstrap script was not called in parallel test runs.

Currently was most of the logic based on the main phpunit.xml.dist file. This did require me to rewrite the logic based that there are multiple phpunit.xml.dist files. As passing the configuration file via--configuration flag phpunit seems correctly read the env and server configuration and use the correct bootstrap file.

See with the following test setup which does not work and how this script fixes the errors
https://github.com/alexander-schranz/symfony-phpunit-test.

Checklist:

  • fixed env vars in parallel test runs
  • fixed force attribute of env vars in parallel test runs
  • fixed server vars in parallel test runs
  • fixed ini_set in parallel test runs
  • fixed call of bootstrap file in parallel test runs
  • fixed different phpunit version in parallel test runs
  • added functional tests for simple-phpunit script
  • fixed problem when install was canceled before in middle of phpunit installation
  • fixed different SYMFONY_PHPUNIT_REMOVE variable in parallel test runs

@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch fromaaf5916 to80298a9CompareOctober 26, 2018 17:25
@alexander-schranz
Copy link
ContributorAuthor

alexander-schranz commentedOct 26, 2018
edited
Loading

Cannot reproduce the CI error locally:./phpunit install ->Cannot open file "install.php".

Any hint? /cc@nicolas-grekas

@alexander-schranzalexander-schranz changed the titleFixed env and server vars in parallel test suitesFixed env and server vars in parallel test suites and allow different phpunit versionOct 26, 2018
@alexander-schranzalexander-schranz changed the titleFixed env and server vars in parallel test suites and allow different phpunit versionFixed different phpunit configurations in parallel test runsOct 26, 2018
@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch from697ac35 tof52ec82CompareOctober 26, 2018 20:18
@nicolas-grekas
Copy link
Member

Thats' a pretty big change. Shouldn't we consider it as a new feature?
Note that we should use anonymous functions instead of global ones as we shouldn't pollute the global function space.

@alexander-schranzalexander-schranz changed the titleFixed different phpunit configurations in parallel test runsAdded support for env var and ini settings in parallel test runsOct 27, 2018
@alexander-schranzalexander-schranz changed the titleAdded support for env var and ini settings in parallel test runsAdded support for env, server and ini settings in parallel test runsOct 27, 2018
@alexander-schranz
Copy link
ContributorAuthor

alexander-schranz commentedOct 27, 2018
edited
Loading

@nicolas-grekas did change it to anonymous functions. from my case we can consider it as a new feature, but not sure what to add/change at the documentation because think most people think that the phpunit config variables would also be used in parallel test runs?

Could now reproduce and fix the travis ci bug locally by changing the./phpunit file using the new simple-phpunit binary:

diff --git a/phpunit b/phpunitindex f4b80ed064..e88c75c331 100755--- a/phpunit+++ b/phpunit@@ -11,4 +11,5 @@ if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {     putenv('SYMFONY_PHPUNIT_VERSION=6.5'); } putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');-require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';+require __DIR__.'/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit';

Should we maybe use always the simple-phpunit from repository not from vendor to avoid this kind of problems for contributors?

But can't reproduce the current error its really hard to understand what the travis script does, would be better as a php script that you can run it also locally on all operation systems.

@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch 11 times, most recently fromb95c00c to0a205e8CompareOctober 27, 2018 21:15
@nicolas-grekas
Copy link
Member

Should we maybe use always the simple-phpunit from repository not from vendor to avoid this kind of problems for contributors?

nope, the reason being that we want to use the latest version of the bridge to test the lowest maintained Symfony versions (2.8 for now, so PHP 5.3.3 should still be supported).
At the end of November, 2.8 will be released so that we'll be able to bump the minimum PHP version of the bridge to PHP 5.5.9.

sstok reacted with hooray emoji

if (false !==$value =getenv($name)) {
return$value;
}
global$argv,$argc,$PHP,$getEnvVar;
Copy link
Contributor

Choose a reason for hiding this comment

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

How about passing them as contexts for functions rather than using aglobal ?

theofidry reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@Taluu followed your suggestion and did avoid any usage of global

@Taluu
Copy link
Contributor

@nicolas-grekas Using anonymous functions like that and globalizing their containers (variables) like this, I wonder if using the global function scope wouldn't be better... Or maybe adding a namespace in the simple-phpunit file, to restrict these functions in said namespace could be better ?

theofidry reacted with thumbs up emoji

@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch from17c4180 tode5eaf2CompareDecember 2, 2018 23:08
@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch 2 times, most recently fromd0bb431 tofe4e2baCompareDecember 20, 2018 16:34
@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch 2 times, most recently from7de6e17 tofe9b089CompareJanuary 13, 2019 14:55
@alexander-schranzalexander-schranz changed the titleAdded support for env, server and ini settings in parallel test runsAdd support for env, server and ini settings in parallel test runsJan 14, 2019
@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch fromfe9b089 toef60bdbCompareJanuary 16, 2019 23:00
@alexander-schranz
Copy link
ContributorAuthor

@nicolas-grekas any news to this?

@nicolas-grekas
Copy link
Member

Please rebase.

@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch 3 times, most recently fromcd48c3d to1cebd48CompareJanuary 28, 2019 08:27
@alexander-schranz
Copy link
ContributorAuthor

@nicolas-grekas done.

@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch from1cebd48 tofb08ec5CompareFebruary 6, 2019 22:43
@fabpot
Copy link
Member

@nicolas-grekas I think we're waiting for you here :)

@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch fromfb08ec5 to8a90931CompareMarch 11, 2019 21:38
@alexander-schranz
Copy link
ContributorAuthor

alexander-schranz commentedApr 2, 2019
edited
Loading

@nicolas-grekas if you have time we could have also a look at this at theEU-FOSSA Hackathon

@nicolas-grekas
Copy link
Member

Sure, please rebase meanwhile ;)

@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch from8a90931 tode43901CompareApril 7, 2019 10:09
@alexander-schranzalexander-schranzforce-pushed thebugfix/fixed-env-server-vars-parallel-testsuites branch fromde43901 to07674a4CompareApril 7, 2019 10:18
@fabpot
Copy link
Member

@nicolas-grekas Rebase done ;)

@nicolas-grekas
Copy link
Member

I feel like the expectations implemented by this PR are wrong, here is why:
running this with the originalphpunit doesn't read thephpunit.xml.dist in the subdirectories.

Try running e.g.phpunit src/Symfony/Bundle/FrameworkBundle/ - this doesn't readsrc/Symfony/Bundle/FrameworkBundle/phpunit.xml.dist - thus doesn't read itsbootstrap.php

Running./phpunit src/Symfony/Bundle/FrameworkBundle/ should produce the same result.

Simperfit reacted with thumbs up emoji

@alexander-schranz
Copy link
ContributorAuthor

@nicolas-grekas didn't know that the original phpunit allows to give a folder 🙈 thought that was a symfony only feature. Yeah it definitly make sense that the result then is the same as using the original phpunit file.

@nicolas-grekas
Copy link
Member

Closing as discussed, thanks.

alexander-schranz reacted with thumbs up emoji

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

Reviewers

1 more reviewer

@TaluuTaluuTaluu left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

5 participants

@alexander-schranz@nicolas-grekas@Taluu@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp