public function testConstructor() { $user = CMTest_TH::createUser(); $metaInfo = array('meta' => 'foo', 'user' => $user); $severity = CM_Exception::ERROR; $exception = new CM_Exception('foo', $severity, $metaInfo, ['messagePublic' => new CM_I18n_Phrase('foo {$bar}', ['bar' => 'foo'])]); $render = new CM_Frontend_Render(); $this->assertSame('foo', $exception->getMessage()); $this->assertSame('foo foo', $exception->getMessagePublic($render)); $this->assertSame($severity, $exception->getSeverity()); $this->assertSame($metaInfo, $exception->getMetaInfo()); }
public function testConstructor() { $user = CMTest_TH::createUser(); $metaInfo = array('meta' => 'foo', 'user' => $user); $options = array('messagePublic' => 'foo {$bar}', 'messagePublicVariables' => array('bar' => 'foo'), 'severity' => CM_Exception::ERROR); $exception = new CM_Exception('foo', $metaInfo, $options); $render = new CM_Frontend_Render(); $this->assertSame('foo', $exception->getMessage()); $this->assertSame('foo foo', $exception->getMessagePublic($render)); $this->assertSame(CM_Exception::ERROR, $exception->getSeverity()); $this->assertSame($metaInfo, $exception->getMetaInfo()); }