Beispiel #1
1
 public function setUp()
 {
     $app = new Chat();
     $this->container = $app->getContainer();
     $this->container['API'] = $this->getMockBuilder('\\OCA\\Chat\\Core\\API')->disableOriginalConstructor()->getMock();
     $this->container['API']->expects($this->any())->method('log')->will($this->returnValue(null));
 }
Beispiel #2
0
 public function setUp()
 {
     $app = new Chat();
     $this->container = $app->getContainer();
     $this->container['ConversationMapper'] = $this->getMockBuilder('\\OCA\\Chat\\OCH\\Db\\ConversationMapper')->disableOriginalConstructor()->getMock();
     $this->container['UserOnlineMapper'] = $this->getMockBuilder('\\OCA\\Chat\\OCH\\Db\\UserOnlineMapper')->disableOriginalConstructor()->getMock();
     $this->container['PushMessageMapper'] = $this->getMockBuilder('\\OCA\\Chat\\OCH\\Db\\PushMessageMapper')->disableOriginalConstructor()->getMock();
     $this->container['UserMapper'] = $this->getMockBuilder('\\OCA\\Chat\\OCH\\Db\\UserMapper')->disableOriginalConstructor()->getMock();
     $this->container['API'] = $this->getMockBuilder('\\OCA\\Chat\\Core\\API')->disableOriginalConstructor()->getMock();
     $this->container['InitConvMapper'] = $this->getMockBuilder('\\OCA\\Chat\\OCH\\Db\\InitConvMapper')->disableOriginalConstructor()->getMock();
     $this->container['API']->expects($this->any())->method('log')->will($this->returnValue(null));
 }
Beispiel #3
0
 /**
  * @dataProvider contactsProvider
  */
 public function testContacts($contacts)
 {
     $this->chat->expects($this->once())->method('getContacts')->will($this->returnValue($contacts));
     $expectedData = array("contacts" => $contacts['contacts'], "contactsList" => $contacts['contactsList'], "contactsObj" => $contacts['contactsObj']);
     $response = $this->controller->contacts();
     $this->assertEquals('OCP\\AppFramework\\Http\\JSONResponse', get_class($response));
     // make sure a JSON response is sent
     $this->assertEquals($expectedData, $response->getData());
 }
Beispiel #4
0
 /**
  * this replaces "bad words" with "********" in the output
  */
 public function afterException($controller, $methodName, \Exception $e)
 {
     $this->app->exceptionHandler($e);
 }