From 2dc688dcdf51fc0a54ca104217c252ee342b8f26 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 10 Nov 2014 11:01:43 +0100 Subject: Skip some more tests on Windows which just can not work at all Conflicts: tests/lib/archive/tar.php tests/lib/files/storage/local.php tests/lib/files/view.php --- tests/lib/archive/tar.php | 11 +++++++---- tests/lib/files/view.php | 12 +++++++++++- tests/lib/helper.php | 4 ++++ tests/lib/image.php | 10 +++++++--- 4 files changed, 29 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/lib/archive/tar.php b/tests/lib/archive/tar.php index d831487b16f..2b5271edd52 100644 --- a/tests/lib/archive/tar.php +++ b/tests/lib/archive/tar.php @@ -8,12 +8,16 @@ require_once 'archive.php'; -if (!OC_Util::runningOnWindows()) { class Test_Archive_TAR extends Test_Archive { public function setUp() { - if (floatval(phpversion())>=5.5) { + parent::setUp(); + + if (floatval(phpversion()) >= 5.5) { $this->markTestSkipped('php 5.5 changed unpack function.'); - return; + } + + if (OC_Util::runningOnWindows()) { + $this->markTestSkipped('[Windows] tar archives are not supported on Windows'); } } protected function getExisting() { @@ -25,4 +29,3 @@ class Test_Archive_TAR extends Test_Archive { return new OC_Archive_TAR(OCP\Files::tmpFile('.tar.gz')); } } -} diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php index 522535946a5..c0bac55ca80 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/files/view.php @@ -590,7 +590,17 @@ class View extends \PHPUnit_Framework_TestCase { $longPath = ''; // 4000 is the maximum path length in file_cache.path $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789'; - $depth = (4000 / 57); + + $tmpdirLength = strlen(\OC_Helper::tmpFolder()); + if (\OC_Util::runningOnWindows()) { + $this->markTestSkipped('[Windows] '); + $depth = ((260 - $tmpdirLength) / 57); + } elseif (\OC_Util::runningOnMac()){ + $depth = ((1024 - $tmpdirLength) / 57); + } else { + $depth = ((4000 - $tmpdirLength) / 57); + } + foreach (range(0, $depth - 1) as $i) { $longPath .= '/' . $folderName; $result = $rootView->mkdir($longPath); diff --git a/tests/lib/helper.php b/tests/lib/helper.php index 6146b29b437..de625d144ce 100644 --- a/tests/lib/helper.php +++ b/tests/lib/helper.php @@ -115,6 +115,10 @@ class Test_Helper extends PHPUnit_Framework_TestCase { } function testGetStringMimeType() { + if (\OC_Util::runningOnWindows()) { + $this->markTestSkipped('[Windows] Strings have mimetype application/octet-stream on Windows'); + } + $result = OC_Helper::getStringMimeType("/data/data.tar.gz"); $expected = 'text/plain; charset=us-ascii'; $this->assertEquals($result, $expected); diff --git a/tests/lib/image.php b/tests/lib/image.php index 795bc464159..a683c3d2c8b 100644 --- a/tests/lib/image.php +++ b/tests/lib/image.php @@ -62,14 +62,18 @@ class Test_Image extends PHPUnit_Framework_TestCase { $img = new \OC_Image(OC::$SERVERROOT.'/tests/data/testimage.png'); $this->assertEquals('image/png', $img->mimeType()); + $img = new \OC_Image(null); + $this->assertEquals('', $img->mimeType()); + + if (\OC_Util::runningOnWindows()) { + $this->markTestSkipped('[Windows] Images created with imagecreate() are pngs on windows'); + } + $img = new \OC_Image(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg')); $this->assertEquals('image/jpeg', $img->mimeType()); $img = new \OC_Image(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'))); $this->assertEquals('image/gif', $img->mimeType()); - - $img = new \OC_Image(null); - $this->assertEquals('', $img->mimeType()); } public function testWidth() { -- cgit v1.2.3