-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
phpunit wont execute (no errors) #1030
Comments
Do you get any output at all? |
Well, I have since found the following will work
It seems that the install of PHPUnit is either not using some phpunit.xml file (not sure where it is looking) |
Leaving off the --color option for example, wont show colors and the without --debug option doesnt show much of anything? And I have to run each test manually (when there are in fact two different test files in the tests folder) |
PHPUnit will look for an XML configuration file in the following places (ordered by precedence):
|
Well, in my PWD, this is the phpunit.xml file and it is definitely NOT being used?
This is the result of what happens when I call it
How can I find out which version of phpunit.xml is really being used? |
The |
@mikeerickson what do you get when you run |
@sebastianbergmann: If you look at the last command he executed, you can see that he is getting some sort of error:
|
@mikeerickson My guess is your PHP configurations are preventing whatever error is being raised from printing to stderr. Most likely there is a fatal error in some of the code you are trying to test. |
But, if I execute this code with the full path it works?
../../vendor/bin/phpunit --colors --debug ExampleTest.php
This is what has me puzzled. This snippet is the ONLY way I can get it to fire correctly. And then the code executes with no errors (has colors etc) If I omit the --colors flag, then the output does not have the colors. |
@whatthejeff And yes, I am receiving an error of 255 when I call echo $?
$ echo $?
255
It seems that either the path is messed up and/or the |
The other part that seems strange is I am unable to execute all tests in the current directory. I have to execute each one manually? As I recall, PHPUntil will test all files? Is there a command line option to execute all test files in the current directory? I can clearly workaround this by creating an alias to the command that works, but having to execute each test manually can get cumbersome. Again, the only way I can get the tests to work is to set the current directory to /app/tests/ and execute:
../../vendor/bin/phpunit --colors --debug ExampleTest.php
Thanks for your efforts, this is surely some odd use case but I cant figure out where to "fix" things. |
@mikeerickson Would you mind providing us with the output from |
Keep in mind that this directory does not include your |
Here is the grep error report
mikee at Traveller in /Applications/MAMP/htdocs/laravel-rest on master*
$ vendor/bin/phpunit
mikee at Traveller in /Applications/MAMP/htdocs/laravel-rest on master*
$ php -i | grep error
display_errors => Off => Off
display_startup_errors => Off => Off
error_append_string => no value => no value
error_log => /Applications/MAMP/logs/php_error.log => /Applications/MAMP/logs/php_error.log
error_prepend_string => no value => no value
error_reporting => 32767 => 32767
html_errors => Off => Off
ignore_repeated_errors => Off => Off
log_errors => On => On
log_errors_max_len => 1024 => 1024
track_errors => Off => Off
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
|
where should I have a phpunit.xml file located to assume this would work? I can surely move one there ;-) |
I do have a phpunit.xml located in the main application directory (in my case, it is called laravel-rest)
total 57752
drwxr-xr-x 21 mikee staff 714 Oct 16 16:52 .
drwxrwxrwx@ 158 mikee admin 5372 Oct 13 11:22 ..
-rw-r--r--@ 1 mikee staff 21508 Oct 17 12:45 .DS_Store
drwxr-xr-x 15 mikee staff 510 Oct 17 17:42 .git
-rw-r--r-- 1 mikee staff 17 Oct 15 10:34 .gitignore
-rw-r--r-- 1 mikee staff 9804714 Oct 16 16:47 .tags
-rw-r--r-- 1 mikee staff 9804714 Oct 16 16:47 .tags_sorted_by_file
-rw-r--r-- 1 mikee staff 145 Jul 30 07:05 CONTRIBUTING.md
drwxr-xr-x 17 mikee staff 578 Oct 11 17:48 app
-rwxr-xr-x 1 mikee staff 2424 Jul 30 07:05 artisan
drwxr-xr-x 5 mikee staff 170 Jul 30 07:05 bootstrap
-rw-r--r-- 1 mikee staff 733 Oct 17 13:22 composer.json
-rw-r--r-- 1 mikee staff 89577 Oct 17 13:21 composer.lock
-rw-r--r-- 1 mikee staff 1072 Oct 8 12:02 httpVer.js
-rw-r--r-- 1 mikee staff 566 Jul 30 07:05 phpunit.xml <----- this one
drwxr-xr-x 8 mikee staff 272 Oct 7 12:05 public
-rw-r--r-- 1 mikee staff 1795 Jul 30 07:05 readme.md
-rw-r--r-- 1 mikee staff 954 Oct 8 12:01 restVer.js
-rw-r--r-- 1 mikee staff 519 Jul 30 07:05 server.php
-rw-r--r-- 1 mikee staff 9804714 Oct 16 16:52 tags
drwxr-xr-x 24 mikee staff 816 Oct 17 12:45 vendor
|
Alright, it seems the error is written to |
And here is the contents of the phpunit.xml file (should this exists somewhere else)
|
Here you go :-)
|
Oops, some of that stack trace is missing. How about |
|
Thanks, @mikeerickson. So here's your problem:
|
So it seems like your |
Is this something that I should be installing myself? I am under the impression that class already exists as part of Laravel? Hmmm? |
As expected, it is included in the base Laravel package
http://four.laravel.com/docs/testing
|
At this point, I am going to start over (remove the package that was installed by composer) It seems to me, PHPUnit comes installed by default, thus I am not entirely sure WHY I would need to install the composer package
"require-dev": {
"phpunit/phpunit": "dev-hhvm"
},
|
We try to use GitHub more for bug tracking than support–especially with 3rd-party libs. I can tell you that this is not a PHPUnit problem. I don't really know anything about Laravel or Mockery, but I would try adding Mockery to your Also, I would suggest not using the |
Thanks for your time, I am quite confused at this point.... I know I have used PHPUnit in the past and it worked no problem. Only "slight" variable here is that I am running on Mavericks GM (I dont expect it to be a problem?) |
I have changed to use |
Final question, is this required:
You need to install phpunit and the best way is with pear.
It indicates that with the package installed via Composer, these tasks are NOT required? I found these notes on stackoverflow |
I think it's more likely that Mockery is simply not installed. You can always check your |
Sounds good my friend, again thanks! I will do the necessary research on Mockery.... |
Our current install instructions can be found here: http://phpunit.de/manual/current/en/installation.html Phar is actually the simplest install method at the moment–though composer is also very popular these days. I would not really say that any method is the "best" though. |
No problemo :) |
OK, I am back for some more abuse today... I have all the dependency issues resolved (have Mockery installed and working and am VERY close to having this whole thing working). Now, when I call phpunit, I receive the following: PHPUnit 3.7.28 by Sebastian Bergmann. Configuration read from /Applications/MAMP/htdocs/laravel-rest/phpunit.xml But no tests are run... I can still execute a test manually phpunit ./app/tests/ExampleTest.php and all is wonderful... So, final question seems to be, why is PHPUnit not running the test automatically? Here is the contents of the phpunit.xml that is being used
And, if you want the error log:
|
Looks like you are getting a new fatal error:
|
Thx for pointing that out... After look at that code issue, it lead me to two other issues that failed (and I learned how to really read the log file) I am now in OPERATION! Thanks again for your patience, been a big help and is greatly appreciated (not like those pesky folks in the RoR arena) |
No problem, my friend :) Enjoy! |
Followed the installation instructions (I have had this working before in another project but try a new install). Seems I have PHPUnit install
laravel-rest/vendor/phpunit/phpunit/phpunit
which is pointed to by an symlink in vendor/bin
phpunit -> ../phpunit/phpunit/composer/bin/phpunit
regardless, running vendor/bin/phpunit, nothing happens (No errors etc) just like the command runs but does nothing.
As stated, I have had this working in other projects, but this one has me a bit stumped?
The text was updated successfully, but these errors were encountered: