Skip to content
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

Phar distrib cannot be used with phing PHPUnitTask #1924

Closed
llaville opened this issue Oct 21, 2015 · 11 comments
Closed

Phar distrib cannot be used with phing PHPUnitTask #1924

llaville opened this issue Oct 21, 2015 · 11 comments

Comments

@llaville
Copy link

Sebastian,

Consider the phing PHPUnitTask used with the phar distrib of PHPUnit (I've tested myself with phing 2.12 and phpunit 5.0.6). I've opened a ticket 1222 on Phing.

The conflict origin issue came from the phar-stub you used and only require instead of require_one

E.g: rather than

require 'phar://phpunit-5.0.6.phar' . '/myclabs-deep-copy/DeepCopy/DeepCopy.php';

replace it by

require_once 'phar://phpunit-5.0.6.phar' . '/myclabs-deep-copy/DeepCopy/DeepCopy.php';

Thanks in advance to consider this change.

BTW, could you also consider to publish a phar distrib without the shebang (#!/usr/bin/env php)

Laurent

@sebastianbergmann
Copy link
Owner

Are you telling me that Phing is not invoking PHPUnit in a separate process but inside its own?

@llaville
Copy link
Author

I'm telling you that Phing through the PHPUnitTask invoke PHPUnit resources as it was only a phar archive with only libs to call when needed.
That meens, when calling PHPUnitTask twice (at least), Phing has already loaded PHPUnit resources libs, and stopped without any errors.

@sebastianbergmann
Copy link
Owner

If Phing does not invoke PHPUnit in a separate process then Phing is doing something stupid. Sorry for using such a harsh word.

@llaville
Copy link
Author

Why not just thinking to use require_one instead of require to load PHPUnit resources ?
Is there something I don't see that may produces errors on PHPUnit usages ?
Sorry to ask a simple question !

@sebastianbergmann
Copy link
Owner

This could be as simple as require vs. require_once. But since I don't how Phing's PHPUnit Task extends PHPUnit's test runner (and why) I cannot possibly know for a fact that there are no other problems stemming from the fact that PHPUnit is used in a way it is not meant to be used.

I created #1925 to track the development of a library-only PHAR distribution of PHPUnit.

If you, or the Phing developers, tell me that such a library-only PHAR that uses require_once instead of require would make you happy then I will implement that.

@llaville
Copy link
Author

Thanks :)

@sebastianbergmann
Copy link
Owner

Can you check whether 3dffc9f works for you?

@llaville
Copy link
Author

Sorry Sebastian, but I can't do it now (at work). And to be honest with you, I've rebuild your phar 5.0.6 distrib from an "horrible" method ( extract phar, add new stub with require_once, and sheband ) and then rebuild project with box.json config from https://github.com/box-project/box2

@sebastianbergmann
Copy link
Owner

Just clone PHPUnit's repository from GitHub and then ant phar.

@sebastianbergmann
Copy link
Owner

Discussion moved to #1925.

@theseer
Copy link
Collaborator

theseer commented Oct 22, 2015

Out of pure curiosity: Why would anyone still need require_once when there is autoloading?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants