Yaffs site version 1.1
[yaffs-website] / vendor / phpunit / phpunit / tests / _files / ExceptionStackTest.php
diff --git a/vendor/phpunit/phpunit/tests/_files/ExceptionStackTest.php b/vendor/phpunit/phpunit/tests/_files/ExceptionStackTest.php
new file mode 100644 (file)
index 0000000..05fa878
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+class ExceptionStackTest extends PHPUnit_Framework_TestCase
+{
+    public function testPrintingChildException()
+    {
+        try {
+            $this->assertEquals(array(1), array(2), 'message');
+        } catch (PHPUnit_Framework_ExpectationFailedException $e) {
+            $message = $e->getMessage() . $e->getComparisonFailure()->getDiff();
+            throw new PHPUnit_Framework_Exception("Child exception\n$message", 101, $e);
+        }
+    }
+
+    public function testNestedExceptions()
+    {
+        $exceptionThree = new Exception('Three');
+        $exceptionTwo   = new InvalidArgumentException('Two', 0, $exceptionThree);
+        $exceptionOne   = new Exception('One', 0, $exceptionTwo);
+        throw $exceptionOne;
+    }
+}