diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2014-04-30 19:14:50 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2014-04-30 19:14:50 +0200 |
| commit | 8b450bb3ff801df8ac5522870325eb46543d2cd2 (patch) | |
| tree | ac627c99776ca878a3c6866c76e8303cfcade448 /src | |
| parent | 825c9662ddc1c534712056c458c8f6d71b81b921 (diff) | |
| download | phorkie-8b450bb3ff801df8ac5522870325eb46543d2cd2.tar.gz phorkie-8b450bb3ff801df8ac5522870325eb46543d2cd2.zip | |
check if mime type detection works
Diffstat (limited to 'src')
| -rw-r--r-- | src/phorkie/Repository/Post.php | 2 | ||||
| -rw-r--r-- | src/phorkie/SetupCheck.php | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 39798b5..c9f6a53 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -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); diff --git a/src/phorkie/SetupCheck.php b/src/phorkie/SetupCheck.php index e4db48d..5eae1f3 100644 --- a/src/phorkie/SetupCheck.php +++ b/src/phorkie/SetupCheck.php @@ -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); |
