expectException(InvariantViolationException::class); $this->expectExceptionMessage('Something went wrong!'); Psl\invariant(false, 'Something %s %s!', 'went', 'wrong'); } public function testInvariantDoesNotThrowWhenTheFactIsTrue(): void { Psl\invariant(2 === (1 + 1), 'Unless?'); $this->addToAssertionCount(1); } }