コード例 #1
0
 /**
  * Tests the log method.
  *
  * It is expected that the `log` method,
  *
  * * invokes the event dispatcher.
  *
  * @return void
  */
 public function testLog()
 {
     // set up mocks for the dispatcher and the generated event.
     $event_dispatcher = $this->getMock('sfEventDispatcher', array('notify'));
     $event = $this->getMock('sfEvent', array('getReturnValue'), array($this->fixture, 'system.log', array('message' => 'body', 'priority' => 6)));
     // the event dispatcher's notify method will be invoken and return the
     // expected event
     $event_dispatcher->expects($this->once())->method('notify')->will($this->returnValue($event));
     // we will let the event return true to test whether the return value
     // is actually returned
     $event->expects($this->once())->method('getReturnValue')->will($this->returnValue(true));
     // test without setting the dispatcher
     ParserAbstract::$event_dispatcher = $event_dispatcher;
     $this->fixture->log('body', 6);
 }