1 | <?php |
||
24 | class AutoConfigControllerTest extends TestCase { |
||
25 | |||
26 | private $request; |
||
27 | private $service; |
||
28 | private $controller; |
||
29 | |||
30 | protected function setUp() { |
||
31 | parent::setUp(); |
||
32 | |||
33 | $this->request = $this->getMock('OCP\IRequest'); |
||
34 | $this->service = $this->getMockBuilder('OCA\Mail\Service\AutoCompletion\AutoCompleteService') |
||
35 | ->disableOriginalConstructor() |
||
36 | ->getMock(); |
||
37 | $this->controller = new AutoCompleteController('mail', $this->request, |
||
38 | $this->service); |
||
39 | } |
||
40 | |||
41 | public function testAutoComplete() { |
||
42 | $term = 'john d'; |
||
43 | $result = 'johne doe'; |
||
44 | |||
45 | $this->service->expects($this->once()) |
||
46 | ->method('findMatches') |
||
47 | ->with($this->equalTo($term)) |
||
48 | ->will($this->returnValue($result)); |
||
49 | |||
50 | $response = $this->controller->index($term); |
||
51 | |||
52 | $this->assertEquals($result, $response); |
||
53 | } |
||
54 | |||
55 | } |
||
56 |