diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-17 08:40:59 +0100 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2014-08-26 19:39:46 +0200 |
commit | f3d335b7c1ece35cfbd2dd1d866eb7699cb63514 (patch) | |
tree | a8f0e499920610710c5bd1cf039aadc068a9ab15 /tests | |
parent | 6da05d0ca45ccbc600790bafd13d70a2ff541f8f (diff) | |
download | nextcloud-server-f3d335b7c1ece35cfbd2dd1d866eb7699cb63514.tar.gz nextcloud-server-f3d335b7c1ece35cfbd2dd1d866eb7699cb63514.zip |
unit tests for specific image type output added
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/image.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/lib/image.php b/tests/lib/image.php index 4aba1b0bc61..131a9d86f3e 100644 --- a/tests/lib/image.php +++ b/tests/lib/image.php @@ -8,8 +8,8 @@ class Test_Image extends PHPUnit_Framework_TestCase { public static function tearDownAfterClass() { - unlink(OC::$SERVERROOT.'/tests/data/testimage2.png'); - unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); + @unlink(OC::$SERVERROOT.'/tests/data/testimage2.png'); + @unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); } public function testGetMimeTypeForFile() { @@ -236,4 +236,24 @@ class Test_Image extends PHPUnit_Framework_TestCase { $this->assertEquals(200, $img->width()); $this->assertEquals(200, $img->height()); } + + function convertDataProvider() { + return array( + array( 'image/gif'), + array( 'image/jpeg'), + array( 'image/png'), + ); + } + + /** + * @dataProvider convertDataProvider + */ + public function testConvert($mimeType) { + $img = new \OC_Image(OC::$SERVERROOT.'/tests/data/testimage.png'); + $tempFile = tempnam(sys_get_temp_dir(), 'img-test'); + + $img->save($tempFile, $mimeType); + $actualMimeType = \OC_Image::getMimeTypeForFile($tempFile); + $this->assertEquals($mimeType, $actualMimeType); + } } |