Esempio n. 1
0
 /**
  * @covers  Shutterstock\Presto\Presto::logError
  */
 public function testErrorLogging()
 {
     // todo this seems to not want to work
     return;
     $presto = new Presto();
     $this->expectOutputString("{$presto->error_log_prefix}Error");
     $presto->logError('Error');
 }
 /**
  * @covers  Shutterstock\Presto\Presto::processQueue
  */
 public function testQueueProcess()
 {
     Presto::$profiling_count = 0;
     Presto::$profiling = array();
     Presto::initQueue();
     $status_codes = array(401, 404, 418);
     $requests = array();
     foreach ($status_codes as $code) {
         $requests[$code] = new Presto();
         $requests[$code]->queue_enabled = true;
         $requests[$code]->get(self::$TEST_ENDPOINT . "status/{$code}", array(), function (Response $response) {
             return $response->http_code;
         });
     }
     $queue_result = Presto::processQueue();
     $this->assertEquals(true, $queue_result);
     $profiling = Presto::getProfiling();
     $this->assertEquals($status_codes[0], $profiling[0]['http_code']);
     $this->assertEquals($status_codes[1], $profiling[1]['http_code']);
     $this->assertEquals($status_codes[2], $profiling[2]['http_code']);
 }