Follow

I want to unit test a method that is 18 lines long, and there's so much going on that I don't think I can ... at least not in the same repo it lives in.

Strike 1: Internal static array cache
Strike 2: Invocation of a static method to do some work
Strike 3: Hard-coded constant referencing *one* project that it is included from

Diagnosis: Rewrite

Oof, the method for Strike 2 is itself a multi-strike. It has another Strike 1. But at least it's not tied to a specific implementation.

Sign in to participate in the conversation
PHP Community on Mastodon

Open source. Open community. We are dedicated to building and enriching the PHP community.