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

Add a test to check Infection works with PSR-0 compliant autoloader #579

Merged
merged 3 commits into from Dec 15, 2018

Conversation

maks-rafalko
Copy link
Member

@maks-rafalko maks-rafalko commented Nov 25, 2018

Related to #564


hmm.. E2E tests, wrapped by PHPUnit fails because it alwayse requires psr4 autoloader. Will have to fix it.

autloading to e2e tests

namespace PSR_0_Autoloader;

class SourceClass
Copy link
Member

@sanmai sanmai Nov 26, 2018

Choose a reason for hiding this comment

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

That's just as same as the current PSR-4. I think if test best to test a really old-style Namespace_Class_Name style project.

For example, I could not run Infection on pear/OLE. It gives:

Processing source code files: 4/7
In CodeCoverageClassIgnoreVisitor.php line 63:
                                 
  Class OLE_Test does not exist  

Even though composer.json has all relevant definitions:

"autoload-dev": {
    "psr-0": {
        "OLE": "tests/"
    }
},

I even made a simple test to verify that indeed composer picks up OLE_Test:

class OLE_AutoloadTest extends PHPUnit_Framework_TestCase
{
    public function testOtherTestExists()
    {
		$this->assertTrue(class_exists(OLE_Test::class));
    }
}

On subsequent runs, for some very interesting reason:

In JsonValidationException.php line 51:
                                                                                            
  "OLE/infection.json.dist" does not match the expected JSON schema:  
   - source.excludes : Object value found, but an array is required                         

The last error possibly related to these configuration steps:

Any directories to exclude from within your source directories?: tests
Any directories to exclude from within your source directories?: coverage
Any directories to exclude from within your source directories?: build
Any directories to exclude from within your source directories?: vendor
Any directories to exclude from within your source directories?: 

infection.json has this:

 "excludes": {
     "0": "vendor",
     "1": "tests",
     "3": "coverage",
     "4": "build"
 }

Filed #580

Copy link
Member

Choose a reason for hiding this comment

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

Actually, that's not an unknown issue with "Class OLE_Test does not exist", just #576

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, that's not an unknown issue with "Class OLE_Test does not exist", just #576

ok, I'm merging this one since it's not related to any issue, this is only a new test

@maks-rafalko maks-rafalko merged commit d5e5eb2 into master Dec 15, 2018
@ghost ghost removed the Needs Review label Dec 15, 2018
@maks-rafalko maks-rafalko deleted the psr-0-test branch December 15, 2018 06:20
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

Successfully merging this pull request may close these issues.

None yet

2 participants