Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 3447e39793d15911bf3fc0a8996e2c90 > files > 102

php-apc-3.1.15-4.10.mga4.x86_64.rpm

<?php

abstract class PHPUnit_Framework_Constraint implements Countable, PHPUnit_Framework_SelfDescribing
{

    public function evaluate($other, $description = '', $returnResult = FALSE)
    {
        $success = FALSE;

        if ($this->matches($other)) {
            $success = TRUE;
        }

        if ($returnResult) {
            return $success;
        }

        if (!$success) {
            $this->fail($other, $description);
        }
    }

    protected function matches($other)
    {
        return FALSE;
    }

    public function count()
    {
        return 1;
    }

    protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL)
    {
        $failureDescription = sprintf(
          'Failed asserting that %s.',
          $this->failureDescription($other)
        );

        $additionalFailureDescription = $this->additionalFailureDescription($other);
        if ($additionalFailureDescription) {
            $failureDescription .= "\n" . $additionalFailureDescription;
        }

        if (!empty($description)) {
            $failureDescription = $description . "\n" . $failureDescription;
        }

        throw new PHPUnit_Framework_ExpectationFailedException(
          $failureDescription,
          $comparisonFailure
        );
    }

    protected function additionalFailureDescription($other)
    {
        return "";
    }

    protected function failureDescription($other)
    {
        return PHPUnit_Util_Type::export($other) . ' ' . $this->toString();
    }
}