コード例 #1
0
 /**
  * {inheritDoc}
  */
 public function setMatchers()
 {
     parent::setMatchers();
     VCR::configure()->addRequestMatcher('exception', function (Request $first, Request $second) {
         $first = simplexml_load_string($first->getBody());
         $second = simplexml_load_string($second->getBody());
         $this->assertSame((string) $first->error->class, (string) $second->error->class);
         $this->assertSame((string) $first->request->params->var, (string) $second->request->params->var);
         return true;
     });
     VCR::configure()->enableRequestMatchers(['method', 'url', 'host', 'post_fields', 'exception']);
 }
コード例 #2
0
 /**
  * {inheritDoc}
  */
 public function setMatchers()
 {
     parent::setMatchers();
     VCR::configure()->addRequestMatcher('exception', function (Request $first, Request $second) {
         $first = json_decode(gzuncompress(base64_decode($first->getBody())));
         $second = json_decode(gzuncompress(base64_decode($second->getBody())));
         $this->assertSame($first->message, $second->message);
         $this->assertSame($first->extra->php_version, $second->extra->php_version);
         return true;
     });
     VCR::configure()->enableRequestMatchers(['method', 'url', 'host', 'post_fields', 'exception']);
 }
コード例 #3
0
 /**
  * {inheritDoc}
  */
 public function setMatchers()
 {
     parent::setMatchers();
     VCR::configure()->addRequestMatcher('exception', function (Request $first, Request $second) {
         $first = json_decode($first->getBody());
         $second = json_decode($second->getBody());
         $this->assertSame($first->events[0]->exceptions[0]->errorClass, $second->events[0]->exceptions[0]->errorClass);
         $this->assertSame($first->events[0]->metaData->php_version, $second->events[0]->metaData->php_version);
         return true;
     });
     VCR::configure()->enableRequestMatchers(['method', 'url', 'host', 'post_fields', 'exception']);
 }
コード例 #4
0
 /**
  * {inheritDoc}
  */
 public function setMatchers()
 {
     parent::setMatchers();
     VCR::configure()->addRequestMatcher('exception', function (Request $first, Request $second) {
         $first = json_decode($first->getBody())->data->body->trace->exception;
         $second = json_decode($second->getBody())->data->body->trace->exception;
         // The below asserts will throw exceptions, however Rollbar swallows them up and PHPUnit doesn't detect
         // them. So we catch and set the exception to be rethrown when outside Rollbar.
         try {
             $this->assertSame($first->class, $second->class);
             $this->assertSame($first->message, $second->message);
         } catch (PHPUnit_Framework_ExpectationFailedException $e) {
             $this->requestsMatchedException = $e;
         }
         return true;
     });
     VCR::configure()->enableRequestMatchers(['method', 'url', 'host', 'post_fields', 'exception']);
 }