Esempio n. 1
0
 public function testGetFilePathReturnsFullyQualifiedPath()
 {
     $file = new LocalFile(static::$dir . 'file_path.test');
     $file->put('random');
     $expected = static::$dir . 'file_path.test';
     static::assertEquals($expected, $file->getPath());
 }
Esempio n. 2
0
 public function testChangeEncodingCanConvertBetweenUTF8AndUTF16()
 {
     $utf8file = new LocalFile(static::$dir . 'utf8_file.test');
     $utf8file->setEncoding('UTF-8');
     $utf8file->put(mb_convert_encoding('Some random Text €±§', 'UTF-8'));
     $isUtf8 = exec("file {$utf8file->getPath()} | grep -i " . escapeshellarg('\\butf-8\\b') . " | wc -l");
     static::assertEquals(1, $isUtf8, "Original file to convert is not utf-8");
     $newFile = $this->converter->toEncoding($utf8file, 'UTF-16');
     $isUTF16 = exec("file {$newFile->getPath()} | grep -i " . escapeshellarg('\\UTF-16\\b') . " | wc -l");
     static::assertEquals(1, $isUTF16, "Converted file should be UTF16");
 }