phpunit, to random
@phpunit@phpc.social avatar
SuitedUpDev, (edited ) to php
@SuitedUpDev@mastodon.online avatar

This is good thing, ruined by a period.

phpunit, to random
@phpunit@phpc.social avatar
beausimensen, to php
@beausimensen@phpc.social avatar

Are there examples of getting pretty output from for custom assertions?

Projects like prove you can do a lot with phpunit’s output. I’m hoping it doesn’t take that much work to hook into correctly displaying information when an assertion fails, though.

So, two questions:

If I write a custom assertion, can I be creative with how failures display?

Can I hook into the built-in assertions and conditionally tweak their display?

Solid and creative examples welcome. :)

Crell, to php
@Crell@phpc.social avatar

This is fun. Upgrading a library to 10, it works fine but Xdebug isn't detected (for code coverage). php -i confirms xdebug is set to "debug,coverage", but I get a message that it must be set, or an env var provided. Providing the env var works fine, but the xdebug setting is not.

What's going on?

markusstaab, to opensource German
@markusstaab@phpc.social avatar

I spent a big part of my sunday hunting down a memory and performance issue when testing rules with NodeScopeResolverTest in reported in https://github.com/phpstan/phpstan/discussions/9914 by gnutix

if you see massive RAM/time used, try phpunit9 for now. Fix is under discussion.

sebastian, to random
@sebastian@phpc.social avatar

The next code sprint will take place in Hamburg, Germany on March 8-9, 2024:

https://phpunit.de/code-sprints/march-2024.html

phpunit, to random
@phpunit@phpc.social avatar
sebastian, to random
@sebastian@phpc.social avatar

The last code sprint was four (!) years ago:

https://phpunit.de/code-sprints/september-2019.html

Teaser: The next one will be in March in Hamburg. Details: soon.

herndlm, to random
@herndlm@phpc.social avatar

was debugging a flaky test with executionOrder="defects" configured. it took me quite a while to figure out that the code under test was dependent on a constant and that constant was set in only one test case (which sometimes ran before the others which would break them)..

replaced the constant with something else that can be properly mocked and all is good. phew.

ramsey, to php
@ramsey@phpc.social avatar

Since no longer has expectWarning() and expectNotice(), how are folks handling these? :phpunit:

ramsey, to random
@ramsey@phpc.social avatar

Is there a way to disable or hide the deprecations? I have 265 of them for data providers that aren’t static, and I can’t easily switch to static data providers, since many of the data providers call instance methods (i.e., $this). So, it’s going to take me a long time to upgrade my tests so that I can upgrade to PHPUnit 10.

phpunit, to random
@phpunit@phpc.social avatar
sebastian, to php

You want to learn how to get started with automated testing for your software?

The next instance of my "Test Automation with " training starts at the end of September.

Details: https://thephp.cc/training/test-automation-with-phpunit?ref=mastodon

Dates: https://thephp.cc/dates?ref=mastodon

Interested? Send an email to team@thephp.cc!

sebastian,

You're looking for training that covers more advanced topics?

The next instance of my "Advanced PHPUnit" training starts at the end of October.

Details: https://thephp.cc/training/advanced-phpunit?ref=mastodon

Dates: https://thephp.cc/dates?ref=mastodon

Interested? Send an email to team@thephp.cc!

Crell, to php
@Crell@phpc.social avatar

9 says to stop using assertObjectHasAttribute() in favor of assertObjectHasProperty(). But the latter doesn't exist in PHPUnit 9, only in PHPUnit 10.

Am I missing something obvious? Because that's not how deprecation warnings are supposed to work...

phpunit, to random
@phpunit@phpc.social avatar
Crell, to php
@Crell@phpc.social avatar

I have only recently learned of the "before" attribute in @phpunit. It seems appealing. What I don't get is... why would I ever use setUp() when I can instead use a before method? It seems like the easier, more portable solution in ever case except when I actively want to bypass a parent class's setUp().

(Same for beforeClass.)

iCaspar, to random
@iCaspar@phpc.social avatar

Yesterday I added some tooling to auto-generate code coverage info about our new (2-week old) Laravel codebase. ( makes this easy.) It revealed 2 things:

The first thing goes to YAGNI is hard:

We already had lots of classes that had lots of empty, placeholder methods. Many of them for things we will never need. I deleted them. We can artisan make them again if we ever need them.

velkuns, to php French
@velkuns@phpc.social avatar

Today, I am up from 8 to 9 (max) the phpstan level of an internal client SDK for internal API in my job.

Need some internal refactoring was required, with some generic phpstan doc comment.

But finally made it, with only one test to change. And add one test for 100% coverage.

Thanks to me in past to do the full coverage and ensure this kind of refactoring works well.

Conclusion: add tests for you in future. That will make refactoring and rewriting to be safe 👍

sebastian, to php German

Auf der @FrOSCon in Sankt Augustin werde ich am 5. August 2023 im -Raum einen Vortrag über 10 @phpunit halten:

https://thephp.cc/termine/phpunit-10-froscon

phpunit, to random
@phpunit@phpc.social avatar
phpunit, to random
@phpunit@phpc.social avatar
shawnhooper, to random
@shawnhooper@fosstodon.org avatar

Hmm, upgraded an app to use PHPUnit 10. and it's always getting exit code 1.

There are skipped, risky and incomplete tests, but no errors or failures.

How do you figure out what's causing the non-zero exit code?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • megavids
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • provamag3
  • tester
  • Leos
  • JUstTest
  • All magazines