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

Adjustment of creation path #3

Open
ghost opened this issue Aug 3, 2020 · 7 comments
Open

Adjustment of creation path #3

ghost opened this issue Aug 3, 2020 · 7 comments

Comments

@ghost
Copy link

ghost commented Aug 3, 2020

Greetings,
I recently decided to use this extension but I came upon a problem the Tests get created in the Wrong Directory.
It would be nice If their was a Setting to choose if tests get generated in the cases folder or not.

@jasonterando
Copy link
Owner

Hi, in VSCode, try the following:

  1. F1, then Preferences: Open Settings (UI)
  2. Filter by "php-tdd"
  3. Switch to Workspace
  4. Down toward the bottom, you should find a setting called "PHP-tdd: Test Subdirectory"

Let me know if that's what you need.

@ghost
Copy link
Author

ghost commented Aug 5, 2020

What I meant is your plugin creates the directory "cases" inside the Test-Subdirectory and wants to delete it and recreate it if it already Exists.

The following screenshot was taken in an empty workspace with a folder "tests/unit" preexisting:

image

What I would love to define is to define my Testdirectory as "tests" and the "cases" folder as unit without overwriting existing files. Which would be pretty ouch in a laravel Project since laravel provides a test folder with subfolders a TestCase.php a Trait that is useable and Example tests.

image

@jasonterando
Copy link
Owner

Gotcha. I'm pulling up the project now and will find out where that happens and fix it. It's been a while since I've looked at this, I need to make some updates to how the extension's unit tests are run, and also deal with some changes in how PHPUnit works (ex. now requires a : void return type on setUp and tearDown functions). Give me a day to dig into this a bit. Thanks for the feedback!

@ghost
Copy link
Author

ghost commented Aug 5, 2020

I looked at the source code myself a bit and the following line is the "devil" in this case.

PHPUtility.mkdirDeep(path.join(unitTestDirectoryPath, 'cases'));

@jasonterando
Copy link
Owner

Yah, the part above that (the bit with "rimraf" in it) basically says "if they set something else up for unit testing, clear it out because I know what's right"... I'm not sure what I was thinking there, other than fear of bumping into a phpunit.xml or something that didn't play nice with what I was doing. I'm fixing that now, along with making sure I don't overwrite phpunit.xml, etc. if those files are already there. I'm also updating my template for the unit test and default phpunit.xml to be compatible with current phpunit.xml.

@jasonterando
Copy link
Owner

Hi, I've posted an update, 0.0.6. If the configured test directory contains a phpunit.xml there already, it leaves it alone, and bases test off of PHPUnit's TestCase. If there is not a phpunit.xml, it will create a new one and put in it's own BaseTestCase class. I haven't tested this a lot yet, but if you want to take a look and let me know if I'm on the right track, I'd be obliged. Thanks.

@ghost
Copy link
Author

ghost commented Aug 7, 2020

Sadly no I have the Updated plugin and after trying it it still wanted to delete my folder.

So I locked into the code of the extension that was installed and it does not seem like the compiled code got updated.

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

1 participant