/** * @test */ public function testGetGravatarForUser() { $details = $this->createDummyUserDetails(); $this->userService->expects($this->once())->method('getGravatarLink')->with($this->equalTo('*****@*****.**'), $this->equalTo(58))->will($this->returnValue(sprintf('http://gravatar.com/avatar/%s.jpg?s=58&d=identicon', $this->getHash($details->getEmail())))); $link = $this->userDetailsExtension->getGravatarForUser($details->getEmail()); $this->assertEquals(sprintf('http://gravatar.com/avatar/%s.jpg?s=58&d=identicon', $this->getHash($details->getEmail())), $link); }
/** * @test */ public function testSearchWithNotEmptyQuery() { $query = 'Name'; $expectedDiamanteUsers = 1; $expectedOroUsers = 3; $totalExpectedResult = $expectedDiamanteUsers + $expectedOroUsers; $this->userService->expects($this->once())->method('getGravatarLink')->with($this->equalTo('*****@*****.**', DiamanteUserSearchHandler::AVATAR_SIZE)); $this->diamanteUserRepository->expects($this->once())->method('searchByInput')->with($this->equalTo($query), $this->equalTo($this->getProperties()))->will($this->returnValue($this->getDiamanteUsersCollection($expectedDiamanteUsers, $query))); $this->userSearchHandler->expects($this->once())->method('search')->with($this->equalTo($query), 1, 10)->will($this->returnValue(array('results' => $this->getOroUsersCollection($expectedOroUsers, $query), 'more' => false))); $result = $this->diamanteUserSearchHandler->search($query, 1, 10); $this->assertInternalType('array', $result); $this->assertTrue(array_key_exists('results', $result)); $this->assertEquals($totalExpectedResult, count($result['results'])); foreach ($result['results'] as $item) { $this->assertStringEndsWith($query, $item['firstName']); } }