public function testSearchArtistReturnsAListOfAlbums() { $track_list = new ArrayCollection(array(Artist::create('id', 'Artist 1'), Artist::create('id2', 'Artist 2'))); $repository = $this->getMock('Naxhh\\PlayCool\\Domain\\Contract\\ArtistRepository'); $repository->expects($this->any())->method('getListByName')->will($this->returnValue($track_list)); $command = new SearchArtistCommand('Search term'); $use_case = new SearchArtistUseCase($repository); $artist_list = $use_case->handle($command); $this->assertCount(2, $artist_list); $this->assertInstanceOf('Naxhh\\Playcool\\Domain\\Entity\\Artist', $artist_list->get(1)); }
private function getArtists($term) { $use_case = new SearchArtistUseCase($this->app['repo.artist']); return $use_case->handle(new SearchArtistCommand($term)); }