Hywan / atoum-instrumentation

The atoum\instrumentation library. Instrumentation for PHP (moles, code coverage…)
7 stars 2 forks source link

PARSE ERROR when instrumenting some methods #10

Closed jubianchi closed 10 years ago

jubianchi commented 10 years ago

From [mageekguy\atoum\asserters#L486}(https://github.com/atoum/atoum/blob/master/classes/asserters/phpArray.php#L486)

I think the problem comes from https://github.com/atoum/atoum/blob/master/classes/asserters/phpArray.php#L490

protected function intersect(array $values, $failMessage, $strict)
    {
        $unknownValues = array();

        foreach ($values as $value) if (in_array($value, $this->value, $strict) === false)
        {
            $unknownValues[] = $value;
        }

        if (sizeof($unknownValues) <= 0)
        {
            $this->pass();
        }
        else
        {
            if ($failMessage === null)
            {
                if ($strict === false)
                {
                    $failMessage = sprintf($this->getLocale()->_('%s does not contain values %s'), $this, $this->getTypeOf($unknownValues));
                }
                else
                {
                    $failMessage = sprintf($this->getLocale()->_('%s does not contain strictly values %s'), $this, $this->getTypeOf($unknownValues));
                }
            }

            $this->fail($failMessage);
        }

        return $this;
    }

becomes

protected function intersect(array $values, $failMessage, $strict)
    {
        $unknownValues = array();

        foreach ($values as $value) if (\mageekguy\atoum\instrumentation\coverage::markCondition('mageekguy\atoum\asserters\phpArray::intersect', 0, in_array($value, $this->value, $strict) === false))
        {
            $unknownValues[] = $value;
        }

        if (\mageekguy\atoum\instrumentation\coverage::markCondition('mageekguy\atoum\asserters\phpArray::intersect', 1, sizeof($unknownValues) <= 0))
        {
            $this->pass();
        }
        else
        {\mageekguy\atoum\instrumentation\coverage::markCondition('mageekguy\atoum\asserters\phpArray::intersect', 2, true);
            if (\mageekguy\atoum\instrumentation\coverage::markCondition('mageekguy\atoum\asserters\phpArray::intersect', 3, $failMessage === null))
            {
                if (\mageekguy\atoum\instrumentation\coverage::markCondition('mageekguy\atoum\asserters\phpArray::intersect', 4, $strict === false))
                {
                    $failMessage = sprintf($this->getLocale()->_('%s does not contain values %s'), $this, $this->getTypeOf($unknownValues));
                }
                else
                {\mageekguy\atoum\instrumentation\coverage::markCondition('mageekguy\atoum\asserters\phpArray::intersect', 5, true);
                    $failMessage = sprintf($this->getLocale()->_('%s does not contain strictly values %s'), $this, $this->getTypeOf($unknownValues));
                }\mageekguy\atoum\instrumentation\coverage::markJoin('mageekguy\atoum\asserters\phpArray::intersect', 6);
            }

            $this->fail($failMessage);
        }\mageekguy\atoum\instrumentation\coverage::markJoin('mageekguy\atoum\asserters\phpArray::intersect', 7);

        return $this;
    }\mageekguy\atoum\instrumentation\coverage::markJoin('mageekguy\atoum\asserters\phpArray::intersect', 8);
Hywan commented 10 years ago

Problem solved on master. There is another issue with the file::end hook, but I'm working on it.