expectException replaced the annotation

The @expectedException annotation and setExpectedException() are both deprecated in favour of methods, which is more than a rename — the annotation asserted only that the exception was thrown somewhere in the test.

public function testRejectsAMismatchedCurrency()
{
    $this->expectException(DomainException::class);
    $this->expectExceptionMessage('Currency mismatch');

    $try = Money::fromCents(100, 'TRY');
    $eur = Money::fromCents(100, 'EUR');

    $try->add($eur);   // the line that must throw, and it is last
}

The expectation is set immediately before the call that should throw, so the setup lines above cannot satisfy it by accident — which the annotation form allowed, producing a green test that never reached the assertion. Put the throwing call last and nothing after it, or a passing test may be passing for the wrong reason.