/**
  * Test update process statistics
  */
 public function testUpdateStatistics()
 {
     $TaskClient = $this->getMock('TaskClient');
     $TaskServer = $this->getMock('TaskServer', array('stopped', 'started', 'updated', 'mustStop'));
     $TaskServer->useDbConfig = 'test';
     $TaskServer->expects($this->once())->method('started');
     $TaskServer->expects($this->once())->method('stopped');
     $TaskServer->expects($this->any())->method('updated');
     $TaskServer->expects($this->any())->method('mustStop')->will($this->returnValue(false));
     $Shell = $this->getMock('Shell', array('out', 'err'));
     $task = array('id' => 1, 'path' => '', 'command' => $this->executable, 'arguments' => array('-f' => $this->_code2File('$a = array(); while(count($a) < 20000){ $a = array_merge($a, array(new stdClass));}')), 'timeout' => 100);
     $TaskRunner = new TaskRunner($task, $TaskServer, $TaskClient, $Shell);
     $runnedTask = $TaskRunner->start();
     $statistics = ClassRegistry::init('Task.TaskStatistics')->find('all', array('conditions' => array('task_id' => $runnedTask['id'])));
     $this->assertGreaterThan(1, count($statistics));
     $statisticsOne = $statistics[count($statistics) - 1]['TaskStatistics'];
     $this->assertGreaterThan(0, (double) $statisticsOne['memory']);
     $this->assertGreaterThan(0, (double) $statisticsOne['cpu']);
     $this->assertNotEmpty($statisticsOne['status']);
 }