public function testThrowsExceptionWhenConfigFileUnreadable()
{
// ----------------------------------------------------------------
// setup your test
$expectedConfig = new BaseObject();
$expectedName = WrappedConfig::NO_NAME;
$obj = new WrappedConfig();
// make sure the file cannot be read
chmod(__DIR__ . "/wrapped-config-cannot-be-read.json", 0);
// ----------------------------------------------------------------
// perform the change
$caughtException = false;
try {
$obj->loadConfigFromFile(__DIR__ . "/wrapped-config-cannot-be-read.json");
} catch (E4xx_ConfigFileNotFound $e) {
$caughtException = true;
}
// ----------------------------------------------------------------
// test the results
$this->assertTrue($caughtException);
// make sure the rest of the object has been left alone
$actualConfig = $obj->getConfig();
$actualName = $obj->getName();
$this->assertEquals($expectedConfig, $actualConfig);
$this->assertEquals($expectedName, $actualName);
}