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

phpunit wont execute (no errors) #1030

Closed
mikeerickson opened this issue Oct 17, 2013 · 39 comments
Closed

phpunit wont execute (no errors) #1030

mikeerickson opened this issue Oct 17, 2013 · 39 comments

Comments

@mikeerickson
Copy link

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.

"require-dev": {

"phpunit/phpunit": "3.7.27"

},

As stated, I have had this working in other projects, but this one has me a bit stumped?

@whatthejeff
Copy link
Contributor

Do you get any output at all?

@mikeerickson
Copy link
Author

Well, I have since found the following will work

  1. Move to /app/tests directory
  2. Execute following

$ ../../vendor/bin/phpunit --colors --debug ExampleTest.php

It seems that the install of PHPUnit is either not using some phpunit.xml file (not sure where it is looking)

@mikeerickson
Copy link
Author

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)

@whatthejeff
Copy link
Contributor

PHPUnit will look for an XML configuration file in the following places (ordered by precedence):

  1. A path specified using the --configuration switch.
  2. A file named phpunit.xml in the current working directory.
  3. A file named phpunit.xml.dist in the current working directory.

@mikeerickson
Copy link
Author

Well, in my PWD, this is the phpunit.xml file and it is definitely NOT being used?

$ cat phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="bootstrap/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
>
    <testsuites>
        <testsuite name="Application Test Suite">
            <directory>./app/tests/</directory>
        </testsuite>
    </testsuites>
</phpunit>

This is the result of what happens when I call it

$ phpunit
-bash: phpunit: command not found
mikee at Traveller in /Applications/MAMP/htdocs/laravel-rest on master*
$ ll
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 13:51 .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
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
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*
$ echo $?
255

How can I find out which version of phpunit.xml is really being used?

@sebastianbergmann
Copy link
Owner

The phpunit: command not found error message clearly tells you what is going on: you do not have phpunit in your $PATH.

@whatthejeff
Copy link
Contributor

@mikeerickson what do you get when you run php -i | grep error?

@whatthejeff
Copy link
Contributor

@sebastianbergmann: If you look at the last command he executed, you can see that he is getting some sort of error:

$ vendor/bin/phpunit
mikee at Traveller in /Applications/MAMP/htdocs/laravel-rest on master*
$ echo $?
255

@whatthejeff
Copy link
Contributor

@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.

@mikeerickson
Copy link
Author

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.

@mikeerickson
Copy link
Author

@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 phpunit.xml file is either not used (or my thinking not found)

@mikeerickson
Copy link
Author

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.

@whatthejeff
Copy link
Contributor

@mikeerickson Would you mind providing us with the output from php -i | grep error? If PHP exits with 255, then for sure there is an error. The reason you can't see this error is likely related to your PHP configurations. If you would provide the output from this command, it would be much easier for us to help :)

@whatthejeff
Copy link
Contributor

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

Keep in mind that this directory does not include your phpunit.xml file which means that your bootstrap/autoload.php file is not being included. This is probably why you don't get the fatal error when you run the tests in this way.

@mikeerickson
Copy link
Author

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

@mikeerickson
Copy link
Author

where should I have a phpunit.xml file located to assume this would work? I can surely move one there ;-)

@mikeerickson
Copy link
Author

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

@whatthejeff
Copy link
Contributor

Alright, it seems the error is written to /Applications/MAMP/logs/php_error.log. Would you mind providing us with the result of tail /Applications/MAMP/logs/php_error.log after PHPUnit exits with 255?

@mikeerickson
Copy link
Author

And here is the contents of the phpunit.xml file (should this exists somewhere else)

<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"

<testsuites>
    <testsuite name="Application Test Suite">
        <directory>./app/tests/</directory>
    </testsuite>
</testsuites>

@mikeerickson
Copy link
Author

Here you go :-)

[18-Oct-2013 02:44:48 Europe/Berlin] PHP 4. PHPUnit_TextUI_Command->handleArguments() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:135
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:631
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 6. PHPUnit_Util_Configuration->getTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:796
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 7. PHPUnit_Framework_TestSuite->addTestFiles() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:882
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 8. PHPUnit_Framework_TestSuite->addTestFile() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:454
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 9. PHPUnit_Framework_TestSuite->addTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:429
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 10. PHPUnit_Framework_TestSuite->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:359
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 11. PHPUnit_Framework_TestSuite->addTestMethod() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:241
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 12. PHPUnit_Framework_TestSuite::createTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:836
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 13. CustomersTest->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:507

@whatthejeff
Copy link
Contributor

Oops, some of that stack trace is missing. How about tail -n50 /Applications/MAMP/logs/php_error.log.

@mikeerickson
Copy link
Author

