createMock(Encryptor::class); $map = [ ['4321', '1234'], ['asdfasdfasdf', 'qwerqwerqwer'] ]; $encryptor->method('decrypt') ->will($this->returnValueMap($map)); $this->apiKeyEndingComment = new ApiKeyEnding($encryptor); } public function testCommentReturnsJustTheEnding() { $this->assertEquals( 'Key stored ending in 1234', $this->apiKeyEndingComment->getCommentText('4321') ); $this->assertEquals( 'Key stored ending in qwer', $this->apiKeyEndingComment->getCommentText('asdfasdfasdf') ); } }