Coder Social home page Coder Social logo

guard-phpunit's Issues

PHP Fatal error: Call to undefined method PHPUnit_Framework_TestResult::allCompletlyImplemented()

I have upgrade PHPUnit

# phpunit --version
PHPUnit 3.7.14 by Sebastian Bergmann.

The problem :(
09:11:48 - INFO - Running all tests
PHP Fatal error: Call to undefined method PHPUnit_Framework_TestResult::allCompletlyImplemented() in /var/lib/gems/1.9.1/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit- Progress/PHPUnit/Extensions/Progress/ResultPrinter.php on line 250
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main($exit = uninitialized) /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run($argv = array (0 => '/usr/bin/phpunit', 1 => '--include-path', 2 => '/var/lib/gems/1.9.1/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit-Progress', 3 => '--printer', 4 => 'PHPUnit_Extensions_Progress_ResultPrinter', 5 => '-c', 6 => 'app/phpunit.xml.dist', 7 => 'src'), $exit = TRUE) /usr/share/php/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun($suite = class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'src'; protected $groups = array ('imerayo' => array (...)); protected $tests = array (0 => class PHPUnit_Framework_TestSuite { ... }, 1 => class PHPUnit_Framework_TestSuite { ... }, 2 => class PHPUnit_Framework_TestSuite { ... }, 3 => class PHPUnit_Framework_TestSuite { ... }, 4 => class PHPUnit_Framework_TestSuite { ... }, 5 => class PHPUnit_Framework_TestSuite { ... }); protected $numTests = 13; protected $testCase = FALSE }, $arguments = array ('listGroups' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'printer' => class PHPUnit_Extensions_Progress_ResultPrinter { protected $column = 13; protected $maxColumn = 65; protected $lastTestFailed = FALSE; protected $numAssertions = 30; protected $numTests = 13; protected $numTestsRun = 13; protected $numTestsWidth = 2; protected $colors = FALSE; protected $debug = FALSE; protected $verbose = FALSE; protected $autoFlush = FALSE; protected $out = NULL; protected $outTarget = NULL; protected $printsHTML = FALSE }, 'configuration' => 'app/phpunit.xml.dist', 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt'))) /usr/share/php/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Extensions_Progress_ResultPrinter->printResult($result = class PHPUnit_Framework_TestResult { protected $passed = array ('Hcuv\BlogBundle\Tests\Controller\BlogControllerTest::showBlogWithInvalidIdError404' => array (...), 'Hcuv\BlogBundle\Tests\Controller\BlogControllerTest::showBlogWithPreviousCreate' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeShowInitialBlogHomePage' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeGenerateHTTPError405MethodNoAllowedInBlogHomePageUsingMethodPost' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeShowAboutPage' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeShowContactFormPage' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeProcessContactForm' => array (...), 'Hcuv\BlogBundle\Tests\Entity\BlogTest::createBlogWithEmptyComments' => array (...), 'Hcuv\BlogBundle\Tests\Entity\EnquiryTest::shouldBeCreateEnquiry' => array (...), 'Hcuv\BlogBundle\Tests\Entity\EnquiryTest::shouldBeSettersValuesEqualsGettersEnquiry' => array (...), 'Hcuv\BlogBundle\Tests\Form\EnquiryTypeTest::createForm' => array (...), 'Hcuv\BlogBundle\Tests\Repository\BlogRepositoryTest::getLatestBlogsWithoutLimit' => array (...), 'Hcuv\BlogBundle\Tests\Repository\BlogRepositoryTest::getLatestBlogsWithLimit2' => array (...)); protected $errors = array (); protected $deprecatedFeatures = array (); protected $failures = array (); protected $notImplemented = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit_Extensions_Progress_ResultPrinter { ... }, 1 => class PHPUnit_Util_DeprecatedFeature_Logger { ... }); protected $runTests = 13; protected $time = 1.6750390529633; protected $topTestSuite = class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'src'; protected $groups = array (...); protected $tests = array (...); protected $numTests = 13; protected $testCase = FALSE }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }) /usr/share/php/PHPUnit/TextUI/TestRunner.php:352
PHP 6. PHPUnit_Extensions_Progress_ResultPrinter->printFooter($result = class PHPUnit_Framework_TestResult { protected $passed = array ('Hcuv\BlogBundle\Tests\Controller\BlogControllerTest::showBlogWithInvalidIdError404' => array (...), 'Hcuv\BlogBundle\Tests\Controller\BlogControllerTest::showBlogWithPreviousCreate' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeShowInitialBlogHomePage' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeGenerateHTTPError405MethodNoAllowedInBlogHomePageUsingMethodPost' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeShowAboutPage' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeShowContactFormPage' => array (...), 'Hcuv\BlogBundle\Tests\Controller\PageControllerTest::shouldBeProcessContactForm' => array (...), 'Hcuv\BlogBundle\Tests\Entity\BlogTest::createBlogWithEmptyComments' => array (...), 'Hcuv\BlogBundle\Tests\Entity\EnquiryTest::shouldBeCreateEnquiry' => array (...), 'Hcuv\BlogBundle\Tests\Entity\EnquiryTest::shouldBeSettersValuesEqualsGettersEnquiry' => array (...), 'Hcuv\BlogBundle\Tests\Form\EnquiryTypeTest::createForm' => array (...), 'Hcuv\BlogBundle\Tests\Repository\BlogRepositoryTest::getLatestBlogsWithoutLimit' => array (...), 'Hcuv\BlogBundle\Tests\Repository\BlogRepositoryTest::getLatestBlogsWithLimit2' => array (...)); protected $errors = array (); protected $deprecatedFeatures = array (); protected $failures = array (); protected $notImplemented = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit_Extensions_Progress_ResultPrinter { ... }, 1 => class PHPUnit_Util_DeprecatedFeature_Logger { ... }); protected $runTests = 13; protected $time = 1.6750390529633; protected $topTestSuite = class PHPUnit_Framework_TestSuite { protected $backupGlobals = FALSE; protected $backupStaticAttributes = NULL; protected $name = 'src'; protected $groups = array (...); protected $tests = array (...); protected $numTests = 13; protected $testCase = FALSE }; protected $codeCoverage = NULL; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $strictMode = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; protected $timeoutForSmallTests = 1; protected $timeoutForMediumTests = 10; protected $timeoutForLargeTests = 60 }) /var/lib/gems/1.9.1/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit- Progress/PHPUnit/Extensions/Progress/ResultPrinter.php:72
09:11:50 - INFO - .............

