@phpunit @ssemicolons oh, missed that! Thank you for the heads up!
Looks like a really useful addition! Thanks @sebastian !

For reference, here is the feature's documentation: https://docs.phpunit.de/en/13.0/test-doubles.html#sealed-test-doubles

#php #phpunit #testdoubles #phpunit13

6. Test Doubles — PHPUnit 13.0 Manual

Merry Christmas, to those who celebrate!

As a gift, the recording of my talk on "Testable Architecture" that I recently gave at the Calgary Software Crafters meetup is now available!

https://youtu.be/dT3jORSx6C4

#TestableArchitecture #Hexagonal #TestDoubles

Designing for Testable Code with a Testable Architecture (Calgary Software Crafters Meetup)

YouTube

"You need tests that don't break when you refactor. When you use dynamic mocks, tests tend to fail whenever you make changes in SUTs. Even though you have tests, they don't enable refactoring."

#softwareengineering #softwarearchitecture #tdd #unittests #mocks #testdoubles

https://blog.ploeh.dk/2022/10/17/stubs-and-mocks-break-encapsulation/

Stubs and mocks break encapsulation

Favour Fakes over dynamic mocks.

I'm not trying to pick on #mockists, but as I point out in this #StackOverflow comment, mocks, #testdoubles, and stubbed methods don't always add value. In addition, this approach requires the rspec-mocks gem in addition to #RSpec core and expectations to create an RSpec::Mocks::Double, plus `allow(dbl).to receive` just to `expect(dbl).to receive`.

This is a layer of overhead and test indirection that is often unnecessary IMHO. YMMV, but it's often worth rethinking.

https://stackoverflow.com/questions/78265716/how-to-test-a-script-that-pushes-gems#comment138009811_78265716

How to test a script that pushes gems?

I have this script: #!/usr/bin/env ruby # frozen_string_literal: true if ARGV.any? puts "USAGE: release" exit end def system!(command) puts command system(command, exception: tr...

Stack Overflow

If people actually read “XUnit Test Patterns: Refactoring Test Code” by G. Meszaros maybe they’d understand what test doubles are, or when/why to use them. Maybe they wouldn’t write how they hate “mocks”, but focused on merits of their approach.

There’s so much misunderstanding and non-constructive criticism in our profession. I really admire those few people I know who strive to write from a positive angle. I’m not sure if I’d be able to doit.

#testing #mocks #notrealymocks #testdoubles #tdd

What are the worst examples of using #testdoubles #mocks you’ve seen? Send me your mocking hell. #testing #tdd
I wrote something about testing at the boundaries of your application and contract testing
https://medium.com/@antodippo/testing-at-the-boundaries-of-your-application-fc78145bee9
#testautomation #contracttesting #testdoubles
Testing at the boundaries of your application - Antonello D'Ippolito - Medium

When writing automated unit tests at the boundaries of our application — that is, communicating with an external service — we often make use of test doubles: due to the external service’s possible…

Medium

Breakdown of test doubles.

Test Doubles

Fake / Dummy:
- Actual implementation
- Shortcut

Stub:
- Canned answers
- Independent of test

Spy:
- Like stubs
- Records call

Mock:
- Includes expectations
- Within test setup

#testing #testautomation #testdoubles

You can use #TestDoubles (#mockobjects) without using a library/framework just the same as you can use #DependencyInjection without a container.

You don't need to feel stuck, even though I can guess how to reached the point of believing you were.

I routinely see programmers who shy away from using #TestDoubles/#MockObjects in their work. You can find so many strong opinions on the topic!

Let me offer another way to interpret one of the often-cited drawbacks of #TestDoubles and one of the often-cited advantages of testing with "the real thing".

https://blog.thecodewhisperer.com/permalink/a-matter-of-interpretation-with-mock-objects

#lightweight #refactoring

A Matter of Interpretation: Mock Objects

Just another little example of two people looking at a situation, one seeing a problem and the other seeing a solution.