Commits

Thomas Weinert  committed fb0a844

Tested: Carica\Io\Deferred\Promise::then()

  • Participants
  • Parent commits db33077

Comments (0)

Files changed (1)

File tests/Io/Deferred/PromiseTest.php

       $promise = new Promise($defer);
       $this->assertEquals(Io\Deferred::STATE_PENDING, $promise->state());
     }
+
+    /**
+     * @covers Carica\Io\Deferred\Promise::then
+     */
+    public function testThenWithNullArguments() {
+      $function = function() {};
+      $defer = $this->getMock('Carica\Io\Deferred');
+      $defer
+        ->expects($this->once())
+        ->method('then')
+        ->with(NULL, NULL, NULL)
+        ->will($this->returnSelf());
+
+      $promise = new Promise($defer);
+      $this->assertSame($promise, $promise->then());
+    }
+
+    /**
+     * @covers Carica\Io\Deferred\Promise::then
+     */
+    public function testThenWithFunctionArguments() {
+      $function = function() {};
+      $defer = $this->getMock('Carica\Io\Deferred');
+      $defer
+        ->expects($this->once())
+        ->method('then')
+        ->with($function, $function, $function)
+        ->will($this->returnSelf());
+
+      $promise = new Promise($defer);
+      $this->assertSame($promise, $promise->then($function, $function, $function));
+    }
   }
 }