PHPunit #3675
Replies: 22 comments
-
You need to have the database up and running to run the tests against it. It might take a little tweak to do that from PhpStorm in this case. I think you need to configure bootstrap file path and configuration file as well. I might need to add a wiki page on this once you confirm that it works for you.
|
Beta Was this translation helpful? Give feedback.
-
is the CLI command that I have correct? |
Beta Was this translation helpful? Give feedback.
-
Sorry to be daft. Where do I need to add the bootstrap file path to? |
Beta Was this translation helpful? Give feedback.
-
I don't have it open here directly but my PhpStorm version has this option int he run configuration. I think it is a way to load composer dependencies before running the test. So if you add run configurations for PHpUnit in PHPStorm you should have this file picker for bootstrap? Or if not can you send a screenshot of that run config |
Beta Was this translation helpful? Give feedback.
-
So basically I installed phpunit using composer and then run the test using that installed version . I didn't install it system wide as it seemed to not work for other reasons. |
Beta Was this translation helpful? Give feedback.
-
It should definitely be PhpUnit. |
Beta Was this translation helpful? Give feedback.
-
OK, let me go that route. I'm using Eclipse, but it should be the same idea. I installed it on my test server and was attempting to run the unit tests through the CLI. I haven't had very good luck getting things like xdebug and such to work from eclipse because I'm not running my code from the same system that I modify the code on. That said, I'll give it a shot and see what I get. |
Beta Was this translation helpful? Give feedback.
-
You can try to copy the setup from the Dockerfile itsel I think it chdir's to the application/tests and then runs phpunit from there |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
hmmm. I think there are missing pieces to my puzzle. I have not used docker or composer before. I think I need to go learn those first. I don't really want to switch to PHPStorm. The $200 per year doesn't make sense to me when Eclipse is free. That and Eclipse has more language compatibility than PHPStorm, and I write code in more than just PHP. |
Beta Was this translation helpful? Give feedback.
-
Eclipse, it appears, won't work for me running unit tests unless I switch to a completely contained environment within Windows rather than writing code stored on the server from my box in eclipse. The downside is that when I'm trying to test optimizations, and code changes, the environment isn't identical, so what might fly on my box, won't on the production server. |
Beta Was this translation helpful? Give feedback.
-
If I run
|
Beta Was this translation helpful? Give feedback.
-
The Bootstrap.php file has
|
Beta Was this translation helpful? Give feedback.
-
Ok I think I might be able to arrange a license for you. |
Beta Was this translation helpful? Give feedback.
-
I guess you will need to install the libraries using composer. |
Beta Was this translation helpful? Give feedback.
-
@jekkos that is kind of you. Let me play around with composer to see if I can get it to install the necessary components to run phpunit from the CLI on my server. Even though that isn't integrated with my IDE, it would at least allow me to run unit tests and therefore confirm that tests that I write are working properly. |
Beta Was this translation helpful? Give feedback.
-
OK I'll renew the yearly license now and ask for one more. Currently it's me, @daN4cat and @WebShells that use a free license. Let's see how that goes. |
Beta Was this translation helpful? Give feedback.
-
OK request for renewal was made. I try to get 5 licenses this time. You'll get access to all the products from Jetbrains for one year at least. |
Beta Was this translation helpful? Give feedback.
-
Nice! Is this something that Jetbrains has for opensource projects? |
Beta Was this translation helpful? Give feedback.
-
@objecttothis yes indeed only if the project does not generate an steady income stream. I have requested to renew the licenses already but they won't do that until august, so we'll have to keep working with 3 for the time being. |
Beta Was this translation helpful? Give feedback.
-
[email protected]. Really my only reason for using PHPStorm would be running a local environment to do unit testing. If I can get composer installed and unit testing working in the CLI on my current remote environment then I can give the license back. Then again, if they give us 5 licenses in August, that's less than a month from now. It might be helpful to make a phase I plan for unit testing to be implemented for 3.4.0. Perhaps list the unit tests that are most important and divide those up? |
Beta Was this translation helpful? Give feedback.
-
I have sent you the invite for the license pack, I think you can now claim it and link it to your jetbrains account. Good idea on making a small overview here. Currently there a not a lot but i think that having functionality like taxes etc tested would require a bit of a time investment. |
Beta Was this translation helpful? Give feedback.
-
@jekkos I've got PHPunit 8.5.2 installed and trying to run it from the command line. If I navigate to /applications/ then run
phpunit tests
I just get:PHPUnit 8.5.2 by Sebastian Bergmann and contributors.
and no output. It does not appear to run the unit tests that you wrote. Am I missing something here?
Beta Was this translation helpful? Give feedback.
All reactions