Пример #1
0
 private function addMockedVersionsToFileProfile()
 {
     $imageProvider = $this->getMockedVersionProvider(array('imagenizer'));
     $imageProvider->expects($this->any())->method('isSharedResourceAllowed')->will($this->returnValue(true));
     $imageProvider->expects($this->any())->method('isApplicableTo')->will($this->returnCallback(function (File $file) {
         return $file->getMimetype() == 'image/png';
     }));
     $videoProvider = $this->getMockedVersionProvider(array('videonizer'));
     $videoProvider->expects($this->any())->method('isSharedResourceAllowed')->will($this->returnValue(false));
     $videoProvider->expects($this->any())->method('isApplicableTo')->will($this->returnCallback(function (File $file) {
         return $file->getMimetype() == 'video/lus';
     }));
     $globalProvider = $this->getMockedVersionProvider(array('globalizer'));
     $globalProvider->expects($this->any())->method('isSharedResourceAllowed')->will($this->returnValue(true));
     $globalProvider->expects($this->any())->method('isApplicableTo')->will($this->returnCallback(function (File $file) {
         return true;
     }));
     $this->fileProfile->addFileVersion('imagenizer', $imageProvider);
     $this->fileProfile->addFileVersion('videonizer', $videoProvider);
     $this->fileProfile->addFileVersion('globalizer', $globalProvider);
     $this->fileProfile->addPlugin($imageProvider);
     $this->fileProfile->addPlugin($videoProvider);
     $this->fileProfile->addPlugin($globalProvider);
     return array('video' => $videoProvider, 'global' => $globalProvider, 'image' => $imageProvider);
 }