Пример #1
0
 public function testCountErrorsWithDebugHandler()
 {
     $handler = new DebugHandler();
     $logger = new Logger(__METHOD__, array($handler));
     $this->assertTrue($logger->debug('test message'));
     $this->assertTrue($logger->info('test message'));
     $this->assertTrue($logger->notice('test message'));
     $this->assertTrue($logger->warning('test message'));
     $this->assertTrue($logger->error('test message'));
     $this->assertTrue($logger->critical('test message'));
     $this->assertTrue($logger->alert('test message'));
     $this->assertTrue($logger->emergency('test message'));
     $this->assertSame(4, $logger->countErrors());
 }
Пример #2
0
 /**
  * Store bundles
  * 
  * This method will store
  * the application bundles
  * that contain navbar 
  * config files
  * 
  * @param KernelInterface $kernel - the application kernel
  * 
  * @return NavBarLoader - the current instance
  */
 protected function storeBundles(KernelInterface $kernel)
 {
     foreach ($kernel->getBundles() as $bundle) {
         if ($bundle instanceof Bundle) {
             $file = $bundle->getPath() . $this->basePath;
             if (is_file($file) && is_readable($file)) {
                 $this->bundles->add($bundle);
             } else {
                 if (is_file($file) && !is_readable($file)) {
                     $this->logger->warning("File " . $file . " is not readable");
                 }
             }
         }
     }
     return $this;
 }
 /**
  * @param UploadedFile $file
  * @param string $clientName
  * @param string $context
  *
  * @return \Avtonom\MediaStorageClientBundle\Entity\ProxyMediaInterface
  *
  * @throws MediaStorageClientManagerException
  * @throws \Avtonom\MediaStorageClientBundle\Exception\MediaStorageClientProxyMediaManagerException
  */
 public function sendFile(UploadedFile $file, $clientName, $context)
 {
     try {
         $response = $this->apiService->sendFile($file, $clientName, $context);
     } catch (MediaStorageClientApiException $e) {
         $this->logger->error($e->getMessage());
         throw new MediaStorageClientManagerException($e->getMessage());
     }
     if ($response && $response->isOk()) {
         $content = json_decode($response->getContent(), true);
         if ($content && !json_last_error() && is_array($content) && array_key_exists('reference_full', $content)) {
             $proxyMedia = $this->proxyMediaManager->createFromResponse($response);
             return $proxyMedia;
         }
         $this->logger->warning('Client not response new value: ' . $content);
         throw new MediaStorageClientManagerException('Client not response new value');
     }
     $this->logger->warning('Client response code: ' . $response->getStatusCode() . ' ' . $response->getContent());
     throw new MediaStorageClientManagerException('Client response code: ' . $response->getStatusCode());
 }