Skip to content

Instantly share code, notes, and snippets.

@andho
Created September 2, 2012 16:52
Show Gist options
  • Save andho/3601439 to your computer and use it in GitHub Desktop.
Save andho/3601439 to your computer and use it in GitHub Desktop.
merge conflict
/**
* Invokes a matcher or proxies the method call to the intercepted object
* magic call method, if one exists
*
* @param string $method
* @param array $args
* @return boolean|mixed
*/
public function __call($method, $args)
{
if (MatcherRepository::has($method)) {
$this->performMatchingWithUserDefinedMatcher($method, $args);
return true;
}
try {
$this->setExpectedValue($args);
$this->_matcher = $this->getMatcherFactory()
->create($method, $args);
$this->performMatching();
return true;
} catch (InvalidMatcherType $e) {
throw new InvalidMatcher($e->getMessage());
} catch (InvalidMatcher $e) {
}
if ($this->interceptedHasAMagicCall()) {
return $this->invokeInterceptedMagicCall($method, $args);
}
<<<<<<< HEAD
if ($this->callingExpectationsAsMethods($method)) {
$this->throwErrorExpectationsAreProperties();
=======
if (method_exists($this->_actualValue, '__call')) {
$parentInterceptor = new \ReflectionMethod(
$this->_actualValue, '__call'
);
$value = $parentInterceptor->invokeArgs(
$this->_actualValue, array($method, $args)
);
return \PHPSpec\Specification\Interceptor
\InterceptorFactory::create($value, $this);
>>>>>>> junit
}
if ($this->interceptedIsNotAnObject() &&
$this->anExpectationHasBeenUsed()) {
$this->throwNotAMatcherException($method);
}
}
@MarcelloDuarte
Copy link

$ phpspec spec
................................................................................................................................................................................E

Errors:

  1. Spec\PHPSpec\Specification\Interceptor\Object w ill intercept the result of intercepted magic call
    PHPSpec\Specification\Result\Error: $calculator->add(40, 2)->should->equal(42);
    PHP Notice: Trying to get property of non-object

    ./spec/Specification/Interceptor/ObjectSpec.php:27

    ./src/PHPSpec/Specification/Example.php:43

    ./src/PHPSpec/Specification/BaseExample.php:93

Finished in 1.385272 seconds
177 examples, 1 error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment