/** * * @return fpErrorNotifier */ protected function notifier() { if (!($instance = fpErrorNotifier::getInstance())) { $instance = new fpErrorNotifier($this->configuration->getEventDispatcher()); fpErrorNotifier::setInstance($instance); } return $instance; }
public function testConstruct() { $stubHelper = $this->getStubStrict('fpErrorNotifierMessageHelper', array('formatSummary' => array('foo' => 'bar'), 'formatSubject' => 'Foo Subject')); $notifier = $this->getStubStrict('fpErrorNotifier', array('helper' => $stubHelper), array(), '', false); fpErrorNotifier::setInstance($notifier); $message = new fpErrorNotifierMessage('foo'); $this->assertAttributeEquals(array('Summary' => array('foo' => 'bar')), '_data', $message); $this->assertEquals('Foo Subject', $message->subject()); return $message; }
public function testRender() { $helper = new fpErrorNotifierMessageHelper(); $notifier = $this->getStubStrict('fpErrorNotifier', array('helper' => $helper), array(), '', false); fpErrorNotifier::setInstance($notifier); $message = new fpErrorNotifierMessage('foo title'); $message->addSection('test one', array('bar' => 'foo')); $decorator = new fpErrorNotifierDecoratorHtml($message); $text = $decorator->render(); $this->assertType('string', $text); $this->assertContains('Summary', $text); $this->assertContains('Environment', $text); $this->assertContains('Test One', $text); }
public function testFormatSummary() { sfConfig::set('sf_environment', 'foo_env'); $stubContext = $this->getStubStrict('sfContext', array('getModuleName' => 'FooModule', 'getActionName' => 'BarAction')); $notifier = $this->getStubStrict('fpErrorNotifier', array('context' => $stubContext), array(), '', false); fpErrorNotifier::setInstance($notifier); $helper = new fpErrorNotifierMessageHelper(); $summaryData = $helper->formatSummary('FooTitle'); $this->assertInternalType('array', $summaryData); $expectedKeys = array('subject', 'uri', 'environment', 'module', 'action', 'generated at'); $this->assertEquals($expectedKeys, array_keys($summaryData)); $this->assertEquals('FooTitle', $summaryData['subject']); $this->assertEquals('foo_env', $summaryData['environment']); }
protected function _end() { fpErrorNotifier::setInstance($this->notifierBackup); }
<?php $configFiles = $this->getConfigPaths('config/notify.yml'); $config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles); foreach ($config as $name => $value) { sfConfig::set("sf_notify_{$name}", $value); } fpErrorNotifier::setInstance(new fpErrorNotifier($this->getEventDispatcher())); fpErrorNotifier::getInstance()->handler()->initialize();