[#CD7BDA6FF975]
[#CD7BDA6FF975] Finished in 1 second

Thanks

unrecognized option --printer .. Version incompatability

on Debian Squeeze, the default version of PHPUnit is 3.4.14 which doesn't have the required argument (--printer).

to overcome this .. use pear to install version 3.6.11

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

and you're on your way.

Declaration of PHPUnit_Extensions_Progress_ResultPrinter::printDefects() is not compatible with PHPUnit_TextUI_ResultPrinter

Not 100% sure if this falls in the domain of guard-phpunit - but i'm assuming it is because the error is spawning from the guard-phpunit folder.

I'm using PHPUnit 4.1.3

13:38:15 - INFO - Strict standards: Declaration of PHPUnit_Extensions_Progress_ResultPrinter::printDefects() should be compatible with PHPUnit_TextUI_ResultPrinter::printDefects(array $defects, $type) in /usr/local/lib/ruby/gems/2.0.0/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit->Progress/PHPUnit/Extensions/Progress/ResultPrinter.php on line 14
[#3E716657CF46]
[#3E716657CF46] Call Stack:
[#3E716657CF46] 0.0011 167440 1. {main}() /usr/local/bin/phpunit:0
[#3E716657CF46] 0.0204 420224 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:582
[#3E716657CF46] 0.0204 420540 3. PHPUnit_TextUI_Command->run() phar:///usr/local/bin/phpunit/ phpunit/TextUI/Command.php:132
[#3E716657CF46] 0.0204 421780 4. PHPUnit_TextUI_Command->handleArguments() phar:///usr/local/ bin/phpunit/phpunit/TextUI/Command.php:141
[#3E716657CF46] 0.0211 447016 5. PHPUnit_TextUI_Command->handlePrinter() phar:///usr/local/bi n/phpunit/phpunit/TextUI/Command.php:589
[#3E716657CF46] 0.0220 505328 6. require('/usr/local/lib/ruby/gems/2.0.0/gems/guard-phpunit-0 .1.4/lib/guard/phpunit/formatters/PHPUnit-Progress/PHPUnit/Extensions/Progress/ResultPrinter.php') phar:/ //usr/local/bin/phpunit/phpunit/TextUI/Command.php:757

Allow Ability to Specify phpunit command

My most recent setup installs phpunit from composer, which creates an executable under the project's vendor directory.

In this situation, it'd be nice if we could specify to run this phpunit binary through guard.

Not growling correctly: always 0/0 tests

Using the following Guardfile:

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

notification :growl

guard 'phpunit', :tests_path => 'tests/unit', :cli => '--colors --bootstrap tests/lib/InitTests.php --stderr' do
  # Watch tests files
  watch(%r{^.+Test\.php$})

  # Watch library files and run their tests
  watch(%r{^/(.+)\.php}) { |m| "tests/unit/#{m[1]}Test.php" }
end

It always growls the following result (with a green tick icon):

PHPUnit results
0 tests, 0 failures
in 0 seconds

Even though the terminal output might look like this:

$ guard
WARNING: You are using Guard outside of Bundler, this is dangerous and could not work. Using `bundle exec guard` is safer.
Guard uses Growl to send notifications.
Guard is now watching at '/Users/myuser/path/to/folder'
Running all tests
PHPUnit 3.6.7 by Sebastian Bergmann.

............................F.......................

Time: 3 seconds, Memory: 28.00Mb

There was 1 failure:
...

Integration with guard-phpunit-sf2

Hi,
thanks for this library is great!

I'd like to merge this https://github.com/liuggio/guard-phpunit-sf2 repo with yours,
but there are some logical differences:

  1. Path should not be called when run_all
  2. the Inspector is totally different class
  3. the command execution has different parameters

Maybe with your help this lib could be more dynamic and supports also Symfony2 framework.

What do you think?

PHP Fatal Error. (PHP 5.4.13 - PHPUnit 3.8.*) using Guard.

23:45:23 - INFO - Guard uses Libnotify to send notifications.
23:45:23 - INFO - Guard uses TerminalTitle to send notifications.
23:45:23 - INFO - Running all tests
PHP Fatal error: Call to undefined method PHPUnit_Extensions_Progress_ResultPrinter::secondsToTimeString() in /etc/phpunit/vendor/phpunit/php-timer/PHP/Timer.php on line 138
PHP Stack trace:
PHP 1. {main}() /etc/phpunit/vendor/phpunit/phpunit/composer/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /etc/phpunit/vendor/phpunit/phpunit/composer/bin/phpunit:63
PHP 3. PHPUnit_TextUI_Command->run() /etc/phpunit/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /etc/phpunit/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Extensions_Progress_ResultPrinter->printResult() /etc/phpunit/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:399
PHP 6. PHPUnit_Extensions_Progress_ResultPrinter->printFooter() /home/username/.rvm/gems/ruby-1.9.3-p374/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit-Progress/PHPUnit/Extensions/Progress/ResultPrinter.php:72
PHP 7. PHP_Timer->timeSinceStartOfRequest() /home/username/.rvm/gems/ruby-1.9.3-p374/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit-Progress/PHPUnit/Extensions/Progress/ResultPrinter.php:238
23:45:24 - INFO - .........

Specify Folder Instead of Single File

Is there not a way to run PHPUnit on an entire test folder when a file is changed? It seems to only work if I explicitly set a test file to execute.

What I'm trying to do is something along the lines of:

# When routes.php is changed, run "phpunit app/tests"
watch('app/routes.php') { 'app/tests' }

Is that not possible, or am I being stupid?

Not Automating the Tests in Linux

I've installed all the guard gems for this to work and libnotify. I'm on a Fedora 17 platform and the testing isn't automated. Meaning I always have to return to the terminal and hit "Enter" for the tests to run again cause it's not testing on save.

Here s my Guardfile:

guard 'phpunit', :tests_path => 'application/tests/*.php', :cli => '--colors', :keep_failed => true, :all_after_pass => true do watch(%r{application/tests/(.+)\.php$}) watch(%r{^application/libraries/(.+)\.php$}) { |m| "tests/#{m[1]}test.php" } watch(%r{^application/tasks/(.+)\.php$}) { |m| "tests/#{m[1]}test.php" } end

commands not found phpunit --version, phpunit --include-path, no continuos testing and tests always fail

using guard from terminal i get always this output:

20:51:25 - INFO - Guard uses TerminalNotifier to send notifications.
20:51:25 - INFO - Guard uses TerminalTitle to send notifications.
/Library/Ruby/Gems/1.8/gems/guard-phpunit-0.1.4/lib/guard/phpunit.rb:58: command not found: phpunit --version
20:51:25 - INFO - Running all tests
/Library/Ruby/Gems/1.8/gems/guard-phpunit-0.1.4/lib/guard/phpunit.rb:58: command not found: phpunit --include-path /Library/Ruby/Gems/1.8/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit-Progress --printer PHPUnit_Extensions_Progress_ResultPrinter --colors tests
20:51:25 - INFO -

20:51:26 - INFO - Guard is now watching at '/Applications/MAMP/htdocs/lesson'

Using 'terminal-notifier-guard', tests always fail. They pass only the first time i use guard after editing Guardfile, and re-testing isn't automatic.

Doesn't work in Windows

Hi,
It appears that this Guard plugin doesn't work in Windows. Do you think it would be possible to achieve?

When I try running it (with a guardfile that works fine in OS X), I get this:

ERROR: phpunit is not installed on your machine.

But PHPUnit is installed and I can run it with the "phpunit" command.

Looking at the source code of this gem, it looks like it tries to use "which" to determine if phpunit is installed:

system('which phpunit > /dev/null 2>&1')

(See: https://github.com/Maher4Ever/guard-phpunit/blob/master/lib/guard/phpunit/runner.rb#L48)

To me it looks like it would work, if we change that code so it can use something else on Windows. What do you think?

Checking for platform:
This seems to be the best way of checking if you are running Ruby in Windows:

require 'rbconfig'
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)

(See: http://stackoverflow.com/a/4871457)

Checking if phpunit is installed:
And "where" seems to be possible to use instead of "which" on Windows:

> where phpunit
C:\utv\wamp\bin\php\php5.3.1\phpunit
C:\utv\wamp\bin\php\php5.3.1\phpunit.bat

(See: http://stackoverflow.com/a/304447)

Using output from which (where):
The only part I'm not sure about is the Windows equivalent of this: "> /dev/null 2>&1". Any ideas?

Call to undefined method PHPUnit_Framework_TestResult::allCompletlyImplemented()

Bad method call to PHPUnit_Framework_TestResult::allCompletlyImplemented(). From the stack trace the function is called in guard/phpunit/formatters/PHPUnit-Progress/PHPUnit/Extensions/Progress/ResultPrinter.php:72

I'm using PHPUnit 4.1.3

[#3E716657CF46] Fatal error: Call to undefined method PHPUnit_Framework_TestResult::allCompletlyImplemented() in /usr/local/lib/ruby/gems/2.0.0/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit-Progress/PHPUnit/Extensions/Progress/ResultPrinter.php on line 256
[#3E716657CF46]
[#3E716657CF46] Call Stack:
[#3E716657CF46] 0.0011 167440 1. {main}() /usr/local/bin/phpunit:0
[#3E716657CF46] 0.0204 420224 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:582
[#3E716657CF46] 0.0204 420540 3. PHPUnit_TextUI_Command->run() phar:///usr/local/bin/phpunit/ phpunit/TextUI/Command.php:132
[#3E716657CF46] 0.1533 4147016 4. PHPUnit_TextUI_TestRunner->doRun() phar:///usr/local/bin/php unit/phpunit/TextUI/Command.php:179
[#3E716657CF46] 1.1962 15111600 5. PHPUnit_Extensions_Progress_ResultPrinter->printResult() /va r/www/html-wafer-maps/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:432
[#3E716657CF46] 1.2028 15766760 6. PHPUnit_Extensions_Progress_ResultPrinter->printFooter() /us r/local/lib/ruby/gems/2.0.0/gems/guard-phpunit-0.1.4/lib/guard/phpunit/formatters/PHPUnit-Progress/PHPUnit/Extensions/Progress/ResultPrinter.php:72

:all_after_pass no longer functions in Ubuntu

This might be specific to the way notifications are working in Ubuntu.

This change:
66aafde

results in run_tests() always returning true, hence :all_after_pass no longer functions.

I had a look through the tests and because $? is stubbed all over the place I can't find a trivial way of putting in an accurate test without refactoring.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.