Index: tests/TestConfiguration.php.dist =================================================================== --- tests/TestConfiguration.php.dist (revision 21208) +++ tests/TestConfiguration.php.dist (working copy) @@ -69,7 +69,7 @@ define('TESTS_ZEND_CACHE_XCACHE_USER', null); define('TESTS_ZEND_CACHE_XCACHE_PASSWORD', null); define('TESTS_ZEND_CACHE_PLATFORM_ENABLED', false); -define('TESTS_ZEND_CACHE_MEMCACHED_ENABLED', false); +define('TESTS_ZEND_CACHE_MEMCACHED_ENABLED', true); define('TESTS_ZEND_CACHE_MEMCACHED_HOST', '127.0.0.1'); define('TESTS_ZEND_CACHE_MEMCACHED_PORT', 11211); define('TESTS_ZEND_CACHE_MEMCACHED_PERSISTENT', true); @@ -553,8 +553,8 @@ * - enable igbinary adapter tests * - needs igbinary php extension installed */ -define('TESTS_ZEND_SERIALIZER_ADAPTER_WDDX_ENABLED', false); -define('TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED', false); +define('TESTS_ZEND_SERIALIZER_ADAPTER_WDDX_ENABLED', true); +define('TESTS_ZEND_SERIALIZER_ADAPTER_IGBINARY_ENABLED', true); /** * Zend_Service_Amazon online tests Index: tests/Zend/Validate/File/MimeTypeTest.php =================================================================== --- tests/Zend/Validate/File/MimeTypeTest.php (revision 21208) +++ tests/Zend/Validate/File/MimeTypeTest.php (working copy) @@ -47,7 +47,15 @@ */ class Zend_Validate_File_MimeTypeTest extends PHPUnit_Framework_TestCase { + /** + * The magic file for testing + * + * @var string + */ + protected $_magicfile; + + /** * Runs the test methods of this class. * * @return void @@ -58,6 +66,11 @@ $result = PHPUnit_TextUI_TestRunner::run($suite); } + public function setUp() + { + $this->_magicfile = dirname(__FILE__) . '/_files/magic'; + } + /** * Ensures that the validator follows expected behavior * @@ -91,6 +104,7 @@ $options = array_shift($element); $expected = array_shift($element); $validator = new Zend_Validate_File_MimeType($options); + $validator->setMagicFile($this->_magicfile); $validator->enableHeaderCheck(); $this->assertEquals( $expected, @@ -168,24 +182,24 @@ { $validator = new Zend_Validate_File_MimeType('image/gif'); if (!empty($_ENV['MAGIC'])) { - $mimetype = $validator->getMagicFile(); - $this->assertEquals($_ENV['MAGIC'], $mimetype); + $mimefile = $validator->getMagicFile(); + $this->assertEquals($_ENV['MAGIC'], $mimefile); } try { $validator->setMagicFile('/unknown/magic/file'); } catch (Zend_Validate_Exception $e) { - $this->assertContains('can not be read', $e->getMessage()); + $this->assertContains("isn't readable", $e->getMessage()); } - $validator->setMagicFile(__FILE__); - $this->assertEquals(__FILE__, $validator->getMagicFile()); + $validator->setMagicFile($this->_magicfile); + $this->assertEquals($this->_magicfile, $validator->getMagicFile()); } public function testSetMagicFileWithinConstructor() { - $validator = new Zend_Validate_File_MimeType(array('image/gif', 'magicfile' => __FILE__)); - $this->assertEquals(__FILE__, $validator->getMagicFile()); + $validator = new Zend_Validate_File_MimeType(array('image/gif', 'magicfile' => $this->_magicfile)); + $this->assertEquals($this->_magicfile, $validator->getMagicFile()); } public function testOptionsAtConstructor() @@ -193,10 +207,10 @@ $validator = new Zend_Validate_File_MimeType(array( 'image/gif', 'image/jpg', - 'magicfile' => __FILE__, + 'magicfile' => $this->_magicfile, 'headerCheck' => true)); - $this->assertEquals(__FILE__, $validator->getMagicFile()); + $this->assertEquals($this->_magicfile, $validator->getMagicFile()); $this->assertTrue($validator->getHeaderCheck()); $this->assertEquals('image/gif,image/jpg', $validator->getMimeType()); } Index: tests/Zend/Validate/File/IsCompressedTest.php =================================================================== --- tests/Zend/Validate/File/IsCompressedTest.php (revision 21208) +++ tests/Zend/Validate/File/IsCompressedTest.php (working copy) @@ -47,7 +47,15 @@ */ class Zend_Validate_File_IsCompressedTest extends PHPUnit_Framework_TestCase { + /** + * The magic file for testing + * + * @var string + */ + protected $_magicfile; + + /** * Runs the test methods of this class. * * @return void @@ -58,6 +66,11 @@ $result = PHPUnit_TextUI_TestRunner::run($suite); } + public function setUp() + { + $this->_magicfile = dirname(__FILE__) . '/_files/magic'; + } + /** * Ensures that the validator follows expected behavior * @@ -191,10 +204,10 @@ $validator = new Zend_Validate_File_IsCompressed(array( 'image/gif', 'image/jpg', - 'magicfile' => __FILE__, + 'magicfile' => $this->_magicfile, 'headerCheck' => true)); - $this->assertEquals(__FILE__, $validator->getMagicFile()); + $this->assertEquals($this->_magicfile, $validator->getMagicFile()); $this->assertTrue($validator->getHeaderCheck()); $this->assertEquals('image/gif,image/jpg', $validator->getMimeType()); } Index: tests/Zend/Validate/File/_files/magic =================================================================== --- tests/Zend/Validate/File/_files/magic (revision 0) +++ tests/Zend/Validate/File/_files/magic (revision 0) @@ -0,0 +1,32 @@ +# a simple magic file only for testing +# $Id$ + +# JPEG images +# SunOS 5.5.1 had +# +# 0 string \377\330\377\340 JPEG file +# 0 string \377\330\377\356 JPG file +# +# both of which turn into "JPEG image data" here. +# +0 beshort 0xffd8 JPEG image data +!:mime image/jpeg +!:apple 8BIMJPEG +!:strength +1 +>6 string JFIF \b, JFIF standard +# The following added by Erik Rossen 1999-09-06 +# in a vain attempt to add image size reporting for JFIF. Note that these +# tests are not fool-proof since some perfectly valid JPEGs are currently +# impossible to specify in magic(4) format. +# First, a little JFIF version info: +>>11 byte x \b %d. +>>12 byte x \b%02d +# Next, the resolution or aspect ratio of the image: +#>>13 byte 0 \b, aspect ratio +#>>13 byte 1 \b, resolution (DPI) +#>>13 byte 2 \b, resolution (DPCM) +#>>4 beshort x \b, segment length %d +# Next, show thumbnail info, if it exists: +>>18 byte !0 \b, thumbnail %dx +>>>19 byte x \b%d + Property changes on: tests/Zend/Validate/File/_files/magic ___________________________________________________________________ Added: svn:keyword + $ Index: tests/Zend/Validate/File/IsImageTest.php =================================================================== --- tests/Zend/Validate/File/IsImageTest.php (revision 21208) +++ tests/Zend/Validate/File/IsImageTest.php (working copy) @@ -47,6 +47,9 @@ */ class Zend_Validate_File_IsImageTest extends PHPUnit_Framework_TestCase { + + protected $_magicfile; + /** * Runs the test methods of this class. * @@ -58,6 +61,11 @@ $result = PHPUnit_TextUI_TestRunner::run($suite); } + public function setUp() + { + $this->_magicfile = dirname(__FILE__) . '/_files/magic'; + } + /** * Ensures that the validator follows expected behavior * @@ -182,10 +190,10 @@ $validator = new Zend_Validate_File_IsImage(array( 'image/gif', 'image/jpg', - 'magicfile' => __FILE__, + 'magicfile' => $this->_magicfile, 'headerCheck' => true)); - $this->assertEquals(__FILE__, $validator->getMagicFile()); + $this->assertEquals($this->_magicfile, $validator->getMagicFile()); $this->assertTrue($validator->getHeaderCheck()); $this->assertEquals('image/gif,image/jpg', $validator->getMimeType()); }