예제 #1
0
 /**
  * The filename should be returned, without the rest of the path.
  */
 public function testFileNameIsReturned()
 {
     $file = new Swift_File(TestConfiguration::FILES_PATH . "/manchester.jpeg");
     $this->assertEqual("manchester.jpeg", $file->getFileName());
     $file->setPath(__FILE__);
     //TestOfFile.php
     $this->assertEqual(basename(__FILE__), $file->getFileName());
     chdir(TestConfiguration::FILES_PATH);
     $file = new Swift_File("manchester.jpeg");
     $this->assertEqual("manchester.jpeg", $file->getFileName());
 }
예제 #2
0
 /**
  * Return a 8bit string from a file
  * @param Swift_File The file stream to read from
  * @param int Max line length (including CRLF)
  * @param string The line ending
  * @return Swift_Cache_OutputStream
  * @throws Swift_FileException If the file cannot be read
  */
 public function encode8BitFile(Swift_File $file, $chunk = 76, $le = "\r\n")
 {
     Swift_ClassLoader::load("Swift_CacheFactory");
     $cache = Swift_CacheFactory::getCache();
     $ret = "";
     while (false !== ($bytes = $file->read(8192))) {
         $ret .= $bytes;
     }
     $cache->write("8b", $this->fixLE(wordwrap($ret, $chunk - 2, $le, 1), $le));
     return $cache->getOutputStream("8b");
 }