예제 #1
0
 public function testConsume()
 {
     $consumer = BinaryConsumer::create(self::getCallable());
     $a = rand(1, 100);
     $b = rand(1, 100);
     ob_start();
     $consumer->consume($a, $b);
     $result = trim(ob_get_clean());
     $this->assertEquals("" . ($a + $b), $result);
 }
예제 #2
0
 /**
  *
  * @param callable $consumer
  * @return BinaryConsumerInterface
  */
 public static final function newBinaryConsumer(callable $consumer) : BinaryConsumerInterface
 {
     return BinaryConsumer::create($consumer);
 }