createMock(BanGateway::class); $banRetriever = new BanRetriever($banGateway); $bannedEmail = new BannedEmail(); $bannedEmail->email = 'my@email.address'; $banGateway->method('getEmailBans') ->willReturn([$bannedEmail]); //-- Act $result = $banRetriever->isEmailBanned('my@email.address', null); //-- Assert $this->assertThat($result, $this->isTrue()); } }