Ejemplo n.º 1
0
 /**
  * test combinations of locking and unlocking of the Default namespace (i.e. make namespace readonly)
  * expected no exceptions
  */
 public function testUnLockAll()
 {
     $sessions = array('one', 'two', 'default', 'three');
     foreach ($sessions as $namespace) {
         $s = new Zend_Session($namespace);
         $s->a = 'apple';
         $s->p = 'pear';
         $s->lock();
         $s->unLock();
         $s->o = 'orange';
         $s->p = 'prune';
         $s->lock();
         $s->unLock();
         $s->o = 'orange';
         $s->p = 'papaya';
         $s->c = 'cherry';
         $s->lock();
         $this->assertTrue($s->isLocked(), 'isLocked() returned incorrect status (not locked)');
         try {
             $s->p = 'prune';
             $s->f = 'fig';
             $this->fail('No exception was returned when setting a variable in the "Default" namespace, ' . 'after marking the namespace as read-only; expected Zend_Session_Exception');
         } catch (Zend_Session_Exception $e) {
             $this->assertRegexp('/read.only/i', $e->getMessage());
         }
     }
     $s->unLockAll();
     foreach ($sessions as $namespace) {
         $this->assertFalse($s->isLocked(), 'isLocked() returned incorrect status (locked)');
         $s->p = 'pear';
         $s->f = 'fig';
         $s->l = 'lime';
     }
 }