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); }
/** * * @param callable $consumer * @return BinaryConsumerInterface */ public static final function newBinaryConsumer(callable $consumer) : BinaryConsumerInterface { return BinaryConsumer::create($consumer); }