Ejemplo n.º 1
0
 /**
  * Test that is() methods return a bool dependent on the mime type.
  */
 public function testIs()
 {
     $this->assertTrue(MimeType::isApplication('application/x-7z-compressed'));
     $this->assertFalse(MimeType::isApplication('image/png'));
     $this->assertTrue(MimeType::isAudio('audio/midi'));
     $this->assertFalse(MimeType::isAudio('text/xml'));
     $this->assertTrue(MimeType::isImage('image/gif'));
     $this->assertFalse(MimeType::isImage('text/plain'));
     $this->assertTrue(MimeType::isText('text/yaml'));
     $this->assertFalse(MimeType::isText('video/mp4'));
     $this->assertTrue(MimeType::isVideo('video/mp4'));
     $this->assertFalse(MimeType::isVideo('application/x-7z-compressed'));
     $this->assertTrue(MimeType::isSubType('archive', 'application/x-7z-compressed'));
     $this->assertFalse(MimeType::isSubType('archive', 'video/mp4'));
 }
Ejemplo n.º 2
0
 /**
  * Return true if the file is a text.
  *
  * @uses Transit\MimeType
  *
  * @return bool
  */
 public function isText()
 {
     return MimeType::isText($this);
 }