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

Directory collector #65

Closed
theofidry opened this issue Apr 30, 2016 · 5 comments
Closed

Directory collector #65

theofidry opened this issue Apr 30, 2016 · 5 comments

Comments

@theofidry
Copy link
Contributor

Actually before jumping into a "directory collector" a question comes: why excluding the test(s) folder? I would say everything in src should not depend on what is in tests.

@slde-flash
Copy link
Contributor

what exactly do you mean by excluding the tests folder ?
i just excluded the tests folder in the example - this highly dependends on on you usage.

it's totally fine to write a depfile that ensures that files in (for exampe) the tests folder must not depend on other files in another folder (layer).

@theofidry
Copy link
Contributor Author

it's totally fine to write a depfile that ensures that files in (for exampe) the tests folder must not depend on other files in another folder (layer).

Ok then what I would wish in that case is defining as a layer all classes under my tests folder for example. The issue is that not every test class is identifiable as a one by its namespace:

src/
  \-- Acme/
       \-- Dummy.php
tests/
  |-- PHPUnit/
  |-- Prophecy/
  \-- Acme/
       \-- DummyTest.php

@slde-flash
Copy link
Contributor

feel free to contribute a collector for this usecase, it should be very simple.

i didn't tested it, but the implementation should look like this:

class DirectoryCollector implements CollectorInterface {
// ....
    public function satisfy(
        array $configuration,
        AstClassReferenceInterface $abstractClassReference,
        // ...
    ) {
        return preg_match(
            '/'.$this->getRegexByConfiguration($configuration).'/i',
            $abstractClassReference->getFileReference()->getFilepath(),
            $collectorFactory
        );
    }

@theofidry
Copy link
Contributor Author

I'll try when I'll have a hand free for code contribution :)

@smoench
Copy link
Contributor

smoench commented Mar 1, 2018

It has been merged with PR #147.

Thanks @MarvinKlemp, @jkuchar and @timglabisch

@smoench smoench closed this as completed Mar 1, 2018
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