Why can't we support the simple workflow
cd drush
composer install --dev
php vendor/phpunit/phpunit/phpunit.php
?
We need composer: drush dl composer
We need to run composer: drush composer install --dev
Open Issues
We need to run phpunit from the project directory
- move phpunit.xml.dist to drush root
- configure it differently
We need a database
- Why not set sqlite as default?
Original
Puzzled by #1841324-8: Requiring php 5.3.5 for Drush is premature
If the test suite passes, I'm OK
so I checked the project https://drupal.org/project/drush/testing-status page which has 'way back' testing result so that's not how drush does it.
Next to discover the drush project page tells about Travis integration which is cool but does it on commit.
Why not add the following to the project page:
To test your patch locally install the drush composer
Next rundrush composer install --dev
It needs some more commands as I failed to get the tests running :(
Attached patch is a first shot which obviously needs work.
Comments
Comment #1
clemens.tolboomFrom IRC joestewart wrote
That helps :) (doh)
Comment #2
clemens.tolboomRunning from the project directory seems to be the main problem
Failure:
Better:
give output like
(argh)
Comment #3
clemens.tolboomIt all comes down to rtfm. Attached patch makes the pain go away a little.
But I hope we get the information on the project page more clearly.
An improvement would be to default to a sqlite database.
I normally do
That works because the phpunit.xml.dist is in the project root and configured to point to the tests/ directory.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedPlease pay close attention to the tests/README.txt. It mentions: 'From the /tests subdirectory, run `phpunit .`. Now you need this line: "Review the configuration settings in phpunit.xml.dist. If customization is needed, copy and rename to phpunit.xml and edit away."
I just committed a couple enhancements to the README so it is easier to find our test suite.
Comment #4.0
moshe weitzman CreditAttribution: moshe weitzman commentedUpdated issue summary.
Comment #5
clemens.tolboomThis is still a feature request then.
I added composer.json --dev switch which ease the burden to install anything.
Comment #6
clemens.tolboomInstalling PHPUnit the old way is a pitb. Using composer is not.
Current patch sets version to the version from the README.txt:
>=3.5
By using composer install --dev we get a newer version. It brings in a newer yaml v2.2.2 which is not good I guess as /lib contains v2.2.1
[edit]added v2.2.1[/edit]
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedI'm not sure why we would add a new dependency on Drush Composer. Isn't composer enough? And if so, shouldn't composer based install be an additional install method. Ther eis also the PHAR option. Not sure how to proceed here. See http://phpunit.de/manual/current/en/installation.html#installation
Comment #8
clemens.tolboomThere is only a ease of use dependency on drush composer. Composer is good enough.
But the installation is now almost a no-brainer instead of a battle with pear, apt-get and the likes.
So I prefer the
drush dl composer
but maybe just add a link to http://getcomposer.org would do?(or am I missing a point?)
Comment #9
moshe weitzman CreditAttribution: moshe weitzman commentedThe issue is, we already recommend that folks install drush via PEAR. maybe we should deemphasize pear completely and go with Composer for both drush and phpunit? I'll ask MarkS to chime in.
Comment #10
saltednut+1 for this practice. K.I.S.S.
Comment #11
msonnabaum CreditAttribution: msonnabaum commentedI don't think this is necessary. It's not difficult to install phpunit via pear.
Also, I strongly dislike encouraging the use of drush composer. Composer is already pretty simple to use, there's no reason we should hide it's native interface from users.
Comment #12
clemens.tolboomI completely disagree with installing through PEAR is a no-brainer. I had it working on OS X 10.5/6/7 not on 10.8 and stopped trying. I have more PHP projects depending on different versions of phpunit or other 'alien' packages. Running
composer install --dev
works like a charm with those project.With composer we can tell what exact versions we decide drush should use for runtime or development. With that option it doesn't matter anymore what my system wide version is of component xyz.
I even think we should move Yaml + Console Table from lib to vendor and make it properly registered through composer.json. That would be in line with Core 8 packaging Symfony and other components.
Note that this DEV stuff depends on http://phpunit.de/manual/current/en/installation.html
and
Keep in mind that when we make the on-boarding experience for Drush development easier it's a win-win. (I myself am running drush test now for the first time due to this patch)
Comment #13
helmo CreditAttribution: helmo commentedI see composer as an improvement. Having it system wide would be 'nice', but complicates instructions. As the with the current README. It says
Sure apt-get should be on any system ;) but the truth is... This is less OS dependant and does not require root privileges.
my 2 cents...
Comment #14
clemens.tolboomXREFs
- #1316322: Add PSR-0 autoloader to drush
- #1792550: Facilitate installing via Composer.
Comment #15
greg.1.anderson CreditAttribution: greg.1.anderson commentedI agree that composer is more straightforward than pear. I know how to install via pear, and update / fix problems with pear, but still, every now and then I have to check the docs do a little magic dance before the little pear pony will jump through its hoop. I suspect that composer install will reduce the aggregate fiddling that the community needs to do.
My vote would be to fix per #7.
Comment #16
msonnabaum CreditAttribution: msonnabaum commentedTo clarify, I mostly object to any docs that suggest using drush composer rather than just composer itself. If we want to just add it as a dev dependency, and tell people to run vendor/bin/phpunit, I'm fine with that.
Comment #17
clemens.tolboomI've rewritten the README from a novice perspective.
Comment #18
saltednutHow about promoting some best practices here? Someone who is new will also likely be looking for quick answers - why would someone do something "the novice way" instead of "the quick way" and what's the difference? Finally, "the hard way" - as Mark pointed out, its not that hard and the next line it says "installing with PEAR is easiest"
I don't mean to be rude but if I came across this doc I'd be angry and confused.
Comment #19
greg.1.anderson CreditAttribution: greg.1.anderson commentedI don't think we need to document three ways to install phpunit; if the getcomposer technique works cross-platform, let's just document that.
Comment #20
saltednutComment #21
clemens.tolboomHmmm ... I missed #16
which is in line with #19.
That means we can drop the hard way. Which is completely broken on my hand installed, then homebrew-ed broken env. So I like the composer way.
What I like about multiple ways is people interested in testing will probably try the novice way first. That would be a great 'on-boarding experience' I hope.
Regarding #18
I missed that sentence completely.
I unassigned as I'm over my head with issues (as we all are).
Comment #22
clemens.tolboomComment #23
moshe weitzman CreditAttribution: moshe weitzman commentedLets recommend only one way to install phpunit, using composer (not drush composer).
Comment #24
clemens.tolboomEhm ... where is 'drush composer' in latest patch?!?
Comment #25
moshe weitzman CreditAttribution: moshe weitzman commentedSorry was looking at interdiff by accident.
min php version has changed per #1841324: Requiring php 5.3.5 for Drush is premature. That might explain why the patch no longer applies.
Comment #26
helmo CreditAttribution: helmo commentedHere's a re-roll.
Comment #27
moshe weitzman CreditAttribution: moshe weitzman commentedcommitted
Comment #28.0
(not verified) CreditAttribution: commentedFixed code block