/usr/share/php/kohana3.1/system/tests/kohana/ExceptionTest.php is in libkohana3.1-core-php 3.1.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | <?php defined('SYSPATH') OR die('Kohana bootstrap needs to be included before tests run');
/**
* Tests Kohana Exception Class
*
* @group kohana
* @group kohana.exception
*
* @package Kohana
* @category Tests
* @author Kohana Team
* @copyright (c) 2008-2011 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_ExceptionTest extends Unittest_TestCase
{
/**
* Provides test data for test_constructor()
*
* @return array
*/
public function provider_constructor()
{
return array(
array(array(''), '', 0),
array(array(':a'), ':a', 0),
array(array(':a', NULL), ':a', 0),
array(array(':a', array()), ':a', 0),
array(array(':a', array(':a' => 'b')), 'b', 0),
array(array(':a :b', array(':a' => 'c', ':b' => 'd')), 'c d', 0),
array(array(':a', NULL, 5), ':a', 5),
// #3927
array(array(':a', NULL, 'b'), ':a', 'b'),
);
}
/**
* 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());
}
/**
* Provides test data for test_text()
*
* @return array
*/
public function provider_text()
{
return array(
array(new Kohana_Exception('foobar'), $this->dirSeparator('Kohana_Exception [ 0 ]: foobar ~ SYSPATH/tests/kohana/ExceptionTest.php [ '.__LINE__.' ]')),
);
}
/**
* Tests Kohana_Exception::text()
*
* @test
* @dataProvider provider_text
* @covers Kohana_Exception::text
* @param object $exception exception to test
* @param string $expected expected output
*/
public function test_text($exception, $expected)
{
$this->assertEquals($expected, Kohana_Exception::text($exception));
}
}
|