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

Does phpunit testing work for anyone else? #48

Closed
smustgrave opened this issue Aug 22, 2021 · 3 comments
Closed

Does phpunit testing work for anyone else? #48

smustgrave opened this issue Aug 22, 2021 · 3 comments

Comments

@smustgrave
Copy link
Contributor

Currently look to apply a patch to Drupal core. But first I want to run a phpunit test on a single file.
1 It takes almost 30-45 minutes to run a single file does that seem correct?
2 Comes back with all errors even though I didn't make a change
3 No error messages

Example
6) Drupal\Tests\datetime\Functional\DateTimeFieldTest::testDateStorageSettings
PHPUnit\Framework\Exception: Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(

/app/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php:270
/app/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php:187
/app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:677
/app/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:670
/app/vendor/phpunit/phpunit/src/TextUI/Command.php:143
/app/vendor/phpunit/phpunit/src/TextUI/Command.php:96

Just wondering if anyone got this working or are they using another way?

@ronaldmulero
Copy link
Contributor

ronaldmulero commented Sep 19, 2021

@smustgrave This works for me:

cd ~/Sites/drupal-contributions/web;
lando phpunit core/tests/Drupal/Tests/Core/Password/PasswordHashingTest;

// result

PHPUnit 8.5.20 by Sebastian Bergmann and contributors.

Warning:       Invocation with class name is deprecated

Testing Drupal\Tests\Core\Password\PasswordHashingTest
.........                                                           9 / 9 (100%)

Time: 1.47 seconds, Memory: 6.00 MB

OK (9 tests, 19 assertions)

@gitressa
Copy link
Contributor

It works well for me as well:

$ lando phpunit web/core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php
PHPUnit 9.5.11 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing Drupal\Tests\Core\Password\PasswordHashingTest
.........                                                           9 / 9 (100%)

Time: 00:00.022, Memory: 10.00 MB

OK (9 tests, 19 assertions)
$ lando phpunit web/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
PHPUnit 9.5.11 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing Drupal\Tests\big_pipe\Functional\BigPipeTest
....                                                                4 / 4 (100%)

Time: 00:19.405, Memory: 10.00 MB

OK (4 tests, 151 assertions)

HTML output was generated
https://drupal-contributions.lndo.site/sites/simpletest/browser_output/Drupal_Tests_big_pipe_Functional_BigPipeTest-1-50977401.html
[...]

PS. Thanks @ronaldmulero, I have been looking for a fast test, so thanks for making me aware of PasswordHashingTest :)

@smustgrave
Copy link
Contributor Author

closing for #63

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