protected function setUp() { // parent::setUp(); self::$TMP_DIR = realpath(dirname(__FILE__)) . "/../../../tmp"; SC_Helper_FileManager::deleteFile(self::$TMP_DIR); mkdir(self::$TMP_DIR, 0700, true); }
public function testSfEncodeFile_ファイルが正常に開けた場合_ファイルがエンコードされ出力先のパスが取得できる() { $outdir = realpath(dirname(__FILE__)) . "/../../../tmp/enc_output/"; SC_Helper_FileManager::deleteFile($outdir); mkdir($outdir, 0777, TRUE); $indir = realpath(dirname(__FILE__)) . "/../../../tmp/enc_input/"; SC_Helper_FileManager::deleteFile($indir); mkdir($indir, 0777, TRUE); $filepath = $indir . 'test.txt'; $fp_out = fopen($filepath, 'w'); fwrite($fp_out, 'こんにちは'); fclose($fp_out); $this->expected = array('filename' => $outdir . 'enc_test.txt', 'content' => 'こんにちは'); $this->actual['filename'] = SC_Utils::sfEncodeFile($filepath, 'euc-jp', $outdir); $fp_in = fopen($outdir . 'enc_test.txt', 'r'); $this->actual['content'] = mb_convert_encoding(fread($fp_in, 100), 'utf8', 'euc-jp'); fclose($fp_in); $this->verify(); }