getActive() 공개 메소드

Returns the active script.
public getActive ( ) : string
리턴 string The active scriptname.
예제 #1
0
파일: Timsieved.php 프로젝트: horde/horde
 /**
  * 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 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();
 }