Skip to content

Commit 459b8b6

Browse files
committed
minor #13144 No global state for isolated tests and other fixes (nicolas-grekas)
This PR was merged into the 2.3 branch. Discussion ---------- No global state for isolated tests and other fixes | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - By default, phpunit preserves global state for isolated processes. This made the tests break on my laptop. Other tweaks included. In branch 2.5, `src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php` also misses the `@preserveGlobalState disabled` annotation. Please add it when merging Commits ------- 750f3a6 No global state for isolated tests and other fixes
2 parents 4cc4e8a + 750f3a6 commit 459b8b6

File tree

12 files changed

+22
-7
lines changed

12 files changed

+22
-7
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ install:
3838
- if [ "$components" = "no" ]; then COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; fi;
3939

4040
script:
41-
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo "Running {} tests"; phpunit --exclude-group tty,benchmark,intl-data {};'; fi;
42-
- if [ "$components" = "no" ]; then echo "Running tests requiring tty"; phpunit --group tty; fi;
43-
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order 'echo "Running {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install; phpunit --exclude-group tty,benchmark,intl-data;'; fi;
44-
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j50% 'echo "Running {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data;'; fi;
41+
- if [ "$components" = "no" ]; then ls -d src/Symfony/*/* | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
42+
- if [ "$components" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
43+
- if [ "$components" = "high" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
44+
- if [ "$components" = "low" ]; then find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist | sed 's#\(.*\)/.*#\1#' | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.3",
20-
"doctrine/common": "~2.2",
21-
"twig/twig": "~1.12",
20+
"doctrine/common": "~2.3",
21+
"twig/twig": "~1.12,>=1.12.3",
2222
"psr/log": "~1.0"
2323
},
2424
"replace": {

src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
/**
1717
* @runTestsInSeparateProcesses
18+
* @preserveGlobalState disabled
1819
*/
1920
class DefaultCsrfProviderTest extends \PHPUnit_Framework_TestCase
2021
{
@@ -24,6 +25,7 @@ public static function setUpBeforeClass()
2425
{
2526
ini_set('session.save_handler', 'files');
2627
ini_set('session.save_path', sys_get_temp_dir());
28+
ini_set('error_reporting', -1 & ~E_USER_DEPRECATED);
2729
}
2830

2931
protected function setUp()

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* @author Drak <drak@zikula.org>
2121
*
2222
* @runTestsInSeparateProcesses
23+
* @preserveGlobalState disabled
2324
*/
2425
class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase
2526
{

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* @author Drak <drak@zikula.org>
2020
*
2121
* @runTestsInSeparateProcesses
22+
* @preserveGlobalState disabled
2223
*/
2324
class NativeSessionHandlerTest extends \PHPUnit_Framework_TestCase
2425
{

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* @author Drak <drak@zikula.org>
2222
*
2323
* @runTestsInSeparateProcesses
24+
* @preserveGlobalState disabled
2425
*/
2526
class NullSessionHandlerTest extends \PHPUnit_Framework_TestCase
2627
{

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* These tests require separate processes.
2828
*
2929
* @runTestsInSeparateProcesses
30+
* @preserveGlobalState disabled
3031
*/
3132
class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
3233
{

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* These tests require separate processes.
2323
*
2424
* @runTestsInSeparateProcesses
25+
* @preserveGlobalState disabled
2526
*/
2627
class PhpBridgeSessionStorageTest extends \PHPUnit_Framework_TestCase
2728
{

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function testIsActivePhp53()
9696

9797
/**
9898
* @runInSeparateProcess
99+
* @preserveGlobalState disabled
99100
*/
100101
public function testIsActivePhp54()
101102
{
@@ -122,6 +123,7 @@ public function testSetActivePhp53()
122123

123124
/**
124125
* @runInSeparateProcess
126+
* @preserveGlobalState disabled
125127
* @expectedException \LogicException
126128
*/
127129
public function testSetActivePhp54()
@@ -135,6 +137,7 @@ public function testSetActivePhp54()
135137

136138
/**
137139
* @runInSeparateProcess
140+
* @preserveGlobalState disabled
138141
*/
139142
public function testName()
140143
{
@@ -159,6 +162,7 @@ public function testNameExceptionPhp53()
159162

160163
/**
161164
* @runInSeparateProcess
165+
* @preserveGlobalState disabled
162166
* @expectedException \LogicException
163167
*/
164168
public function testNameExceptionPhp54()
@@ -173,6 +177,7 @@ public function testNameExceptionPhp54()
173177

174178
/**
175179
* @runInSeparateProcess
180+
* @preserveGlobalState disabled
176181
*/
177182
public function testId()
178183
{
@@ -197,6 +202,7 @@ public function testIdExceptionPhp53()
197202

198203
/**
199204
* @runInSeparateProcess
205+
* @preserveGlobalState disabled
200206
* @expectedException \LogicException
201207
*/
202208
public function testIdExceptionPhp54()

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* @author Drak <drak@zikula.org>
2020
*
2121
* @runTestsInSeparateProcesses
22+
* @preserveGlobalState disabled
2223
*/
2324
class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase
2425
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy