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