public function testGetTaskData() { $input = new \phalanx\base\Dictionary(array('foo' => 'bar')); $task = new TestTask($input); $task->Fire(); $data = $this->handler->T_GetTaskData($task); $expected = array('will_fire' => FALSE, 'fire' => TRUE, 'cleanup' => FALSE, 'out1' => 'foo', 'out2' => 'bar', 'out3' => 'moo', 'id' => NULL, 'input' => $input); $this->assertType('phalanx\\base\\Dictionary', $data); $this->assertEquals($expected, $data->ToArray()); $this->assertFalse($task->out2_never_true); }
public function testGetInput() { $args = _Args('test-task', '--key1', 'value', '--flag', 'special'); $this->dispatcher->T_set_cli_input($this->dispatcher->T_ParseArguments($args)); $gathered_input = $this->dispatcher->T_GetInput(TestTask::InputList()); $this->assertEquals(1, $gathered_input->Count()); $this->assertEquals('value', $gathered_input->key1); $this->assertNull($gathered_input->key2); }
public function testGetInputPOSTMissingKey() { $_POST['key1'] = 'foo'; $this->dispatcher->T_set_request_method('POST'); $gathered_input = $this->dispatcher->T_GetInput(TestTask::InputList()); $this->assertEquals(2, $gathered_input->Count()); $this->assertEquals('foo', $gathered_input->key1); $this->assertEquals('POST', $gathered_input->_method); $this->assertNull($gathered_input->key2); }
public function WillFire() { parent::WillFire(); $this->Cancel(); }
public function testPreemptAndCancel() { $task = new PreemptedCancelledTask(); $inner_task = new TestTask(); $task->inner_task = $inner_task; $this->assertEquals(0, $this->pump->GetTaskHistory()->Count()); $this->pump->QueueTask($task); $this->assertEquals(1, $this->pump->GetTaskHistory()->Count()); $this->assertTrue($task->will_fire); $this->assertFalse($task->fire); $this->assertTrue($task->cleanup); $this->assertTrue($task->is_cancelled()); $this->assertTrue($inner_task->will_fire); $this->assertTrue($inner_task->fire); $this->assertTrue($inner_task->cleanup); $this->assertFalse($inner_task->is_cancelled()); }