예제 #1
0
파일: Worker.php 프로젝트: djfm/ftr
 public function run()
 {
     $maybePlan = $this->client->query(['type' => 'getPlan']);
     if (isset($maybePlan['plan'])) {
         $plan = ExecutionPlanHelper::unserialize($maybePlan['plan']);
         $this->planToken = $maybePlan['planToken'];
         $this->processPlan($plan);
     }
 }
예제 #2
0
 public function testExecutionPlanSerialization()
 {
     $loader = new TestClassLoader();
     $plan = $loader->loadFile(__DIR__ . '/fixtures/ASimpleTest.php');
     $executionPlans = $plan->getExecutionPlans();
     $this->assertEquals(1, count($executionPlans));
     $executionPlan = $executionPlans[0];
     $json = ExecutionPlanHelper::serialize($executionPlan);
     $unserialized = ExecutionPlanHelper::unSerialize($json);
     $this->assertEquals($executionPlan->toArray(), $unserialized->toArray());
 }
예제 #3
0
파일: Runner.php 프로젝트: djfm/ftr
 public function dispatchPlan()
 {
     if (empty($this->executionPlans)) {
         return [];
     }
     $data = [];
     $plan = array_shift($this->executionPlans);
     $this->dispatchedCount++;
     $planToken = count($this->executionPlans);
     $this->dispatchedPlans[$planToken] = ['dispatchedAt' => time(), 'plan' => $plan];
     $this->log('<comment>>>> Dispatching plan ' . $planToken . '</comment>');
     $data['planToken'] = $planToken;
     $data['plan'] = ExecutionPlanHelper::serialize($plan);
     return $data;
 }