/**
  * @todo Implement testGetUserTrashDirURI().
  */
 public function testGetUserTrashDirURI()
 {
     $this->markTestIncomplete('This test has not been implemented yet.');
     // THIS TEST NEEDS TO BE FIXED - it causes a segmentation violation on Hudson (different PHP version?)
     // No RODSConnMOck defined? Or perhaps need to use stubRODSConn instead
     // set up mock parameters
     $retval = $this->stubGetUserInfo();
     $mocked_rodsacct_methods = array('getUserInfo');
     $mocked_rodsacct_construct_params = array($this->host, $this->port, $this->name, $this->passwd, $this->zone);
     $acct_stub = $this->getMock('RODSAccount', $mocked_rodsacct_methods, $mocked_rodsacct_construct_params);
     $acct_stub->expects($this->once())->method('getUserInfo')->will($this->returnValue($retval));
     //set up overload for constructors
     set_new_overload(array($this, 'newCallback'));
     // now run actual tests
     $acct_stub->zone = null;
     $p = $acct_stub->getUserTrashDirURI();
     $expected = $acct_stub->user . "@" . $acct_stub->host . ":" . $acct_stub->port . "//trash/home/" . $acct_stub->user;
     $this->assertEquals($expected, $p);
     // noew test with zone set - getUserInfo() should never be called
     $acct_stub->zone = $this->zone;
     $acct_stub->expects($this->never())->method('getUserInfo')->will($this->returnValue($retval));
     $p = $acct_stub->getUserTrashDirURI();
     $expected = $acct_stub->user . "." . $acct_stub->zone . "@" . $acct_stub->host . ":" . $acct_stub->port . "/" . $acct_stub->zone . "/trash/home/" . $acct_stub->user;
     $this->assertEquals($expected, $p);
     unset_new_overload();
 }
 public function disable()
 {
     if (self::$instance != $this) {
         if (self::$instance == null) {
             return;
         }
         throw new Exception("Another WikiaMockProxy is enabled now");
     }
     // disable this instance
     $this->enabled = false;
     unset_new_overload();
     foreach ($this->mocks as $list1) {
         foreach ($list1 as $type => $mock) {
             $this->notify($mock[self::PROP_ACTION]);
         }
     }
     self::$instance = null;
 }
Beispiel #3
0
 /**
  * Reset one or all class renames
  *
  * @param string|null $className Class's name to reset, null to reset all
  */
 public function resetClass($className = null)
 {
     if (!extension_loaded('test_helpers')) {
         die('test_helpers extension is required');
     }
     if ($className) {
         unset_new_overload();
         static::$renamedClasses = array();
         return;
     }
     $key = strtolower($className);
     if (!empty(static::$renamedClasses[$key])) {
         unset(static::$renamedClasses[$key]);
     }
     if (!count(static::$renamedClasses)) {
         unset_new_overload();
     }
 }