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

PHPUnit, MakeGood, Luna and Composer #68

Open
shaundodimead opened this issue Sep 22, 2014 · 4 comments
Open

PHPUnit, MakeGood, Luna and Composer #68

shaundodimead opened this issue Sep 22, 2014 · 4 comments
Labels

Comments

@shaundodimead
Copy link

Hi there,

I've got phpunit coming down into my workspace via composer, and i'm struggling to get MakeGood to recognise the vendor/autoload.php. I've put that in the prepare scripts and occasionally tests will run, but MakeGood still complains it can't find the PHP Unit classes.

What should I set the include path to include, when using vendor/ phpunit?

A bit more reading today suggests maybe I need to put the vendor/autoload in the phpunit.xml? How does MakeGood resolve the PHP unit classes?

Sorry if this is RTFM, but I couldn't find any examples of PHPUnit via composer - a lot of examples via PEAR.

Shaun

@shaundodimead
Copy link
Author

Actually the previous post on inspection (relating to Joomla) talks about Composer phpunit, but doesn't require include libraries - and implies that MakeGood isn't generating the errors i'm seeing

Perhaps it's my prepare script, which isn't locating vendor/autoload.php, i'll try tonight with the other posters suggested one

@shaundodimead
Copy link
Author

screenshot from 2014-09-22 21 58 00

It's weird, sometimes makegood will actually run the tests, but keeps telling me that it cant find the class, and the tests wont show in the test outline, but i can hit play on makegood and it'll do it. I have nothing in my include path, only require vendor/autoload.php in my prepare script.

Thoughts?

@shaundodimead
Copy link
Author

Okay - I downloaded a matching PHAR to the code composer is pulling and put that PHAR in the lib path and everything works now. I assume the problem is specifying the correct include paths (Eclipse doesn't include subdirs right?) when composer drags down the unbundled stuff. I'm not enough of an expert in this stuff to make any further suggestions! I guess MakeGood was working before because phpunit's external calls were but the internal stuff wasn't

@iteman
Copy link
Member

iteman commented Oct 10, 2014

A typical content of the preload script would be as the following:

tests/bootstrap.php:

<?php
error_reporting(E_ALL);

$loader = require dirname(__DIR__) . '/vendor/autoload.php'; /* @var $loader \Composer\Autoload\ClassLoader */
$loader->addPsr4('Foo\Bar\\', __DIR__); // for classes in the tests directory

Also, the vendor directory should be added to the PHP build path for your Eclipse project.

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

No branches or pull requests

2 participants