예제 #1
0
    public function testCreationException()
    {
        try {
            $this->helper = new Zend_View_Helper_Translate('something');
        } catch (Zend_View_Exception $e) {
            $this->assertContains('must set an instance of Zend_Translate', $e->getMessage());
        }

        try {
            $this->helper = new Zend_View_Helper_Translate();
            $this->helper->setTranslate('something');
        } catch (Zend_View_Exception $e) {
            $this->assertContains('must set an instance of Zend_Translate', $e->getMessage());
        }

        try {
            $this->helper = new Zend_View_Helper_Translate();
            $this->helper->getLocale();
        } catch (Zend_View_Exception $e) {
            $this->assertContains('must set an instance of Zend_Translate', $e->getMessage());
        }

        try {
            $this->helper = new Zend_View_Helper_Translate();
            $this->helper->setLocale();
        } catch (Zend_View_Exception $e) {
            $this->assertContains('must set an instance of Zend_Translate', $e->getMessage());
        }
    }
예제 #2
0
 public function testRetrievingLocaleWhenNoTranslationObjectSetThrowsException()
 {
     try {
         $this->helper->getLocale();
     } catch (Zend_View_Exception $e) {
         $this->assertContains('must set an instance of Zend_Translate', $e->getMessage());
     }
 }