Exemplo n.º 1
0
 /**
  * @dataProvider dataGetRemote
  *
  * @param string $searchTerm
  * @param array $contacts
  * @param array $exactExpected
  * @param array $expected
  * @param bool $reachedEnd
  */
 public function testGetRemote($searchTerm, $contacts, $exactExpected, $expected, $reachedEnd)
 {
     $this->contactsManager->expects($this->any())->method('search')->with($searchTerm, ['CLOUD', 'FN'])->willReturn($contacts);
     $this->invokePrivate($this->sharees, 'getRemote', [$searchTerm]);
     $result = $this->invokePrivate($this->sharees, 'result');
     $this->assertEquals($exactExpected, $result['exact']['remotes']);
     $this->assertEquals($expected, $result['remotes']);
     $this->assertCount((int) $reachedEnd, $this->invokePrivate($this->sharees, 'reachedEndFor'));
 }
 /**
  * @dataProvider dataGetDisplayNameFromContactThrows
  *
  * @param array $addressReturn
  */
 public function testGetDisplayNameFromContactThrows(array $addressReturn)
 {
     $this->contactsManager->expects($this->once())->method('search')->with('test@localhost', ['CLOUD'])->willReturn($addressReturn);
     $formatter = $this->getFormatter();
     try {
         $this->invokePrivate($formatter, 'getDisplayNameFromContact', ['test@localhost']);
         $this->assertTrue(false, 'Asserting that OutOfBoundsException is thrown');
     } catch (\OutOfBoundsException $e) {
         $this->assertTrue(true, 'Asserting that OutOfBoundsException is thrown');
     }
     try {
         $this->invokePrivate($formatter, 'getDisplayNameFromContact', ['test@localhost']);
         $this->assertTrue(false, 'Asserting that OutOfBoundsException is thrown');
     } catch (\OutOfBoundsException $e) {
         $this->assertTrue(true, 'Asserting that OutOfBoundsException is thrown');
     }
 }