public function testGetContent()
 {
     $_params = array('pathname' => 'LocalSettings.php');
     $_apiCall = $this->initRest(new OperationGetFileContent(), $_params);
     $_results = M3_Client_gzdecode::gzdecode(base64_decode($_apiCall->execute()));
     $this->assertFalse(empty($_results), 'should have found local settings');
     $this->assertGreaterThan(0, strpos($_results, 'm3SecretKey'), 'should have true local settings content');
     $_params = array('pathname' => 'LocalSettings.php', 'useIncludePath' => 'true');
     $_apiCall = $this->initRest(new OperationGetFileContent(), $_params);
     $_results = M3_Client_gzdecode::gzdecode(base64_decode($_apiCall->execute()));
     $this->assertFalse(empty($_results), 'Should have found local settings');
     $this->assertGreaterThan(0, strpos($_results, 'm3SecretKey'), 'Should have true local settings content');
     $_params = array('pathname' => 'LocalSettings.php', 'useIncludePath' => true);
     $_apiCall = $this->initRest(new OperationGetFileContent(), $_params);
     $_results = M3_Client_gzdecode::gzdecode(base64_decode($_apiCall->execute()));
     $this->assertFalse(empty($_results), 'Should have found local settings.');
     $this->assertGreaterThan(0, strpos($_results, 'm3SecretKey'), 'Should have true local settings content.');
     $_params = array('pathname' => 'LocalSettings.php', 'useIncludePath' => false);
     $_apiCall = $this->initRest(new OperationGetFileContent(), $_params);
     $_results = M3_Client_gzdecode::gzdecode(base64_decode($_apiCall->execute()));
     $this->assertFalse(empty($_results), 'Should have found local settings from install dir.');
     $this->assertGreaterThan(0, strpos($_results, 'm3SecretKey'), 'Should have true local settings content from install dir.');
 }
예제 #2
0
 /**
  * Returns the actual content of the given file.  The pathname is
  * relative to the install directory unless the '$useIncludePath'
  * parameter is set to 'true'.
  * 
  * @param $pathname the file whose content is to be returned
  * @param $useIncludePath if 'true', the file should be found in include path
  * 
  * @return string the file's content
  */
 public function operationGetFileContent($pathname, $useIncludePath = null)
 {
     $_params = array('pathname' => $pathname, 'useIncludePath' => $useIncludePath);
     $_results = parent::callRestMethod('m3.operation.getFileContent', $_params);
     $_results = base64_decode($_results);
     require_once 'ringside/m3/client/gzdecode.php';
     $_results = M3_Client_gzdecode::gzdecode($_results);
     return $_results;
 }