/** * 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); }
/** * 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); }
/** * 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(); }
/** * Returns the options of the builder. * @return \ManiaScript\Builder\Options The options. */ public function getOptions() { return $this->builder->getOptions(); }