[moriarty] r330 committed - setExpectedException can't specify base "Exception" type in recent PHP...

5 views
Skip to first unread message

mori...@googlecode.com

unread,
Jan 11, 2012, 7:04:10 AM1/11/12
to moriarty...@googlegroups.com
Revision: 330
Author: jhi...@gmail.com
Date: Wed Jan 11 04:01:28 2012
Log: setExpectedException can't specify base "Exception" type in
recent PHPUnit versions, so modified test_get_access_error to use try/catch
instead and assert that the correct exception message has been received.
http://code.google.com/p/moriarty/source/detail?r=330

Modified:
/trunk/tests/config.test.php

=======================================
--- /trunk/tests/config.test.php Wed Feb 24 04:28:12 2010
+++ /trunk/tests/config.test.php Wed Jan 11 04:01:28 2012
@@ -258,10 +258,15 @@
$mockRequestFactory = $this->getMock('HttpRequestFactory',
array('make'));

$mockRequestFactory->expects($this->once())->method('make')->will($this->returnValue($mockRequest));

- $this->setExpectedException('Exception', 'Error determining access
status:');
-
$config = new Config("http://example.org/store/config", null,
$mockRequestFactory);
- $actual = $config->get_access_status();
+
+ try {
+ $actual = $config->get_access_status();
+ $this->fail("Should have got exception thrown by get_access_status");
+ } catch (Exception $ex) {
+ $msg = trim($ex->getMessage());
+ $this->assertEquals('Error determining access status: 500',
$msg, 'should get expected exception message');
+ }
}

}

Reply all
Reply to author
Forward
0 new messages