mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-21 02:44:51 +08:00
24 lines
638 B
PHP
24 lines
638 B
PHP
<?php
|
|
namespace yiiunit\framework\base;
|
|
|
|
use yiiunit\TestCase;
|
|
use yii\base\UserException;
|
|
use yii\base\InvalidCallException;
|
|
|
|
|
|
class ExceptionTest extends TestCase
|
|
{
|
|
public function testToArrayWithPrevious()
|
|
{
|
|
$e = new InvalidCallException('bar', 0 ,new InvalidCallException('foo'));
|
|
$array = $e->toArray();
|
|
$this->assertEquals('bar', $array['message']);
|
|
$this->assertEquals('foo', $array['previous']['message']);
|
|
|
|
$e = new InvalidCallException('bar', 0 ,new UserException('foo'));
|
|
$array = $e->toArray();
|
|
$this->assertEquals('bar', $array['message']);
|
|
$this->assertEquals('foo', $array['previous']['message']);
|
|
}
|
|
}
|