fix(ci): yoda condition + un-shadow capability-cache test expectations
- class-image-composer.php: swap the fingerprint comparison operands (WordPress.PHP.YodaConditions flagged the parenthesized null-coalesce expression on the right-hand side). - ImageComposerTest: the two capability-cache tests asserted update_option calls via Functions\expect(), which the setUp Functions\when() stub shadows (Mockery dispatches the call to the first matching expectation), so the with()-matcher saw 0 calls once the CI runner's real imagick made the probe path live. Capture calls with a when() alias instead (the suite's house pattern) and assert on the captured writes - including autoload=false and the rewritten fingerprint. The matching-fingerprint test now genuinely asserts zero writes instead of a trivially-satisfied never(). No composer behavior change beyond the operand swap. Agent-Session: engineer-prautoblogger-image-composer-20260611
This commit is contained in:
@@ -176,7 +176,7 @@ class PRAutoBlogger_Image_Composer implements PRAutoBlogger_Image_Composer_Inter
|
||||
);
|
||||
|
||||
$cached = get_option( self::OPTION_CAPABILITY, array() );
|
||||
if ( is_array( $cached ) && $fingerprint === ( $cached['fingerprint'] ?? '' ) && isset( $cached['capability'] ) ) {
|
||||
if ( is_array( $cached ) && ( $cached['fingerprint'] ?? '' ) === $fingerprint && isset( $cached['capability'] ) ) {
|
||||
$capability = (string) $cached['capability'];
|
||||
} else {
|
||||
$capability = $this->probe_capability();
|
||||
|
||||
Reference in New Issue
Block a user