Ejemplo n.º 1
0
 /**
  *
  */
 public function testApiReduce_CancelsPromisedInputValues()
 {
     $test = $this->getTest();
     $p1 = (new Deferred())->getPromise();
     $p2 = (new Deferred())->getPromise();
     $p1->then(null, null, $test->expectCallableOnce());
     $p2->then(null, null, $test->expectCallableOnce());
     Promise::reduce([$p1, $p2], $this->plus(), 1)->cancel();
 }
Ejemplo n.º 2
0
 /**
  * @override
  * @inheritDoc
  */
 public function getRuntimes()
 {
     return Promise::reduce([$this->getThreads(), $this->getProcesses()], function ($carry, $item) {
         return array_unique(array_merge($carry, $item));
     }, []);
 }