public function testDisableRegistration() { FailureException::disableRegistration(); /* modify single exception */ $this->assertFalse(FailureException::set(5, 15)); $this->assertSame(1005, FailureException::get(5)); /* modify array exceptions */ $modify = array(1 => 101, 2 => 102, 3 => 103, 4 => 104, 5 => 105); $expected = array(1 => 1001, 2 => 1002, 3 => 1003, 4 => 1004, 5 => 1005); $this->assertFalse(FailureException::setArray($modify)); $actual = FailureException::getAll(); $this->assertSame(array_diff($expected, $actual), array_diff($actual, $expected)); $this->assertSame(1005, FailureException::get(5)); }
/** * Register FailureExceptions defined in App (in this file) into FailureException object. * * @return void */ protected final function registerFailureExceptions() { FailureException::setArray(array(FX::F_UNKNOWN => ED::F_UNKNOWN, FX::F_CLASS_NOT_FOUND => ED::F_CLASS_NOT_FOUND, FX::F_DB_MISSING_CONFIG => ED::F_DB_MISSING_CONFIG, FX::F_DB_UNABLE_CONNECT => ED::F_DB_UNABLE_CONNECT, FX::F_DB_UNABLE_SET_CHARSET => ED::F_DB_UNABLE_SET_CHARSET, FX::F_LOGGER_UNABLE_SAVE_WARNING => ED::F_LOGGER_UNABLE_SAVE_WARNING, FX::F_RESPONSE_HEADERS_SENT => ED::F_RESPONSE_HEADERS_SENT, FX::F_RESPONSE_INVALID_HTTP_CODE => ED::F_RESPONSE_INVALID_HTTP_CODE, FX::F_REQUEST_FORCED_HTTPS => ED::F_REQUEST_FORCED_HTTPS, FX::F_REQUEST_INVALID_METHOD => ED::F_REQUEST_INVALID_METHOD, FX::F_URL_PARSE_ERROR => ED::F_URL_PARSE_ERROR, FX::F_ROUTE_MISSING_ARGS => ED::F_ROUTE_MISSING_ARGS)); }