<?php/********************************************************************************************
* BlueShoes Framework; This file is part of the php application framework.
* NOTE: This code is stripped (obfuscated). To get the clean documented code goto 
*       www.blueshoes.org and register for the free open source *DEVELOPER* version or 
*       buy the commercial version.
*       
*       In case you've already got the developer version, then this is one of the few 
*       packages/classes that is only available to *PAYING* customers.
*       To get it go to www.blueshoes.org and buy a commercial version.
* 
* @copyright www.blueshoes.org
* @author    Samuel Blume <sam at blueshoes dot org>
* @author    Andrej Arn <andrej at blueshoes dot org>
*/?><?php
require_once($APP['path']['core'] . 'file/Bs_FileSystem.class.php');class Bs_FileSystem_PhpUnit extends Bs_TestCase {var $_Bs_FileSystem;function Bs_FileSystem_PhpUnit($name) {$this->Bs_TestCase($name);$this->_Bs_FileSystem = new Bs_FileSystem();}
function __Bs_FileSystem_realPath() {$expected = "c:/";$actual = $this->_Bs_FileSystem->realPath(" c:/ ");$this->assertEquals($expected, $actual, 'test 1.1');$expected = "/";$actual = $this->_Bs_FileSystem->realPath(" /.. ");$this->assertEquals($expected, $actual, 'test 1.2');$expected = "/";$actual = $this->_Bs_FileSystem->realPath(" /. ");$this->assertEquals($expected, $actual, 'test 1.3');$expected = "";$actual = $this->_Bs_FileSystem->realPath(" ./ ");$this->assertEquals($expected, $actual, 'test 1.4');$expected = "ftp://bb/";$actual = $this->_Bs_FileSystem->realPath("ftp://aaa/../../bb/");$this->assertEquals($expected, $actual, 'test 2.1');$expected = "bb/";$actual = $this->_Bs_FileSystem->realPath("./..\\../../bb/");$this->assertEquals($expected, $actual, 'test 2.2');$expected = "";$actual = $this->_Bs_FileSystem->realPath("./..\\aa/../../bb/..");$this->assertEquals($expected, $actual, 'test 3');$expected = "c:/";$actual = $this->_Bs_FileSystem->realPath("c:/../aa/../../bb/..");$this->assertEquals($expected, $actual, 'test 3.1');$expected = "aa/bb";$actual = $this->_Bs_FileSystem->realPath("./aa/bb");$this->assertEquals($expected, $actual, 'test 4');$expected = "aa/bb/cc.gif";$actual = $this->_Bs_FileSystem->realPath("./aa/bb/cc.gif");$this->assertEquals($expected, $actual, 'test 5');$expected = "aa/bb/cc.gif";$actual = $this->_Bs_FileSystem->realPath(".//aa/bb//////cc.gif");$this->assertEquals($expected, $actual, 'test 6');$expected = "aa/bb/cc.gif";$actual = $this->_Bs_FileSystem->realPath(".//aa\bb\cc/./../cc/./././../cc.gif");$this->assertEquals($expected, $actual, 'test 7');}
function __Bs_FileSystem_basename() {$expected = "sam";$actual = $this->_Bs_FileSystem->basename("/hello/sam");$this->assertEquals($expected, $actual, 'test 1');$expected = "sam.txt";$actual = $this->_Bs_FileSystem->basename("/hello/sam.txt");$this->assertEquals($expected, $actual, 'test 2');$expected = "";$actual = $this->_Bs_FileSystem->basename("/hello\\");$this->assertEquals($expected, $actual, 'test 3');$expected = "";$actual = $this->_Bs_FileSystem->basename("/");$this->assertEquals($expected, $actual, 'test 4');$expected = "";$actual = $this->_Bs_FileSystem->basename("  ");$this->assertEquals($expected, $actual, 'test 5');$expected = "";$actual = $this->_Bs_FileSystem->basename("");$this->assertEquals($expected, $actual, 'test 6');$expected = "lala.txt";$actual = $this->_Bs_FileSystem->basename("lala.txt");$this->assertEquals($expected, $actual, 'test 7');}
function __Bs_FileSystem_makeValidFileName() {$given    = "foo";$expected = "foo";$actual = $this->_Bs_FileSystem->makeValidFileName($given);$this->assertEquals($expected, $actual, "given file name was: {$given}");$given    = " foo ";$expected = "foo"; $actual = $this->_Bs_FileSystem->makeValidFileName($given, 'win');$this->assertEquals($expected, $actual, "given file name was: {$given}");$strangeWindowsFilename = "{}d    % test.txt  {}  _-d°§+@ #ç&()=~^`´'\$£"; $given = $strangeWindowsFilename;$expected = $strangeWindowsFilename;$actual = $this->_Bs_FileSystem->makeValidFileName($given, 'win');$this->assertEquals($expected, $actual, "given file name was: {$given}");$given = $strangeWindowsFilename;$expected = "d_test.txt_d_";$actual = $this->_Bs_FileSystem->makeValidFileName($given, 'linux');$this->assertEquals($expected, $actual, "given file name was: {$given}");$given    = "foo__";$expected = "foo_";$actual = $this->_Bs_FileSystem->makeValidFileName($given, 'linux');$this->assertEquals($expected, $actual, "given file name was: {$given}");$given    = "f  oo__";$expected = "f_oo_";$actual = $this->_Bs_FileSystem->makeValidFileName($given, 'linux');$this->assertEquals($expected, $actual, "given file name was: {$given}");$given    = "f _ oo";$expected = "f_oo";$actual = $this->_Bs_FileSystem->makeValidFileName($given, 'linux');$this->assertEquals($expected, $actual, "given file name was: {$given}");}
}
?>