Gary . wrote:
class Pg_Error
{
    private static $errors =
        array(INTEGRITY_CONST_UNIQUE => 'uniqueness constraint violated');
Shouldn't this be:

array(self::INTEGRITY_CONST_UNIQUE => 'uniqueness constraint violated');


...
    public static function getMessage($ec)
    {
        $text = '';
        if (array_key_exists($ec, Pg_Error::$errors))
        {
            $text = Pg_Error::$errors[$ec];
        }

        return $text;
    }
...
}

?

Calling it, the array_key_exists call always returns false:
$this->assertEquals('uniqueness constraint violated',
Pg_Error::getMessage(Pg_Error::INTEGRITY_CONST_UNIQUE));
and I can't see what I've done wrong :(



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to