Example #1
0
 /**
  * Tests insertion of callable components (sources, workers and targets).
  */
 public function testAddCallableComponent()
 {
     $pb = new ProcedureBuilder();
     $pb->addSource(function (Request $request) {
         return new Response();
     });
     $pb->addWorker(function (ObjectInterface $object) {
     });
     $pb->addTarget(function (Request $request) {
         return new Response();
     });
     $procedure = $pb->getProcedure();
     $sources = $procedure->getSources();
     $workers = $procedure->getWorkers();
     $targets = $procedure->getTargets();
     $this->assertCount(1, $sources);
     $this->assertInstanceOf('Transfer\\Adapter\\CallbackAdapter', $sources[0][0]);
     $this->assertCount(1, $workers);
     $this->assertInstanceOf('Transfer\\Worker\\WorkerInterface', $workers[0]);
     $this->assertCount(1, $targets);
     $this->assertInstanceOf('Transfer\\Adapter\\CallbackAdapter', $targets[0]);
 }