test another scenario
[auerswald-callnotifier.git] / tests / callnotifier / CallMonitorTest.php
index 309a5e6d7a6564c64522c6af40bcd20addfb284e..f40f47df242130ace46973721b06c17dc6cf673e 100644 (file)
@@ -38,21 +38,39 @@ class CallMonitorTest extends \PHPUnit_Framework_TestCase implements Logger
         $this->loadDump('intern-22-zu-41.bin');
         $this->assertCallCount(1, 1);
 
+        $this->assertOutgoing($this->calls['startingCall'][0]);
         $this->assertFrom('22', $this->calls['startingCall'][0]);
         $this->assertTo('**41', $this->calls['startingCall'][0]);
 
+        $this->assertOutgoing($this->calls['finishedCall'][0]);
         $this->assertFrom('22', $this->calls['finishedCall'][0]);
         $this->assertTo('**41', $this->calls['finishedCall'][0]);
     }
 
-    public function testIntCallToExternal()
+    public function testAnalogIntCallToExternal()
     {
         $this->loadDump('intern-analog-zu-handy.bin');
         $this->assertCallCount(1, 1);
 
+        $this->assertOutgoing($this->calls['startingCall'][0]);
         $this->assertFrom('40862', $this->calls['startingCall'][0]);
         $this->assertTo('01634779878', $this->calls['startingCall'][0]);
 
+        $this->assertOutgoing($this->calls['finishedCall'][0]);
+        $this->assertFrom('40862', $this->calls['finishedCall'][0]);
+        $this->assertTo('01634779878', $this->calls['finishedCall'][0]);
+    }
+
+    public function testIsdnIntCallToExternal()
+    {
+        $this->loadDump('intern-22-zu-handy.bin');
+        $this->assertCallCount(1, 1);
+
+        $this->assertOutgoing($this->calls['startingCall'][0]);
+        $this->assertFrom('40862', $this->calls['startingCall'][0]);
+        $this->assertTo('01634779878', $this->calls['startingCall'][0]);
+
+        $this->assertOutgoing($this->calls['finishedCall'][0]);
         $this->assertFrom('40862', $this->calls['finishedCall'][0]);
         $this->assertTo('01634779878', $this->calls['finishedCall'][0]);
     }
@@ -62,9 +80,11 @@ class CallMonitorTest extends \PHPUnit_Framework_TestCase implements Logger
         $this->loadDump('handy-zu-gruppe.bin');
         $this->assertCallCount(1, 1);
 
+        $this->assertIncoming($this->calls['startingCall'][0]);
         $this->assertFrom('01634779878', $this->calls['startingCall'][0]);
         $this->assertTo('40862', $this->calls['startingCall'][0]);
 
+        $this->assertIncoming($this->calls['finishedCall'][0]);
         $this->assertFrom('01634779878', $this->calls['finishedCall'][0]);
         $this->assertTo('40862', $this->calls['finishedCall'][0]);
     }
@@ -97,6 +117,22 @@ class CallMonitorTest extends \PHPUnit_Framework_TestCase implements Logger
         );
     }
 
+    protected function assertIncoming(CallMonitor_Call $call)
+    {
+        $this->assertSame(
+            CallMonitor_Call::INCOMING, $call->type,
+            'Call should be "incoming"'
+        );
+    }
+
+    protected function assertOutgoing(CallMonitor_Call $call)
+    {
+        $this->assertSame(
+            CallMonitor_Call::OUTGOING, $call->type,
+            'Call should be "outgoing"'
+        );
+    }
+
 }
 
 ?>