check if mime type detection works
authorChristian Weiske <cweiske@cweiske.de>
Wed, 30 Apr 2014 17:14:50 +0000 (19:14 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 30 Apr 2014 17:14:50 +0000 (19:14 +0200)
src/phorkie/Repository/Post.php
src/phorkie/SetupCheck.php

index 39798b57608d36ac1b1ab8fa5cd4604e8dc4322b..c9f6a537ae1016698770382f25cd038f03db445e 100644 (file)
@@ -228,7 +228,7 @@ class Repository_Post
         return $prefix . $num;
     }
 
-    protected function getType($content)
+    public function getType($content)
     {
         $tmp = tempnam(sys_get_temp_dir(), 'phorkie-autodetect-');
         file_put_contents($tmp, $content);
index e4db48d4143f11afc2a6c6bbd1ca5bb77d98521d..5eae1f39f9a528a766a508db5b109fd5b4ed8909 100644 (file)
@@ -35,6 +35,7 @@ class SetupCheck
         $sc->checkDirs();
         $sc->checkGit();
         $sc->checkDatabase();
+        $sc->checkMimeTypeDetection();
     }
 
     public function checkDeps()
@@ -104,6 +105,14 @@ class SetupCheck
         $dbs->getSetup()->setup();
     }
 
+    public function checkMimeTypeDetection()
+    {
+        $rp = new Repository_Post();
+        if ($rp->getType('<?php echo "foo"; ?>') != 'php') {
+            $this->fail('MIME type detection fails');
+        }
+    }
+
     public function fail($msg)
     {
         throw new Exception($msg);