@@ -16,7 +16,7 @@ public function testSpecification()
1616 $ this ->user ->name = 'jon ' ;
1717 $ this ->assertEquals ('jon ' , $ this ->user ->name );
1818 });
19-
19+
2020 $ this ->assertEquals ('davert ' , $ this ->user ->name );
2121
2222 $ this ->specify ('i can fail here but test goes on ' , function () {
@@ -57,7 +57,7 @@ function testAfterCallback()
5757 $ this ->user = "jon " ;
5858 });
5959 $ this ->assertEquals ('davert ' , $ this ->user );
60- }
60+ }
6161
6262 function testMultiAfterCallback ()
6363 {
@@ -104,6 +104,33 @@ public function testExceptions()
104104 }, ['throws ' => 'fail ' ]);
105105 }
106106
107+ public function testExceptionsWithMessages ()
108+ {
109+ $ this ->specify ('user is invalid ' , function () {
110+ throw new Exception ("test message " );
111+ }, ['throws ' => ['Exception ' , 'test message ' ]]);
112+
113+ $ this ->specify ('user is invalid ' , function () {
114+ throw new RuntimeException ("test message " );
115+ }, ['throws ' => ['RuntimeException ' , 'test message ' ]]);
116+
117+ $ this ->specify ('user is invalid ' , function () {
118+ throw new RuntimeException ("test message " );
119+ }, ['throws ' => [new RuntimeException (), "test message " ]]);
120+
121+ $ this ->specify ('i can handle fails ' , function () {
122+ $ this ->fail ("test message " );
123+ }, ['throws ' => ['fail ' , 'test message ' ]]);
124+
125+ $ this ->specify ('ignores an empty message ' , function () {
126+ $ this ->fail ("test message " );
127+ }, ['throws ' => ['fail ' ]]);
128+
129+ $ this ->specify ('mixed case exception messages ' , function () {
130+ throw new RuntimeException ("teSt mESSage " );
131+ }, ['throws ' => ['RuntimeException ' , 'Test MessaGE ' ]]);
132+ }
133+
107134 /**
108135 * @expectedException RuntimeException
109136 */
@@ -140,7 +167,7 @@ public function testDeepCopy()
140167 $ this ->assertEquals (2 , $ this ->a ->prop ->prop );
141168 });
142169 $ this ->assertEquals (1 , $ this ->a ->prop ->prop );
143-
170+
144171 }
145172
146173 public function testConfiguration ()
0 commit comments