/** * @param int $choice * @param string $person * * @return array|null $result */ protected function getResult($choice, $person) { $result = null; switch ($choice) { case 0: $result = $this->friendRepository->getFriends($person); break; case 1: $result = $this->friendRepository->getFriendsOfFriends($person); break; case 2: $result = $this->friendRepository->getSuggestedFriends($person); break; } return $result; }
/** * @param string $person * @param int $mutualFriendsCount * * @dataProvider personProvider */ public function testGetSuggestedFriends($person, $mutualFriendsCount) { $result = $this->repository->getSuggestedFriends($person, $mutualFriendsCount); $this->assertEquals('match (person {firstName: \'' . $person . '\'})-[:FRIEND*2..2]-(friend) ' . 'WITH person AS p, friend AS f, count(friend) AS cnt ' . 'WHERE NOT (p)-[:FRIEND]-(f) AND cnt >= ' . $mutualFriendsCount . ' AND p <> f ' . 'RETURN f.firstName ORDER BY cnt DESC', $result); }