object = new \Espo\Core\Utils\File\Manager( array( 'defaultPermissions' => array ( 'dir' => '0775', 'file' => '0664', 'user' => '', 'group' => '', ), ) ); $this->reflection = new ReflectionHelper($this->object); } protected function tearDown() { $this->object = NULL; } function testGetFileName() { $this->assertEquals('Donwload', $this->object->getFileName('Donwload.php')); $this->assertEquals('Donwload', $this->object->getFileName('/Donwload.php')); $this->assertEquals('Donwload', $this->object->getFileName('\Donwload.php')); $this->assertEquals('Donwload', $this->object->getFileName('application/Espo/EntryPoints/Donwload.php')); } function testGetContents() { $result = file_get_contents($this->filesPath.'/getContent/test.json'); $this->assertEquals($result, $this->object->getContents( array($this->filesPath, 'getContent/test.json') )); } function testPutContents() { $testPath= $this->filesPath.'/setContent'; $result= 'next value'; $this->assertTrue($this->object->putContents(array($testPath, 'test.json'), $result)); $this->assertEquals($result, $this->object->getContents( array($testPath, 'test.json')) ); $this->assertTrue($this->object->putContents(array($testPath, 'test.json'), 'initial value')); } function testConcatPaths() { $input = 'application/Espo/Resources/metadata/app/panel.json'; $result = 'application/Espo/Resources/metadata/app/panel.json'; $this->assertEquals($result, $this->reflection->invokeMethod('concatPaths', array($input)) ); $input = array( 'application', 'Espo/Resources/metadata/', 'app', 'panel.json', ); $result = 'application/Espo/Resources/metadata/app/panel.json'; $this->assertEquals($result, $this->reflection->invokeMethod('concatPaths', array($input)) ); $input = array( 'application/Espo/Resources/metadata/app', 'panel.json', ); $result = 'application/Espo/Resources/metadata/app/panel.json'; $this->assertEquals($result, $this->reflection->invokeMethod('concatPaths', array($input)) ); $input = array( 'application/Espo/Resources/metadata/app/', 'panel.json', ); $result = 'application/Espo/Resources/metadata/app/panel.json'; $this->assertEquals($result, $this->reflection->invokeMethod('concatPaths', array($input)) ); } } ?>