/**
  * @expectedException RuntimeException
  */
 public function testOnReceivedNode()
 {
     $eventMock = m::mock('Zend\\EventManager\\EventInterface');
     $nodeMock = m::mock('Tmv\\WhatsApi\\Message\\Node\\NodeInterface');
     $nodeMock->shouldReceive('hasChild')->with('system-shutdown')->once()->andReturn(true);
     $eventMock->shouldReceive('getParam')->with('node')->once()->andReturn($nodeMock);
     $this->object->onReceivedNode($eventMock);
 }
 public function testOnReceivedNode()
 {
     $eventMock = m::mock('Zend\\EventManager\\EventInterface');
     $nodeMock = m::mock('Tmv\\WhatsApi\\Message\\Node\\NodeInterface');
     $client = m::mock('Tmv\\WhatsApi\\Client');
     $client->shouldReceive('sendNode')->once();
     $nodeMock->shouldReceive('getAttribute')->with('type')->twice()->andReturn('status');
     $nodeMock->shouldReceive('hasAttribute')->with('to')->once()->andReturn(true);
     $nodeMock->shouldReceive('getAttribute')->with('to')->once()->andReturn('test-to');
     $nodeMock->shouldReceive('hasAttribute')->with('participant')->once()->andReturn(true);
     $nodeMock->shouldReceive('getAttribute')->with('participant')->once()->andReturn('test-participant');
     $nodeMock->shouldReceive('getAttribute')->with('from')->once()->andReturn('test-from');
     $nodeMock->shouldReceive('getAttribute')->with('id')->once()->andReturn('test-id');
     $nodeMock->shouldReceive('getName')->once()->andReturn('notification');
     $eventMock->shouldReceive('getParam')->with('node')->once()->andReturn($nodeMock);
     $eventMock->shouldReceive('getTarget')->andReturn($client);
     $this->object->onReceivedNode($eventMock);
 }