예제 #1
0
 /**
  * Tests the getTriggeredCustomEventsVariableName() method.
  * @covers \ManiaScript\Builder\Event\Handler\Custom::getTriggeredCustomEventsVariableName
  */
 public function testGetTriggeredCustomEventsVariableName()
 {
     $builder = new Builder();
     $builder->getOptions()->setFunctionPrefix('foo');
     $handler = new Custom($builder);
     $result = $this->invokeMethod($handler, 'getTriggeredCustomEventsVariableName');
     $this->assertEquals('foo_TriggeredCustomEvents', $result);
 }
예제 #2
0
 /**
  * Tests the getAddTimerFunctionName() method.
  * @covers \ManiaScript\Builder\Event\Handler\Timer::getAddTimerFunctionName
  */
 public function testGetAddTimerFunctionName()
 {
     $builder = new Builder();
     $builder->getOptions()->setFunctionPrefix('foo');
     $handler = new Timer($builder);
     $result = $this->invokeMethod($handler, 'getAddTimerFunctionName');
     $this->assertEquals('foo_AddTimer', $result);
 }
예제 #3
0
 /**
  * Returns the name of the handler function to be used for the specified event.
  * @param \ManiaScript\Builder\Event\AbstractEvent The event.
  * @return string The handler function name.
  */
 protected function getHandlerFunctionName(AbstractEvent $event)
 {
     $name = array_search($event, $this->handlerFunctionNames);
     if ($name === false) {
         $functionPrefix = $this->builder->getOptions()->getFunctionPrefix();
         $parts = explode('\\', get_class($event));
         $class = end($parts);
         $name = $functionPrefix . '_Handle' . $class . count($this->handlerFunctionNames);
         $this->handlerFunctionNames[$name] = $event;
     }
     return $name;
 }
 /**
  * Sets up the tests case.
  */
 protected function setUp()
 {
     $this->builder = new Builder();
     $this->builder->getOptions()->setFunctionPrefix('foo');
     $this->mockedHandler = $this->getMockBuilder('ManiaScript\\Builder\\Event\\Handler\\AbstractHandler')->setConstructorArgs(array($this->builder))->getMockForAbstractClass();
 }
예제 #5
0
 /**
  * Returns the options of the builder.
  * @return \ManiaScript\Builder\Options The options.
  */
 public function getOptions()
 {
     return $this->builder->getOptions();
 }