getActive() public method

Returns the active script.
public getActive ( ) : string
return string The active scriptname.
Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 public function testSetActive()
 {
     $this->clear();
     $this->login();
     $scriptname = 'test script1';
     $this->fixture->installScript($scriptname, $this->scripts[$scriptname]);
     $this->fixture->setActive($scriptname);
     $active_script = $this->fixture->getActive();
     $this->assertEquals($scriptname, $active_script, 'Active script does not match');
     // Test for non-existant script.
     try {
         $this->fixture->setActive('non existant script');
         $this->fail('Exception expected');
     } catch (Exception $e) {
     }
     $this->logout();
 }