Exemplo n.º 1
0
 /**
  * @test
  * @dataProvider enrichLogDataByComponentEnrichesDataArrayDataProvider
  *
  * @param integer $userId
  * @param string $component
  * @param array $expected
  */
 public function enrichLogDataByComponentEnrichesDataArray($userId, $component, $expected)
 {
     $actual = array();
     $GLOBALS['TSFE']->fe_user->user['uid'] = $userId;
     $this->proxy->enrichLogDataByComponent($actual, $component);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 2
0
 /**
  * @return ObjectStorage
  */
 public function getResult()
 {
     if (count($this->result) === 0) {
         $this->logger->info(sprintf("Command result size is %s bytes", strlen($this->rawResult)), __CLASS__);
         $this->buildResult();
     }
     return $this->result;
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function loggerSendsEmailOnError()
 {
     $mailerMock = $this->objectManager->get('Tx_PtTest_Utility_Mailer');
     /** @var Tx_PtTest_Utility_Mailer $mailerMock */
     $mailerMock->prepare();
     $this->logger->critical('The fantastic three', get_class($this), array('time' => 42.1337, 'name' => 'Summer', 'part' => 'Sun', 'multiPart' => array('a', 'b', 'c'), 'weather' => 'Sunshine'));
     $mail = $mailerMock->getFirstMail();
     $this->assertEquals(file_get_contents(ExtensionManagementUtility::extPath('pt_extbase') . 'Tests/Functional/Logger/ExpectedErrorMail.txt'), $mail->getBody());
 }
Exemplo n.º 4
0
 /**
  * Executes the wget command
  *
  * @return string
  */
 public function execute()
 {
     $command = $this->buildCommand();
     TimeTracker::start($command);
     $this->logger->debug('Executing WGet command ' . $command, __CLASS__);
     exec($command, $outputLines, $returnVar);
     $this->logger->debug('Called WGet command returned status ' . $returnVar, __CLASS__, array('time' => TimeTracker::stop($command)));
     return implode('\\n', $outputLines);
 }
Exemplo n.º 5
0
 /**
  * @param mixed $error
  * @return void
  */
 protected function handleError($error)
 {
     if ($error instanceof Error) {
         $this->logger->error(sprintf('%s (%s)', $error->getMessage(), $error->getCode()));
         echo $error->getCode();
     } else {
         $this->logger->error('Unknown Error while dispatching the controller action. (1400683671)', get_class($this));
         echo 1400683671;
     }
 }
Exemplo n.º 6
0
 /**
  * @return void
  */
 protected function logToApplicationLog()
 {
     $data = array();
     $this->addTaskLoggerData($data);
     $this->logger->info(sprintf('Scheduler Task "%s" completed.', trim($this->getTaskTitle())), get_class($this), $data);
 }
Exemplo n.º 7
0
 /**
  * @return string
  */
 protected function executeCommandLineOnShell()
 {
     $this->logger->debug(sprintf("Running command %s", $this->commandLine), __CLASS__);
     $this->shellCommandService->setRedirectStandardErrorToStandardOut(true);
     return $this->shellCommandService->execute($this->commandLine);
 }
Exemplo n.º 8
0
 /**
  * @return void
  */
 protected function checkResult()
 {
     if ($this->exitCode !== 0) {
         $this->logger->error(sprintf("Shell command \"%s\" returned exist status %s", $this->command, $this->exitCode), __CLASS__);
     }
 }