11<?php
22//----------------------------------------------------------------------------------------------------------------------
3+ namespace SetBased \Exception \Test ;
4+
5+ use PHPUnit \Framework \TestCase ;
36use SetBased \Exception \NamedException ;
47
5- //----------------------------------------------------------------------------------------------------------------------
6- class FormattedExceptionTestBase extends PHPUnit_Framework_TestCase
8+ /**
9+ * Test cases for class FormattedException.
10+ */
11+ class FormattedExceptionTestBase extends TestCase
712{
813 //--------------------------------------------------------------------------------------------------------------------
914 static $ class ;
@@ -27,10 +32,10 @@ public function testName()
2732
2833 throw new self::$ class ([$ num ], $ format , $ num , $ location );
2934 }
30- catch (Exception $ e )
35+ catch (\ Exception $ e )
3136 {
3237 /** @var $e NamedException */
33- $ this -> assertSame (self ::$ name , $ e ->getName ());
38+ self :: assertSame (self ::$ name , $ e ->getName ());
3439 }
3540 }
3641
@@ -49,10 +54,10 @@ public function testCode()
4954
5055 throw new self::$ class ([$ num ], $ format , $ num , $ location );
5156 }
52- catch (Exception $ e )
57+ catch (\ Exception $ e )
5358 {
54- $ this -> assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
55- $ this -> assertSame ($ num , $ e ->getCode ());
59+ self :: assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
60+ self :: assertSame ($ num , $ e ->getCode ());
5661 }
5762 }
5863
@@ -71,9 +76,9 @@ public function testFormatting()
7176
7277 throw new self::$ class ($ format , $ num , $ location );
7378 }
74- catch (Exception $ e )
79+ catch (\ Exception $ e )
7580 {
76- $ this -> assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
81+ self :: assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
7782 }
7883 }
7984
@@ -93,10 +98,10 @@ public function testPrevious()
9398
9499 throw new self::$ class ([$ previous ], $ format , $ num , $ location );
95100 }
96- catch (Exception $ e )
101+ catch (\ Exception $ e )
97102 {
98- $ this -> assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
99- $ this -> assertSame ($ previous , $ e ->getPrevious ());
103+ self :: assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
104+ self :: assertSame ($ previous , $ e ->getPrevious ());
100105 }
101106 }
102107
@@ -116,11 +121,11 @@ public function testCodePrevious()
116121
117122 throw new self::$ class ([$ num , $ previous ], $ format , $ num , $ location );
118123 }
119- catch (Exception $ e )
124+ catch (\ Exception $ e )
120125 {
121- $ this -> assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
122- $ this -> assertSame ($ previous , $ e ->getPrevious ());
123- $ this -> assertSame ($ num , $ e ->getCode ());
126+ self :: assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
127+ self :: assertSame ($ previous , $ e ->getPrevious ());
128+ self :: assertSame ($ num , $ e ->getCode ());
124129 }
125130 }
126131
@@ -140,11 +145,11 @@ public function testPreviousCode()
140145
141146 throw new self::$ class ([$ previous , $ num ], $ format , $ num , $ location );
142147 }
143- catch (Exception $ e )
148+ catch (\ Exception $ e )
144149 {
145- $ this -> assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
146- $ this -> assertSame ($ previous , $ e ->getPrevious ());
147- $ this -> assertSame ($ num , $ e ->getCode ());
150+ self :: assertSame ('There are 5 monkeys in the tree ' , $ e ->getMessage ());
151+ self :: assertSame ($ previous , $ e ->getPrevious ());
152+ self :: assertSame ($ num , $ e ->getCode ());
148153 }
149154 }
150155
0 commit comments