Author: Alexandru Stanoi Date: 2007-04-12 11:33:48 +0200 (Thu, 12 Apr 2007) New Revision: 4862
Log: - Skipping tests selectively if fileinfo is installed or not, as it was causing failed tests. Modified: trunk/Mail/tests/parser/parser_test.php Modified: trunk/Mail/tests/parser/parser_test.php =================================================================== --- trunk/Mail/tests/parser/parser_test.php 2007-04-12 08:22:59 UTC (rev 4861) +++ trunk/Mail/tests/parser/parser_test.php 2007-04-12 09:33:48 UTC (rev 4862) @@ -1214,30 +1214,84 @@ $this->assertEquals( null, $filePart->contentDisposition ); } - public function testDefaultUnrecognizedMainTypeParserBug() + public function testDefaultUnrecognizedMainTypeParserBugWithFileInfo() { - $parser = new ezcMailParser(); - $set = new SingleFileSet( 'various/test-unrecognized-mime' ); - $mail = $parser->parseMail( $set ); - $mail = $mail[0]; - $parts = $mail->body->getParts(); - $this->assertEquals( 'ezcMailFile', get_class( $parts[1] ) ); - $this->assertEquals( 'text', $parts[1]->contentType ); - $this->assertEquals( 'unknown', $parts[1]->mimeType ); - $this->assertEquals( 'unknown/unknown; name="unknown.dat"', $parts[1]->getHeader( "Content-Type" ) ); + if ( ezcBaseFeatures::hasExtensionSupport( 'fileinfo' ) ) + { + $parser = new ezcMailParser(); + $set = new SingleFileSet( 'various/test-unrecognized-mime' ); + $mail = $parser->parseMail( $set ); + $mail = $mail[0]; + $parts = $mail->body->getParts(); + $this->assertEquals( 'ezcMailFile', get_class( $parts[1] ) ); + $this->assertEquals( 'text', $parts[1]->contentType ); + $this->assertEquals( 'unknown', $parts[1]->mimeType ); + $this->assertEquals( 'unknown/unknown; name="unknown.dat"', $parts[1]->getHeader( "Content-Type" ) ); + } + else + { + $this->markTestSkipped( "With fileinfo extension the Content-Type of this attachment is recognized as 'text'." ); + } } - public function testDefaultUnrecognizedMessageSubType() + public function testDefaultUnrecognizedMainTypeParserBugWithoutFileInfo() { - $parser = new ezcMailParser(); - $set = new SingleFileSet( 'various/test-unrecognized-subtype' ); - $mail = $parser->parseMail( $set ); - $mail = $mail[0]; - $parts = $mail->body->getParts(); - $this->assertEquals( 'ezcMailFile', get_class( $parts[1] ) ); - $this->assertEquals( 'text', $parts[1]->contentType ); - $this->assertEquals( 'unrecognized', $parts[1]->mimeType ); - $this->assertEquals( 'message/unrecognized; name="unknown.dat"', $parts[1]->getHeader( "Content-Type" ) ); + if ( !ezcBaseFeatures::hasExtensionSupport( 'fileinfo' ) ) + { + $parser = new ezcMailParser(); + $set = new SingleFileSet( 'various/test-unrecognized-mime' ); + $mail = $parser->parseMail( $set ); + $mail = $mail[0]; + $parts = $mail->body->getParts(); + $this->assertEquals( 'ezcMailFile', get_class( $parts[1] ) ); + $this->assertEquals( 'application', $parts[1]->contentType ); + $this->assertEquals( 'unknown', $parts[1]->mimeType ); + $this->assertEquals( 'unknown/unknown; name="unknown.dat"', $parts[1]->getHeader( "Content-Type" ) ); + } + else + { + $this->markTestSkipped( "Without fileinfo extension the Content-Type of attachments are assumed to be 'application'." ); + } } + + public function testDefaultUnrecognizedMessageSubTypeWithFileInfo() + { + if ( ezcBaseFeatures::hasExtensionSupport( 'fileinfo' ) ) + { + $parser = new ezcMailParser(); + $set = new SingleFileSet( 'various/test-unrecognized-subtype' ); + $mail = $parser->parseMail( $set ); + $mail = $mail[0]; + $parts = $mail->body->getParts(); + $this->assertEquals( 'ezcMailFile', get_class( $parts[1] ) ); + $this->assertEquals( 'text', $parts[1]->contentType ); + $this->assertEquals( 'unrecognized', $parts[1]->mimeType ); + $this->assertEquals( 'message/unrecognized; name="unknown.dat"', $parts[1]->getHeader( "Content-Type" ) ); + } + else + { + $this->markTestSkipped( "With fileinfo extension the Content-Type of this attachment is recognized as 'text'." ); + } + } + + public function testDefaultUnrecognizedMessageSubTypeWithoutFileInfo() + { + if ( !ezcBaseFeatures::hasExtensionSupport( 'fileinfo' ) ) + { + $parser = new ezcMailParser(); + $set = new SingleFileSet( 'various/test-unrecognized-subtype' ); + $mail = $parser->parseMail( $set ); + $mail = $mail[0]; + $parts = $mail->body->getParts(); + $this->assertEquals( 'ezcMailFile', get_class( $parts[1] ) ); + $this->assertEquals( 'application', $parts[1]->contentType ); + $this->assertEquals( 'unrecognized', $parts[1]->mimeType ); + $this->assertEquals( 'message/unrecognized; name="unknown.dat"', $parts[1]->getHeader( "Content-Type" ) ); + } + else + { + $this->markTestSkipped( "Without fileinfo extension the Content-Type of attachments are assumed to be 'application'." ); + } + } } ?> -- svn-components mailing list [EMAIL PROTECTED] http://lists.ez.no/mailman/listinfo/svn-components