public function testDisableRegistration() { WarningException::disableRegistration(); /* modify single exception */ $this->assertFalse(WarningException::set(5, 15)); $this->assertSame(1005, WarningException::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(WarningException::setArray($modify)); $actual = WarningException::getAll(); $this->assertSame(array_diff($expected, $actual), array_diff($actual, $expected)); $this->assertSame(1005, WarningException::get(5)); }
/** * Register WarningExceptions defined in App (in this file) into WarningException object. * * @return void */ protected final function registerWarningExceptions() { WarningException::setArray(array(FX::W_UNKNOWN => ED::W_UNKNOWN, FX::W_FUNCTION_IS_NOT_CALLABLE => ED::W_FUNCTION_IS_NOT_CALLABLE, FX::W_INVALID_PARAMETERS => ED::W_INVALID_PARAMETERS, FX::W_PERMISSION_DENIED => ED::W_PERMISSION_DENIED, FX::W_INVALID_TOKEN => ED::W_INVALID_TOKEN, FX::W_DB_INVALID_SQL_SELECT => ED::W_DB_INVALID_SQL_SELECT, FX::W_DB_INVALID_SQL_ACTION => ED::W_DB_INVALID_SQL_ACTION, FX::W_DB_UNABLE_VERIFY_RESULT => ED::W_DB_UNABLE_VERIFY_RESULT, FX::W_DB_UNABLE_BEGIN_TRANSACTION => ED::W_DB_UNABLE_BEGIN_TRANSACTION, FX::W_DB_UNABLE_COMMIT_TRANSACTION => ED::W_DB_UNABLE_COMMIT_TRANSACTION, FX::W_DB_UNABLE_ROLLBACK_TRANSACTION => ED::W_DB_UNABLE_ROLLBACK_TRANSACTION, FX::W_ROUTER_INVALID_ROUTE => ED::W_ROUTER_INVALID_ROUTE, FX::W_ROUTER_INVALID_ACTION => ED::W_ROUTER_INVALID_ACTION, FX::W_RESPONSE_INVALID_FORMAT => ED::W_RESPONSE_INVALID_FORMAT)); }