Ejemplo n.º 1
0
 /**
  * testObservers 
  * 
  * @return void
  */
 public function testObservers()
 {
     $event1 = array('name' => 'foo1', 'data' => 'bar1');
     $event2 = array('name' => 'foo2', 'data' => 'bar2');
     $mock = new OpenID_Observer_Mock();
     OpenID::attach($mock);
     // Test skipping existing observers
     OpenID::attach($mock);
     try {
         OpenID::setLastEvent($event1['name'], $event1['data']);
         // should not execute
         $this->assertTrue(false);
     } catch (OpenID_Exception $e) {
     }
     $this->assertSame($event1, OpenID::getLastEvent());
     OpenID::detach($mock);
     // Test skipping missing observers
     OpenID::detach($mock);
     OpenID::setLastEvent($event2['name'], $event2['data']);
     $this->assertSame($event2, OpenID::getLastEvent());
 }