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

Patchwork warning when included in PHPUnit bootstrap #38

Closed
cmounce opened this Issue Feb 19, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@cmounce

cmounce commented Feb 19, 2016

I have a PHPUnit bootstrap file that looks like this:

<?php
require_once('./vendor/antecedent/patchwork/Patchwork.php');
require_once('./vendor/autoload.php');
// other stuff...

Patchwork is the first file included. But when I run "phpunit" from the command line, I get the message:

PHP Warning: Please import Patchwork from a point in your code where no user-defined function, class or trait is yet defined. composer\autoload\includefile() and possibly others currently violate this. in /home/cmounce/Documents/patchwork-phpunit/vendor/antecedent/patchwork/Patchwork.php on line 93

This is happening with Patchwork 1.4.1. Both PHPUnit and Patchwork are Composer dependencies of the project:

{
    "require-dev": {
        "phpunit/phpunit": "^4.8",
        "antecedent/patchwork": "1.4.1"
    }
}
@bswatson

This comment has been minimized.

Show comment
Hide comment
@bswatson

bswatson Feb 21, 2016

Running into this same problem as well. Switched back to 1.4 until this is cleared up.

This appears to have been introduced by the changes related to #36.

bswatson commented Feb 21, 2016

Running into this same problem as well. Switched back to 1.4 until this is cleared up.

This appears to have been introduced by the changes related to #36.

antecedent added a commit that referenced this issue Feb 22, 2016

@antecedent

This comment has been minimized.

Show comment
Hide comment
@antecedent

antecedent Feb 22, 2016

Owner

I apologize for still not having documented this, but this can be remedied by creating a patchwork.json with the following contents:

{
    "suppress-warnings": [
        "composer*"
    ]
}

Version 1.4.2, which is now live, simply includes this setting by default.

Owner

antecedent commented Feb 22, 2016

I apologize for still not having documented this, but this can be remedied by creating a patchwork.json with the following contents:

{
    "suppress-warnings": [
        "composer*"
    ]
}

Version 1.4.2, which is now live, simply includes this setting by default.

@cmounce

This comment has been minimized.

Show comment
Hide comment
@cmounce

cmounce Feb 23, 2016

Awesome! Thanks for the fast turnaround time in fixing this issue!

cmounce commented Feb 23, 2016

Awesome! Thanks for the fast turnaround time in fixing this issue!

@cmounce cmounce closed this Feb 23, 2016

@ericmann

This comment has been minimized.

Show comment
Hide comment
@ericmann

ericmann Feb 24, 2016

Hmm ... I added the patchwork.json file with those contents and, using 1.4.2, still see the warnings repeatedly. This breaks headless execution via tools like Travis and I still have to roll back to 1.4.0 to get things to work right. Any other thoughts?

ericmann commented Feb 24, 2016

Hmm ... I added the patchwork.json file with those contents and, using 1.4.2, still see the warnings repeatedly. This breaks headless execution via tools like Travis and I still have to roll back to 1.4.0 to get things to work right. Any other thoughts?

@antecedent

This comment has been minimized.

Show comment
Hide comment
@antecedent

antecedent Feb 24, 2016

Owner

@ericmann: for a quick fix, you can always take the {"suppress-warnings": ["*"]} route. However, Patchwork is probably having problems with a different method/function here; its name should show up in the warnings. If it's one that's a part of a usual testing setup, please make a pull request to include it in the default patchwork.json.

Owner

antecedent commented Feb 24, 2016

@ericmann: for a quick fix, you can always take the {"suppress-warnings": ["*"]} route. However, Patchwork is probably having problems with a different method/function here; its name should show up in the warnings. If it's one that's a part of a usual testing setup, please make a pull request to include it in the default patchwork.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment