示例#1
0
 /**
  * @param Event $event
  *
  * @throws PagSeguroException
  */
 public function handleError(Event $event)
 {
     if (!Environment::isValid($event->getRequest()->getHost())) {
         return;
     }
     throw PagSeguroException::create($event->getResponse());
 }
 /**
  * @test
  */
 public function getUrlShouldAppendProtocolAndHostToResource()
 {
     $this->assertEquals('https://test.com/test', $this->environment->getUrl('/test'));
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->environment = $this->getMockForAbstractClass(Environment::class);
     $this->environment->expects($this->any())->method('getHost')->willReturn('test.com');
     $this->environment->expects($this->any())->method('getWsHost')->willReturn('ws.test.com');
 }
示例#4
0
 /**
  * @param string $resource
  * @param array $params
  *
  * @return string
  */
 public function getWsUrl($resource, array $params = [])
 {
     $params = array_merge($params, ['email' => $this->email, 'token' => $this->token]);
     return sprintf('%s?%s', $this->environment->getWsUrl($resource), http_build_query($params));
 }