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); } }
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()); }
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; }