Skip to content

Issue#2591no2 #2664

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 11 commits into from
Jun 1, 2017
Merged

Issue#2591no2 #2664

merged 11 commits into from
Jun 1, 2017

Conversation

ArturGoldyn
Copy link
Contributor

Use @runClassInSeparateProcess annotation on test class to allow running a test class with process isolation.

This was referenced Apr 29, 2017
@codecov-io
Copy link

codecov-io commented Apr 30, 2017

Codecov Report

Merging #2664 into master will increase coverage by 1.54%.
The diff coverage is 77.55%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master   #2664      +/-   ##
===========================================
+ Coverage     53.85%   55.4%   +1.54%     
- Complexity     2745    2756      +11     
===========================================
  Files           102     102              
  Lines          7193    7218      +25     
===========================================
+ Hits           3874    3999     +125     
+ Misses         3319    3219     -100
Impacted Files Coverage Δ Complexity Δ
src/Framework/TestSuite.php 71.62% <57.14%> (+1.11%) 151 <0> (+2) ⬆️
src/Framework/TestCase.php 56% <80%> (+1.24%) 303 <3> (+7) ⬆️
src/Util/Test.php 88.42% <85.71%> (+0.16%) 194 <2> (+2) ⬆️
src/Util/Configuration.php 84.26% <0%> (+0.43%) 157% <0%> (ø) ⬇️
src/Framework/TestResult.php 48.71% <0%> (+0.93%) 176% <0%> (ø) ⬇️
src/Framework/Constraint/IsEqual.php 92.15% <0%> (+1.96%) 13% <0%> (ø) ⬇️
src/Framework/Constraint/JsonMatches.php 91.11% <0%> (+2.22%) 14% <0%> (ø) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e3c42c...8169eb9. Read the comment docs.

@@ -47,7 +47,12 @@ function __phpunit_run_isolated_test()
$result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests});
$result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests});

$test = new {className}('{methodName}', unserialize('{data}'), '{dataName}');

Choose a reason for hiding this comment

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

Would it make sense to use a new, separate template here? Maybe TestCaseClass.tpl.dist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course, I think so, especially that I've just made changes to TestCaseMethod file.

*
* @var bool
*/
protected $runClassInSeparateProcess;

Choose a reason for hiding this comment

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

Following the minimal visibility principle, this should be private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try that.

@sebastianbergmann sebastianbergmann added the type/enhancement A new idea that should be implemented label May 11, 2017
@sebastianbergmann sebastianbergmann added this to the PHPUnit 6.2 milestone May 11, 2017
@ArturGoldyn
Copy link
Contributor Author

ArturGoldyn commented May 21, 2017

This fails now, probably due to change in sebastian/diff package from 1.4.1 to 1.4.2 https://github.com/sebastianbergmann/diff/

__DIR__ . '/../Util/PHP/Template/TestCaseMethod.tpl'
);
if ($runEntireClass) {
$template = new Text_Template(

Choose a reason for hiding this comment

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

Spaces must be used to indent lines; tabs are not allowed

);
if ($runEntireClass) {
$template = new Text_Template(
__DIR__ . '/../Util/PHP/Template/TestCaseClass.tpl'

Choose a reason for hiding this comment

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

Spaces must be used to indent lines; tabs are not allowed

if ($runEntireClass) {
$template = new Text_Template(
__DIR__ . '/../Util/PHP/Template/TestCaseClass.tpl'
);

Choose a reason for hiding this comment

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

Spaces must be used to indent lines; tabs are not allowed

@ArturGoldyn
Copy link
Contributor Author

@sebastianbergmann template added, variable access changed, and all tests passing.

@sebastianbergmann sebastianbergmann merged commit abf3c61 into sebastianbergmann:master Jun 1, 2017
@sebastianbergmann
Copy link
Owner

Thanks!

@sebastianbergmann sebastianbergmann self-assigned this Jun 1, 2017
@ArturGoldyn ArturGoldyn deleted the Issue#2591no2 branch June 1, 2017 08:54
@KintradimCrux
Copy link

In the current 6.2 release the method TestSuite::createTest() only calls $_test->setRunClassInSeparateProcess() for tests with a data provider.
Can you add this initialization for tests without a data provider, too?

@KintradimCrux
Copy link

And the @beforeClass, @afterclass, setUp() and tearDown() methods maybe should be called only in the isolated environment running the class.

@sebastianbergmann
Copy link
Owner

@KintradimCrux Can you please open tickets for these bugs? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants