ZF-8222: format class name for class checks
[zend.git] / tests / Zend / ExceptionTest.php
blob6aede7091d67652eb0a61ee6e8178bbcf30b3c03
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Exception
17 * @subpackage UnitTests
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id$
23 require_once dirname(dirname(__FILE__)) . '/TestHelper.php';
25 require_once 'Zend/Exception.php';
27 /**
28 * @category Zend
29 * @package Zend_Exception
30 * @subpackage UnitTests
31 * @group Zend_Exception
32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
35 class Zend_ExceptionTest extends PHPUnit_Framework_TestCase
37 public function testConstructorDefaults()
39 $e = new Zend_Exception();
40 $this->assertEquals('', $e->getMessage());
41 $this->assertEquals(0, $e->getCode());
42 $this->assertNull($e->getPrevious());
45 public function testMessage()
47 $e = new Zend_Exception('msg');
48 $this->assertEquals('msg', $e->getMessage());
51 public function testCode()
53 $e = new Zend_Exception('msg', 100);
54 $this->assertEquals(100, $e->getCode());
57 public function testPrevious()
59 $p = new Zend_Exception('p', 0);
60 $e = new Zend_Exception('e', 0, $p);
61 $this->assertEquals($p, $e->getPrevious());
64 public function testToString()
66 $p = new Zend_Exception('p', 0);
67 $e = new Zend_Exception('e', 0, $p);
68 $s = $e->__toString();
69 $this->assertContains('p', $s);
70 $this->assertContains('Next', $s);
71 $this->assertContains('e', $s);