get() public method

public get ( $id )
Example #1
0
 public function testMediaTypes()
 {
     $data = ['application/pdf' => 'document', 'application/msword' => 'document', 'application/vnd.ms-excel' => 'document', 'application/zip' => 'document', 'text/html' => 'document', 'image/jpg' => 'image', 'image/jepg' => 'image', 'image/gif' => 'image', 'image/png' => 'image', 'image/vnd.adobe.photoshop' => 'image', 'video/mp4' => 'video', 'video/mov' => 'video', 'audio/mpeg' => 'audio', 'audio/mp3' => 'audio'];
     foreach ($data as $mimeType => $mediaType) {
         $mediaTypeName = null;
         $id = $this->typeManager->getMediaType($mimeType);
         $setMediaType = $this->typeManager->get($id);
         if ($setMediaType) {
             $mediaTypeName = $setMediaType->getName();
         }
         $this->assertEquals($mediaTypeName, $mediaType);
     }
 }