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

QOL: Should we create a project level config file? #138

Open
almasaeed2010 opened this issue Feb 20, 2019 · 4 comments
Open

QOL: Should we create a project level config file? #138

almasaeed2010 opened this issue Feb 20, 2019 · 4 comments
Assignees

Comments

@almasaeed2010
Copy link
Contributor

almasaeed2010 commented Feb 20, 2019

In multiple of my projects, I tend to change the structure of where my tests should go by default if no path has been specified. Since the majority of my tests go to tests/Feature, I want that to be the default path. However, there isn't currently a way to do this without messing with the script directly. Another use case would be to specify the base class. Since issue #135 is not backwards compatible, we could still make it happen without breaking anyone's tests by adding that as an option in the project level config file.

The file would simply be a JSON file:

.testsuite.json

{
  "base_class": "Tests\\TestCase",
  "base_path": "tests/Feature"
}

We could also easily allow for path options:

{
  "base_path": "tests/Feature",
  "paths": {
    "--unit": "tests/Unit",
    "--core": "tests/tripal",
    "--chado": "tests/tripal_chado"
  }
}

Then, for example, to create a chado importer test:

# Creates a test at tests/tripal_chado/importers/MyTest.php with the proper namespace
tripaltest make:test --chado importers/MyTest

The resulting class would have the namespace:

namespace Tests\tripal_chado\importers;

If no path option is specified, base_path is used as the default or, if not provided, simply use the base tests folder.

Any thoughts? Other options to consider?

@bradfordcondon
Copy link
Member

would we also automatically generate the paths for the phpunit.xml?

I personally don't find this a big deal, i just create the test and move it into the correct subgroup. That doesn't deal with the namespace though. So if you want this feature i say go for it but leave it optional?

@almasaeed2010
Copy link
Contributor Author

phpunit.xml auto traverses sub directories. So no changes needed there.

Yes it would be optional.

@laceysanderson
Copy link
Member

We could also easily allow for path options:

{
  "base_path": "tests/Feature",
  "paths": {
    "--unit": "tests/Unit",
    "--core": "tests/tripal",
    "--chado": "tests/tripal_chado"
  }
}

This looks great :-) As long as it's optional I don't see a downside.

@almasaeed2010
Copy link
Contributor Author

Do you all think the file name should be .testsuite.json? Or do you have a different preference?

@almasaeed2010 almasaeed2010 self-assigned this Feb 20, 2019
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