Ejemplo n.º 1
0
 /**
  * Invoking events test.
  * @return void
  */
 public function testInvokingEvents()
 {
     $obj = new TestClass();
     try {
         // private
         $obj->onPrivate(123);
         $this->fail('called private event');
     } catch (MemberAccessException $e) {
         $this->assertEquals("Call to undefined method TestClass::onPrivate().", $e->getMessage());
     }
     try {
         // protected
         $obj->onProtected(123);
         $this->fail('called protected event');
     } catch (MemberAccessException $e) {
         $this->assertEquals("Call to undefined method TestClass::onProtected().", $e->getMessage());
     }
     try {
         // public
         $obj->onPublic(123);
     } catch (MemberAccessException $e) {
         $this->fail('failed public event');
     }
     try {
         // public nonarray
         $obj->onPublic2(123);
     } catch (MemberAccessException $e) {
         $this->fail('failed public nonarray event');
     }
     try {
         // public static
         $obj->onPublicStatic(123);
         $this->fail('called public static event');
     } catch (MemberAccessException $e) {
         $this->assertEquals("Call to undefined method TestClass::onPublicStatic().", $e->getMessage());
     }
 }