Exemplo n.º 1
0
 public function testGetShareCodes_fileNotFound()
 {
     $fileTitle = '';
     // Empty file title
     $request = $this->getMockBuilder('WikiaRequest')->disableOriginalConstructor()->setMethods(['getVal'])->getMock();
     $request->expects($this->once())->method('getVal')->with('fileTitle', $this->anything())->will($this->returnValue($fileTitle));
     $shareUrl = '';
     $articleUrl = '';
     $fileUrl = '';
     $thumbUrl = '';
     $networks = [];
     $responseArray = ['shareUrl' => $shareUrl, 'articleUrl' => $articleUrl, 'fileUrl' => $fileUrl, 'networks' => $networks, 'fileTitle' => $fileTitle, 'imageUrl' => $thumbUrl];
     $format = \WikiaResponse::FORMAT_HTML;
     $lightboxController = new \LightboxController();
     $lightboxController->setRequest($request);
     $response = new \WikiaResponse($format);
     $lightboxController->setResponse($response);
     $lightboxController->getShareCodes();
     // Inspect response object
     foreach ($responseArray as $key => $value) {
         $this->assertEquals($value, $lightboxController->getResponse()->getVal($key), "mismatch on {$key}");
     }
 }
 /**
  * Instance method to treat image serving for carousel thumb as a singleton bound to this controller instance
  * @return \ImageServing
  */
 private function carouselImageServingInstance()
 {
     if (empty(self::$imageserving)) {
         self::$imageserving = new ImageServing(null, self::THUMBNAIL_WIDTH, self::THUMBNAIL_HEIGHT);
     }
     return self::$imageserving;
 }
 /**
  * instance method to treat image serving for carousel thumb as a singleton bound to this controller instance
  */
 private function carouselImageServingInstance()
 {
     if (empty(self::$imageserving)) {
         self::$imageserving = F::build('ImageServing', array(null, self::THUMBNAIL_WIDTH, self::THUMBNAIL_HEIGHT));
     }
     return self::$imageserving;
 }