public function testGetMentions() { $fooBarUsernames = ['foo', 'bar']; $fooBarDto = [m::mock(ConfirmedMentionDto::class), m::mock(ConfirmedMentionDto::class)]; $fooBarEntities = [m::mock(Mention::class), m::mock(Mention::class)]; $this->mentionsParser->shouldReceive('findMentions')->with('Hello @foo and @bar')->once()->andReturn($fooBarUsernames); $this->mentionsFetcher->shouldReceive('fetchMentions')->with($fooBarUsernames)->once()->andReturn($fooBarDto); $this->mentionsMapper->shouldReceive('map')->with($fooBarDto)->once()->andReturn($fooBarEntities); $entities = $this->mentionsResolver->getMentions('Hello @foo and @bar'); $this->assertEquals($fooBarEntities, $entities); }