# `Mutare.Phoenix.PubSub`
[🔗](https://github.com/foxbenjaminfox/mutare_phoenix/blob/v0.3.1/lib/mutare/phoenix/pub_sub.ex#L1)

`:pubsub` — removes a `Phoenix.PubSub` call, collapsing it to the `:ok` it returns on
success. Three kinds, each a variant label:

    Phoenix.PubSub.subscribe(MyApp.PubSub, "room:" <> id)         ->  :ok   # subscribe
    Phoenix.PubSub.unsubscribe(MyApp.PubSub, "room:" <> id)       ->  :ok   # unsubscribe
    Phoenix.PubSub.broadcast(MyApp.PubSub, topic, {:new, msg})    ->  :ok   # broadcast
    Phoenix.PubSub.broadcast_from!(MyApp.PubSub, self(), t, msg)  ->  :ok   # broadcast

A `subscribe` survivor means no test delivers a message on that topic and checks the
process handled it — the LiveView that subscribes in `mount/3` and re-renders on
`handle_info/2`, say, with no test ever broadcasting to it. A `broadcast` survivor means no
test asserts the message reached a subscriber (a test process that subscribed and
`assert_receive`s, or a LiveView whose render is checked after the broadcast). An
`unsubscribe` survivor means no test depends on the messages *stopping*. Suppress one kind
with `# mutare:ignore[pubsub:subscribe]`, or the whole family with `# mutare:ignore[pubsub]`.

The `broadcast` kind covers the whole broadcast surface: `broadcast/3,4`, `broadcast!/3,4`,
`broadcast_from/4,5`, `broadcast_from!/4,5`, `local_broadcast/3,4`,
`local_broadcast_from/4,5`, `direct_broadcast/4,5`, and `direct_broadcast!/4,5`. The
channel-level `Phoenix.Channel.broadcast/3` call resolves to a different module and is
covered by `:channel_message`.

Only the defined arities match, so a name-matched call of any other arity (reachable only by an
explicit qualifier) is left alone, keeping every metamutant compiling. A call written as a
pipe stage (`pubsub |> Phoenix.PubSub.subscribe(topic)`) gets the same mutant, reported over
the whole pipe. Matches direct (`Phoenix.PubSub.subscribe(...)`), aliased, and bare-imported
calls.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