[17-Oct-2013 22:54:02 Europe/Berlin] PHP 7. PHPUnit_Framework_TestSuite->addTestFiles() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:882
[17-Oct-2013 22:54:02 Europe/Berlin] PHP 8. PHPUnit_Framework_TestSuite->addTestFile() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:454
[17-Oct-2013 22:54:02 Europe/Berlin] PHP 9. PHPUnit_Framework_TestSuite->addTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:429
[17-Oct-2013 22:54:02 Europe/Berlin] PHP 10. PHPUnit_Framework_TestSuite->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:359
[17-Oct-2013 22:54:02 Europe/Berlin] PHP 11. PHPUnit_Framework_TestSuite->addTestMethod() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:241
[17-Oct-2013 22:54:02 Europe/Berlin] PHP 12. PHPUnit_Framework_TestSuite::createTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:836
[17-Oct-2013 22:54:02 Europe/Berlin] PHP 13. CustomersTest->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:507
[18-Oct-2013 02:26:23 Europe/Berlin] PHP Fatal error: Class 'Mockery' not found in /Applications/MAMP/htdocs/laravel-rest/app/tests/controllers/CustomersTest.php on line 10
[18-Oct-2013 02:26:23 Europe/Berlin] PHP Stack trace:
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 1. {main}() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:0
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:63
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 3. PHPUnit_TextUI_Command->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:126
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 4. PHPUnit_Runner_BaseTestRunner->getTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:147
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 5. PHPUnit_Framework_TestSuite->addTestFiles() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Runner/BaseTestRunner.php:96
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 6. PHPUnit_Framework_TestSuite->addTestFile() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:454
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 7. PHPUnit_Framework_TestSuite->addTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:429
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 8. PHPUnit_Framework_TestSuite->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:359
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 9. PHPUnit_Framework_TestSuite->addTestMethod() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:241
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 10. PHPUnit_Framework_TestSuite::createTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:836
[18-Oct-2013 02:26:23 Europe/Berlin] PHP 11. CustomersTest->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:507
[18-Oct-2013 02:41:08 Europe/Berlin] PHP Fatal error: Class 'Mockery' not found in /Applications/MAMP/htdocs/laravel-rest/app/tests/controllers/CustomersTest.php on line 10
[18-Oct-2013 02:41:08 Europe/Berlin] PHP Stack trace:
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 1. {main}() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:0
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:63
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 3. PHPUnit_TextUI_Command->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:126
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 4. PHPUnit_TextUI_Command->handleArguments() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:135
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:631
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 6. PHPUnit_Util_Configuration->getTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:796
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 7. PHPUnit_Framework_TestSuite->addTestFiles() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:882
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 8. PHPUnit_Framework_TestSuite->addTestFile() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:454
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 9. PHPUnit_Framework_TestSuite->addTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:429
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 10. PHPUnit_Framework_TestSuite->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:359
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 11. PHPUnit_Framework_TestSuite->addTestMethod() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:241
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 12. PHPUnit_Framework_TestSuite::createTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:836
[18-Oct-2013 02:41:08 Europe/Berlin] PHP 13. CustomersTest->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:507
[18-Oct-2013 02:44:48 Europe/Berlin] PHP Fatal error: Class 'Mockery' not found in /Applications/MAMP/htdocs/laravel-rest/app/tests/controllers/CustomersTest.php on line 10
[18-Oct-2013 02:44:48 Europe/Berlin] PHP Stack trace:
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 1. {main}() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:0
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:63
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 3. PHPUnit_TextUI_Command->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:126
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 4. PHPUnit_TextUI_Command->handleArguments() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:135
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:631
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 6. PHPUnit_Util_Configuration->getTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:796
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 7. PHPUnit_Framework_TestSuite->addTestFiles() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:882
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 8. PHPUnit_Framework_TestSuite->addTestFile() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:454
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 9. PHPUnit_Framework_TestSuite->addTestSuite() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:429
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 10. PHPUnit_Framework_TestSuite->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:359
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 11. PHPUnit_Framework_TestSuite->addTestMethod() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:241
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 12. PHPUnit_Framework_TestSuite::createTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:836
[18-Oct-2013 02:44:48 Europe/Berlin] PHP 13. CustomersTest->__construct() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:507

@whatthejeff
Copy link
Contributor

Thanks, @mikeerickson. So here's your problem:

[18-Oct-2013 02:26:23 Europe/Berlin] PHP Fatal error: Class 'Mockery' not found in /Applications/MAMP/htdocs/laravel-rest/app/tests/controllers/CustomersTest.php on line 10

@whatthejeff
Copy link
Contributor

So it seems like your phpunit.xml file is being included and working just fine. Probably Mockery is either not installed or not wired up properly.

@mikeerickson
Copy link
Author

Is this something that I should be installing myself? I am under the impression that class already exists as part of Laravel? Hmmm?

@mikeerickson
Copy link
Author

As expected, it is included in the base Laravel package

http://four.laravel.com/docs/testing

@mikeerickson
Copy link
Author

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" },

@whatthejeff
Copy link
Contributor

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 composer.json to see if that solves the problem. If that doesn't, then I would suggest the Laravel forums or stackoverflow.

Also, I would suggest not using the dev-hhvm branch of PHPUnit unless you have a pretty good reason.

@mikeerickson
Copy link
Author

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?)

@mikeerickson
Copy link
Author

I have changed to use 3.7.* instead of dev-hhvm release as well

