Exemple #1
0
 /**
  * Override method to set in an matcher of type Streamwide_PHPUnit_Framework_MockObject_Matcher_InvokedAtMethodCall
  * the method name.
  *
  * @param string|PHPUnit_Framework_Constraint $constraint When you have an Streamwide_PHPUnit_Framework_MockObject_Matcher_InvokedAtMethodCall matcher, constraint must be string (method name)
  */
 public function method($constraint)
 {
     /*
      * When the invocationMatcher of the curent matcher we build is of type
      * Streamwide_PHPUnit_Framework_MockObject_Matcher_InvokedAtMethodCall,
      * we need to set it the method name. The constraint must be a string specifying method name
      */
     if ($this->matcher->invocationMatcher !== NULL && $this->matcher->invocationMatcher instanceof Streamwide_PHPUnit_Framework_MockObject_Matcher_InvokedAtMethodCall) {
         if (!is_string($constraint)) {
             throw new RuntimeException('When you use an atMethodCall matcher, the method constraint must receive a string representing the name of the method.');
         }
         $this->matcher->invocationMatcher->methodName = $constraint;
     }
     return parent::method($constraint);
 }
 public function __construct(PHPUnit_Framework_MockObject_Stub_MatcherCollection $collection, PHPUnit_Framework_MockObject_Matcher_Invocation $invocationMatcher)
 {
     $this->builder = $collection;
     parent::__construct($collection, $invocationMatcher);
 }