Ejemplo n.º 1
0
 /**
  * Tests Kohana_Kohana_Exception::__construct()
  *
  * @test
  * @dataProvider provider_constructor
  * @covers Kohana_Kohana_Exception::__construct
  * @param array             $arguments          Arguments
  * @param string            $expected_message   Value from getMessage()
  * @param integer|string    $expected_code      Value from getCode()
  */
 public function test_constructor($arguments, $expected_message, $expected_code)
 {
     switch (count($arguments)) {
         case 1:
             $exception = new Kohana_Exception(reset($arguments));
             break;
         case 2:
             $exception = new Kohana_Exception(reset($arguments), next($arguments));
             break;
         default:
             $exception = new Kohana_Exception(reset($arguments), next($arguments), next($arguments));
     }
     $this->assertSame($expected_code, $exception->getCode());
     $this->assertSame($expected_message, $exception->getMessage());
 }
Ejemplo n.º 2
0
 /**
  * Событие вызываемое в момент ошибки обновления документа
  */
 public function onUpdateException(Kohana_Exception $exception)
 {
     Messages::errors($exception->getMessage());
 }