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);
 }