@mikeerickson
Copy link
Author

Final question, is this required:

You need to install phpunit and the best way is with pear.

pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit

It indicates that with the package installed via Composer, these tasks are NOT required? I found these notes on stackoverflow

@whatthejeff
Copy link
Contributor

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 think it's more likely that Mockery is simply not installed. You can always check your vendor directory to be sure.

@mikeerickson
Copy link
Author

Sounds good my friend, again thanks! I will do the necessary research on Mockery....

@whatthejeff
Copy link
Contributor

Final question, is this required:

You need to install phpunit and the best way is with pear.

pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit

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.

@whatthejeff
Copy link
Contributor

Sounds good my friend, again thanks! I will do the necessary research on Mockery....

No problemo :)

@mikeerickson
Copy link
Author

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

<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"

<testsuites>
    <testsuite name="Application Test Suite">
        <directory>./app/tests/</directory>
    </testsuite>
</testsuites>

And, if you want the error log:

[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 6. PHPUnit_Framework_TestSuite->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 7. PHPUnit_Framework_TestSuite->runTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 8. PHPUnit_Framework_TestCase->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 9. PHPUnit_Framework_TestResult->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 10. PHPUnit_Framework_TestCase->runBare() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 11. Illuminate\Foundation\Testing\TestCase->setUp() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:835
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 12. Illuminate\Foundation\Testing\TestCase->refreshApplication() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:29
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 13. TestCase->createApplication() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:39
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 14. require() /Applications/MAMP/htdocs/laravel-rest/app/tests/TestCase.php:16
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 15. require() /Applications/MAMP/htdocs/laravel-rest/bootstrap/start.php:61
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 16. require() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/start.php:223
[18-Oct-2013 08:08:54 America/Los_Angeles] PHP 17. require() /Applications/MAMP/htdocs/laravel-rest/app/start/global.php:92
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP Fatal error: Call to undefined method User::creating() in /Applications/MAMP/htdocs/laravel-rest/app/events.php on line 9
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP Stack trace:
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 1. {main}() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:0
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:63
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 3. PHPUnit_TextUI_Command->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 4. PHPUnit_TextUI_TestRunner->doRun() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 5. PHPUnit_Framework_TestSuite->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 6. PHPUnit_Framework_TestSuite->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 7. PHPUnit_Framework_TestSuite->runTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 8. PHPUnit_Framework_TestCase->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 9. PHPUnit_Framework_TestResult->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 10. PHPUnit_Framework_TestCase->runBare() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 11. Illuminate\Foundation\Testing\TestCase->setUp() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:835
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 12. Illuminate\Foundation\Testing\TestCase->refreshApplication() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:29
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 13. TestCase->createApplication() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:39
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 14. require() /Applications/MAMP/htdocs/laravel-rest/app/tests/TestCase.php:16
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 15. require() /Applications/MAMP/htdocs/laravel-rest/bootstrap/start.php:61
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 16. require() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/start.php:223
[18-Oct-2013 08:11:22 America/Los_Angeles] PHP 17. require() /Applications/MAMP/htdocs/laravel-rest/app/start/global.php:92
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP Fatal error: Call to undefined method User::creating() in /Applications/MAMP/htdocs/laravel-rest/app/events.php on line 9
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP Stack trace:
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 1. {main}() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:0
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 2. PHPUnit_TextUI_Command::main() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/composer/bin/phpunit:63
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 3. PHPUnit_TextUI_Command->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 4. PHPUnit_TextUI_TestRunner->doRun() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 5. PHPUnit_Framework_TestSuite->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:349
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 6. PHPUnit_Framework_TestSuite->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:705
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 7. PHPUnit_Framework_TestSuite->runTest() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:745
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 8. PHPUnit_Framework_TestCase->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:775
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 9. PHPUnit_Framework_TestResult->run() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 10. PHPUnit_Framework_TestCase->runBare() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 11. Illuminate\Foundation\Testing\TestCase->setUp() /Applications/MAMP/htdocs/laravel-rest/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:835
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 12. Illuminate\Foundation\Testing\TestCase->refreshApplication() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:29
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 13. TestCase->createApplication() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:39
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 14. require() /Applications/MAMP/htdocs/laravel-rest/app/tests/TestCase.php:16
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 15. require() /Applications/MAMP/htdocs/laravel-rest/bootstrap/start.php:61
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 16. require() /Applications/MAMP/htdocs/laravel-rest/vendor/laravel/framework/src/Illuminate/Foundation/start.php:223
[18-Oct-2013 08:17:26 America/Los_Angeles] PHP 17. require() /Applications/MAMP/htdocs/laravel-rest/app/start/global.php:92

@whatthejeff
Copy link
Contributor

Looks like you are getting a new fatal error:

PHP Fatal error: Call to undefined method User::creating() in /Applications/MAMP/htdocs/laravel-rest/app/events.php on line 9

@mikeerickson
Copy link
Author

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)

@whatthejeff
Copy link
Contributor

No problem, my friend :) Enjoy!

@johnss johnss mentioned this issue May 16, 2016
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