blob: 12f1560e2e801b79c53a6c73d48fd24f0bd3eca1 [file] [log] [blame]
<?php
/**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @copyright Copyright (C) 2005-2010 eZ Systems AS. All rights reserved.
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @version //autogentag//
* @filesource
* @package Mail
* @subpackage Tests
*/
// TODO.. remove this
class SingleFileSetMP implements ezcMailParserSet
{
private $fp = null;
public function __construct( $file )
{
$fp = fopen( dirname( __FILE__ ).'/..' .'/data/' . $file, 'r' );
if ( $fp == false )
{
throw new Exception( "Could not open file '{$file}' for testing." );
}
$this->fp = $fp;
// while (!feof($fp)) {
// $buffer = fgets($fp, 4096);
// echo $buffer;
// }
}
public function hasData()
{
return !feof( $this->fp );
}
public function getNextLine()
{
if ( feof( $this->fp ) )
{
if ( $this->fp != null )
{
fclose( $this->fp );
$this->fp = null;
}
return null;
}
$next = rtrim( fgets( $this->fp ), "\r\n" );
if ( $next == "" && feof( $this->fp ) ) // eat last linebreak
{
return null;
}
return $next;
}
public function nextMail()
{
return false;
}
}
/**
* These tests just test the overall functionality of the multipart functionality.
*
* @package Mail
* @subpackage Tests
*/
class ezcMailMultipartMixedParserTest extends ezcTestCase
{
public static function suite()
{
return new PHPUnit_Framework_TestSuite( "ezcMailMultipartMixedParserTest" );
}
public function testKmail1()
{
$parser = new ezcMailParser();
$set = new SingleFileSetMP( 'kmail/mail_with_attachment.mail' );
$mail = $parser->parseMail( $set );
}
}
?>