getScript() публичный Метод

Retrieves a script.
public getScript ( string $scriptname ) : string
$scriptname string The name of the script to be retrieved.
Результат string The script.
Пример #1
0
 /**
  * Returns the content of the currently active script.
  *
  * @return string  The complete ruleset of the specified user.
  * @throws Ingo_Exception
  * @throws Horde_Exception_NotFound
  */
 public function getScript()
 {
     $this->_connect();
     try {
         $active = $this->_sieve->getActive();
         if (!strlen($active)) {
             throw new Horde_Exception_NotFound();
         }
         return array('name' => $active, 'script' => $this->_sieve->getScript($active));
     } catch (ManageSieve\Exception $e) {
         throw new Ingo_Exception($e);
     }
 }
Пример #2
0
 public function testGetScript()
 {
     $this->clear();
     $this->login();
     $scriptname = 'test script1';
     $before_scripts = $this->fixture->listScripts();
     $this->fixture->installScript($scriptname, $this->scripts[$scriptname]);
     $after_scripts = $this->fixture->listScripts();
     $diff_scripts = array_values(array_diff($after_scripts, $before_scripts));
     $this->assertTrue(count($diff_scripts) > 0);
     $this->assertEquals($scriptname, $diff_scripts[0], 'Added script has a different name');
     $script = $this->fixture->getScript($scriptname);
     $this->assertEquals(trim($this->scripts[$scriptname]), trim($script), 'Script installed it not the same script retrieved');
     $this->logout();
 }